Skip to content
Advertisement

Tag: django

Django Form does not save properly

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

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

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

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

Advertisement