I am dockerizing my Django app and I have the following docker-compose.yml file: App logs: I want my container (or the app, idk) to reload whenever I let’s say make changes to my models or functions etc. For now, I add some functionality to my app, edit some html views, but no changes appears and the app logs doesn’t say
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
If the username or password is invalid when logging in, how can appear an error on page without refreshing itself, Django
I have a login pop-up and I want after typing wrong username or password to appear a error message, like usual ‘Username or password is incorrect’, but after pressing button on the site, it is refreshing and I need to open my pop-up again in order to see the error, how can I do the error msg to appear without
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
ValueError at /category/economy/: Field ‘id’ expected a number but got ‘economy’
I try to add new path and this happen “Field ‘id’ expected a number but got ‘economy’.” in traceback the highlighted line is in the views.py file which i mentioned below. I am sharing my files plz help me to get rid of the issue. urls.py here i used str:cats, yet it shows “Field ‘id’ expected a number but got
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: Perform GROUP BY over a view queryset
I need to perform group by over a queryset of objects already filtered by standard django filters in order to filter by how many objects in queryset are related to same foreign key object. My code now (does not work): If I filtered over all objects, I could have used but how can I do the same thing with QuerySet?
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