Django admin: exclude field on change form only

If there a way to detect if information in a model is being added or changed. If there is can this information be used to exclude fields. Some pseudocode to illustrate what I'm talking...

Unique BooleanField value in Django?

Suppose my models.py is like so: class Character(models.Model): name = models.CharField(max_length=255) is_the_chosen_one = models.BooleanField() I want only one of my Character...

Showing custom model validation exceptions in the Django admin site

I have a booking model that needs to check if the item being booked out is available. I would like to have the logic behind figuring out if the item is available centralised so that no matter...

model not showing up in django admin

I have ceated several django apps and stuffs for my own fund and so far everything has been working fine. Now I just created new project (django 1.2.1) and have run into trouble from 1st...

Admin page on django is broken

I've set up a django project with an admin page. It worked perfectly for the first couple weeks of development, didn't use the admin page for a while, and when I came back to it, the admin page...

Using Python's os.path, how do I go up one directory?

I recently upgrade Django from v1.3.1 to v1.4. In my old settings.py I have TEMPLATE_DIRS = ( os.path.join(os.path.dirname( __file__ ), 'templates').replace('\\', '/'), # Put strings here,...

Access parent object fields of save_formset and save_model

I have a ActionAdmin model, which is used as ActionAdminInline in the InvoiceAdmin model. In InvoiceModel i override save_formset, to auto set some values. Setting the values for each Action...

Installing Django with pip, django-admin not found

I installed python using: brew install python and then eventually pip install Django. However when I try to run django-admin.py startproject test I just get a file not found. What did I forget?

Django admin does not login properly with custom User model

I upgraded an app I had on Django 1.4.5 to Django 1.5 and just finished migrating over to a custom User model. When I login to my app, using my own authentication form, with my superuser...

Django admin MySQL slow INNER JOIN

I have a simple model with 3 ForeignKey fields. class Car(models.Model): wheel = models.ForeignKey('Wheel', related_name='wheels') created = models.DateTimeField(auto_now_add=True) ...

Django: storing user preferences

I am still very new to Django and trying to figure out what is the best approach for the following problem. I want to store user personal preferences (things user likes or dislikes) as simple...

The current URL, app/, didn't match any of these

I'm a newbie in Django and just started looking at it before a day by installing Django 1.10 on my local. I've followed all the instructions of this link...

Can't log in to admin site in Django

I was working through the polls tutorial and everything was fine until I tried to log in to the admin site; it just said "Please enter the correct username and password for a staff account. Note...

TemplateDoesNotExist at / base/index.html when deploying to heroku

I've been working on this issue for days and I would really love some real help here! :) I'm brand new to Python, Django, and stackoverflow, so please let me know if more information or a...

Django admin login returns Forbidden 403 CSRF verification failed. Request aborted

Pretty new to Django. Working through a second project following the Polls tutorial on Django website. Previous effort went well, albeit simple. This time around encountering problems accessing...

I keep getting RelatedObjectDoesNotExist at /admin/login/. How do I successfully create user profiles in Django via a one to one relationship?

I'm trying to extend the built-in user and add some more information to it. I have two apps in my django project- general and user_details. Inside my user_details app, in the models.py file, I...

Django: TemplateDoesNotExist at /accounts/login/

I'm following this tutorial from Mozilla.org, *Setting up your authentication views* And I'm having problems in this part: *The next step is to create a registration directory on the search path...

docker-compose/django TypeError: expected str, bytes or os.PathLike object, not NoneType

I'm trying to set up my Django and postgres dev environment with docker so I can run it on other machines more easily as well as run everything from 1 terminal window (I'll be adding my react...

Django no such table: django_site after deleting migrations and database

I tried to change an app name. This didnt work and so I tried to change it back. This didnt work either and I deleted all migrations and my db.sqlite. Now whenever I try makemigrations or migrate...

How to pass Audio file from model to Template in Django?

I've just started out with Django and have tried making an audio player application website. I (admin) want to be able to upload audio files that visitors can listen to. I've created a model for...

Loading audio file to template causes ConnectionResetError: [Errno 54] Connection reset by peer (Django, Python)

I am making an audio player webapp using Django. The audio files are uploaded by admin via a model that adds the file to my Media directory. Then in my template the audio files are displayed with...

How to change the name of objects in Django admin?

What to do? I kept restarting my server but it still didn't work. This is the whole code snippet of my models.py: from django.db import models class Blog(models.Model): title =...

Can't login to django admin account after creating super user

I created a project in django and the first thing I want to do is to create a superuser for admin account and then proceed with the django project but the problem is after creating a superuser...

Retrieve data from external API and display in django admin

Rather than querying a local database I would like to use an external API to retrieve the data to display in the django admin. For simplicities sake I have a model, and plan to retrieve a list of...

how to tell if a screen is add or change in django admin

I am trying to determine if the admin screen in Django is add or change in the save method. If I internet search on this, I cannot find any answer. What is the proper way to do this in Python?

Horizon Access - Unable to create a new session key. It is likely that the cache is unavailable

I tried to access Horizon as recommended here, through the IP 10.20.20.1 and admin user, and received the following runtime error: Request Method: | POST -- |...

How to change the user display name to their first name in Django

I am using the Django inbuilt user authentication system, from from django.contrib.auth.models import User. And I have realised that in the admin page it always displays the username of the user....

how to make static files works using django docker nginx and postgresql since its not serving them

When i try to access http://127.0.0.1:8000/admin, i get this. my folder structure is : django-react-nginx | |_ _ docker-compose.yml | > backend | |_ Dockerfile | ...

Why I am getting "Not Implemented Error: Database objects do not implement truth value testing or bool()." while running makemigration cmd in django

I am trying to connect Django with MongoDB using Djongo. I have changed the Database parameter but I am getting this error Not Implemented Error: Database objects do not implement truth value...

Access cleaned data from django admin for pdf processing

Hi there I'm fairly new to django so please be kind if anything sounds a bit newbie to you. I am currently trying to add a print button to every existing django admin view of a project so it will...