I want to create a comment system. I can take username, doc_id, and comp_name, but I cannot get the comment_others. I think there is a problem saving the form. How can I fix it? views.py models.py forms.py template.html And there are two forms on the same page. When I save this form, the other form disappears. Why it could be
Tag: django
Django: how to check a guest or a page owner entered the page
I am doing a social network, I have one profile template for all users, how to check a guest or a page owner entered the page, {% if profile.user.username == None%} tried to write like this in html but it works strangely.For users, I use the Profile model Answer try this https://docs.djangoproject.com/en/3.1/topics/templates/
Celery is not loading tasks from one app out of five
I’m using autodiscover in my celery.py file for gathering tasks. Which up until a recently picked all of the app.tasks.py up, I’m not sure why but my config.tasks.py function are no longer being picked up, but all the other apps are. If I from “config.tasks import *” there are no errors and I can run the tasks manually through shell.
How to track download link in django?
I followed these method to track how much downloaded the file was. But total_downloads always remains same (it’s 0). How to increment total_downloads field by 1 after every download? My models.py: views.py. In this program, I want to increment the number of downloads. But it’s 0 in admin site. urls.py index.html from where people can download the file Answer Try
form registers as valid but does not update
This is a very weird phenomenon. Why is it that even though the form is valid, the values are not updated? It works if i do it in django admin though. I am not even receiving any errors. The form is just valid but its not being updated. Its as if they took the old values to update… html: views.py
Django Querysets adding additional information inside View
I’m currently working on a small django application for my school. I got two models involved in this problem: “category” and “device”, which are connected in a one-to-many relationship category—<device(s) I added one page/template/view for the category overview, containing a large table with all the relevant information on every category created. Querying the categories like this: And displaying them inside
‘ManyToManyDescriptor’ object has no attribute ‘all’ when accessing related_name
I have 3 models: and I am trying to access all passengers of a certain Flight when I visit /<int:flight_id> like this: Your response is appreciated Thank you In advanced Answer You can access passengers of an instance of Flight, not directly from class Flight:
Why am I getting django.db.models error telling me I have no attribute for TextChoices in Django (3.1.6) and Python(3.8)?
thanks so much for reading. I’ve got this running on my computer no problem. It’s working on my VS on Windows 10. But this error keeps coming up, it looks like TextChoices is no longer usable? AttributeError: module ‘django.db.models’ has no attribute ‘TextChoices’ I’m putting it u0p on PythonAnywhere, Python 3.8, and Django 3.1.6 I am still new at this,
why is day out of range?
i am trying to add a date to an application that I am writing. the apllication is actualy a list of activities. when i tried to add a datefield to the ui and save it into my database. i got this error this is my model this is my html page and this is my view i cant figure out
Django: Make a Queryset with annotate using an object’s property
I have a queryset in my Django views.py. I’m using annotate to add a promo property to each object based on each object’s id. However this is not working: I get the error: name ‘id’ is not defined Answer The way you try you are trying to access a variable id. Try using the Concat function: Reference: Django database Functions