Category "django-views"

django get the value enside formvalid

I am trying to obtain the value of the val variable that is inside form_valid but I cannot obtain it. Does anyone have any idea what I'm doing wrong? class Coti

In django after deleting the posts the post images are still in the directory

In django my posts are deleted but the files are not. I have a image field in the model which i want to deelete whenever the author deletes it. I'm using generi

file extentions in Django

I have created a file upload website where I want to allow users to upload files in pdf, ppt, doc, txt, and zip format. I am using the HTML form to upload files

Django: At the view level, can I add a 'noindex' header to a 'redirect' response?

I can use robots.txt, and I can use custom Django middleware, but I'd like to know whether this is something that can be done at the view level.

Testing Django FileResponse

I have a Django view that returns a file. The FileResponse is built for that purpose. However, I do not understand how to test this. Right now I use the HttpRe

How to display Foreign key Data in Django view page?

i have relation between Project and ProjectFloorPlan, and i want to display ProjectFloorPlan data in my template. Please let me know how i can display the Forei

How to display Foreign key Data in Django view page?

i have relation between Project and ProjectFloorPlan, and i want to display ProjectFloorPlan data in my template. Please let me know how i can display the Forei

Django: ProtectedError exception handling is not working

I am trying to handle ProtectedError exception and try to post a custom error message in my template. def delete(self, request, *args, **kwargs): obj = sel

Doing some processing locally before uploading

I am new to Django and doing a small project where the user logs into a Django powered website and can then upload some images. These images will need to have s

Nested Category In django

how do I use nested categories in django as Im nwe to django and doing this and find some solutions but didnt work anything class MainCategory(models.Model)

serving media files in Django for Production

I want to serve all types of media files in my Django Project I used Whitenoise to server static files and static files are working well but I'm having issues w

Django : local variable 'date' referenced before assignment but I import it

I am building a script that use the datetime module : def workspace_detail(request, token): yesterday = date.today() - timedelta(days=1) tomorrow = date.today

nothing happens when submitting django form

I have a problem with django forms, when submitting a form nothing seems to happen, even the server didn't get any response except GET request to view the form

Displaying child records based on parent id from URL

I have one model Dataset and another one called DatasetReview, where DatasetReview has a foreign key connection to Dataset. I would like to display all of the D

ValueError: Missing staticfiles manifest entry for 'favicon.ico'

I'm getting a ValueError when running python manage.py test. My project is named fellow_go, and I'm currently working on an App called pickup. Please note that

What is the correct way to implement Django password history?

I have implemented a solution for checking a new password against the last 5 passwords like so: Created 5 fields in a user profile table to store the encrypted

"Local variable referenced before assignment" Django error

I have no idea what may cause this issue. The only change I've made was add the loginquiredmixins to my class-based views. Once I started stylising the login pa

django: return string from view

I know this is a simple question, sorry. I just want to return a simple string, no templates. I have my view: def myview(request): return "return this st

Add extra context to admin index page

In my admin.py of my admin dashboard app I added this following code: class MyAdminSite(admin.AdminSite): def index(self, request, extra_context=None):

In Django, how can we stop losing the details filled in the form, if it fails validation?

I am using the UserCreationForm for user registration in my Django web app. When the user fills in the detail (username, password, confirm_password) and submits