Skip to content
Advertisement

Tag: django

NoReverseMatch at /login/ Reverse for ” not found. ” is not a valid view function or pattern nam

I don’t know why this problem is occuring. The login page is being rendered fine. But when I am clicking the Log In button after filling out the forms, I am getting this error. Can anyone help me solve this? My settings.py: My urls.py: My login.html file: Answer You’ve specified LOGIN_REDIRECT_URL = “”. The documentation for this setting says: The

Django get data from related model which has the FK

how can i make this queryset: models with Property.objects.all() I can see in the returned object that there is a listing_set let say: but it brings the entire model, and not the related to property_id; also tried to get Ota data in serializer with SerializerMethodField and perform a new query to get this info, but decrease performance significantly. Answer I

How to pass a dict to a unit test using parameterized?

I have a list of dicts: How do I pass the dict to a django unit test using parameterized? E.g. Results in AttributeError: ‘str’ object has no attribute ‘items’ because the dict is being converted to a string. Answer As stated in the docs: So I would try to convert MY_LIST to: Which makes it a list of tuples that

Python Django REST Infinite Recursion Problem

As of late I’ve started working towards learning REST Api with Django Rest Framework, Cors headers, and mssql connector both for personal purposes, and for a project I’m working on. Beneath I’ll include snippets of code and or the errors I got to make this easier to digest. Working with this project, I got close to completing a Get/Post/Put method,

How should I insert html input data into a Django database

I can’t figure out how to fix this problem. I’m trying to insert some data from a html form into a small simple Django database; SQLite if I’m right. I tried to follow tutorials and did allot of searching online but it seems like I’ve hit tutorial hell. my question is: How can I achieve putting data from the text

Django – Retrieve a session value to a form

I have a Django aplication and need to get a value from the session and put it in a HiddenInput. I have this code in my view: When I have some value on ‘obra_aberta_id’ I need to put this value on a HiddenInput: But I’m getting an error on ‘request’: name ‘request’ is not defined How can I get a

Advertisement