Skip to content
Advertisement

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 receive the error that name wasn’t

How to register inherited sub class in admin.py file in django?

Project Name : fusion App Name : admin_lte Python 3.7 Django 2 MySql Question is “I want to register sub model in django admin-panel”,when i write code for model registration in admin.py file that time occurred below error. django.core.exceptions.ImproperlyConfigured: The model Device is abstract, so it cannot be registered with admin. NOTE : I used multiple separated model file. device.py

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 redirect to “post_detail”, not generate new page for comment form. And сould you tell, which parameters has

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 the AbstractUser and put the unique email address

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 saving everything under the user with pk=1.

“OperationalError: no such table: django_site” when running makemigrations with empty database when using Django-todo

I have inherited a Django 1.11.6 application from another developer. Now after I have made a lot of changes to the code and data model, I want to re-create the sqlite database from scratch. But when I run manage.py makemigrations in the project directory (no migration files and database present), I am getting the following error message: ‘django.contrib.sites’ is present

Advertisement