Skip to content

Tag: django

Django change wrong column name in DB

in my Database (psql) I’ve got a table named offers_offer and inside that there is an column named offer_name, which is wrong, because it should actually be just name. I don’t know why it has this name, but due to this I can’t load any fixtures or create a new object, because I always receiv…

How to send file from Mayan EDMS to external api?

I’m still learning Django and there is still a lot of unknown to me. The problem is that I can’t pull the .pdf (or any other format) to be sent by ajax post method to external API. So on the reciving side I only get the string location of the file not the actual file. I have put the following

How to add a comment to post? PostDetailVew, Django 2.1.5

I want add comment to post on his page (“post detail” page). I was find answer, but it create comment on other page. I want create comment on page of “post detail”. urls.py models.py forms.py views.py comment_form.html post_detail.html I think, “comment_form” need to redire…

Make User email unique django

How can I make a Django User email unique when a user is signing up? forms.py I’m using the from django.contrib.auth.models User. Do I need to override the User in the model. Currently the model doesn’t make a reference to User. views.py Answer The best answer is to use CustomUser by subclassing t…

Querying the database in a Django unit test

I am creating a web application which has a POST endpoint, that does two things: Saves the POSTed data (a university review) in the database. Redirects the user to an overview page. Here is the code for it: I haven’t yet implemented passing the user data to the endpoint, and that’s why I’m s…