Django's built-in, automatic admin interface (django.contrib.admin) which is part of the Django Web framework for the Python programming language.

learn more… | top users | synonyms

0
votes
1answer
44 views

Django extending user model

I have a model called Farmer which extends 'User' plus it has some additional attributes like birth date, telephone number etc. How can I use User's attribute such as first_name, last_name to refer ...
0
votes
1answer
31 views

Django models deifinition many to many field

I have the following case: class Product(models.Model): name = models.CharField(max_length=200) class Order(models.Model): product = models.ManyToManyField(Product) quantity = ...
0
votes
1answer
19 views

Django: manage.py works fine but django-admin fails

I've been starting up a new django project (django 1.8.13, python 3.4) and everything is working fine. However, I just noticed, django-admin returns these errors if I use it instead of manage.py It's ...
0
votes
3answers
34 views

How to encrypt TextField before saving in database

Here I am Trying to create Model where i can save Password, here my model: class Server(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) name = ...
0
votes
0answers
18 views

How do I extend Django admin's DateFieldListFilter class ?

I am a newbie with Django and have a model with a DateTime field which is shown in the django admin. In the list_filter option when I specify the fieldname I get the basic Django filter interface for ...
1
vote
1answer
96 views

Add a field to the ModelAdmin Form

I want to give users the possibility to create multiple events at once. Therefore I would like to add a field to the admin-add-page where a number of repetitions can be specified. Then I want to ...
1
vote
2answers
42 views

Using admin site in Django

I have a model with two date fields, for submitted and published and a boolean field for approved. class BlogModel(models.Model): title = models.CharField(max_length=100) article = ...
6
votes
4answers
4k views

Redirect request to admin interface

After enabling the admin interface and starting the devolpement web server on e.g. 128.0.0.1:8000, i am able to reach the admin interface on 128.0.0.1:8000/admin. Obviously due the following URL ...
3
votes
2answers
4k views

Change field name in django admin

I am customizing django admin and I would like to change the display name of my fields. I think the answer is here but I can't find it. I already change the table name thanks to Meta class. I have ...
0
votes
0answers
29 views

Track time spent by a user in a web page in django

I'm searching on how to track time spent by a user in a webpage of my django app. I would like to store this time in the database in a column next to the username. I've checked many solutions posted ...
2
votes
1answer
772 views

set numbers of admin.TabularInline in django admin

how can I set numbers of admin.Tabularline in django admin? in default, it shows 3 empty rows and i just want to show only 1 empty row. class ClientPaymentOptionInline(admin.TabularInline): model ...
0
votes
1answer
13 views

Remove Python Social Auth from django admin

I tried unregistering the models from 'social.apps.django_app.default' app. But django says they are not registered. I don't understand how to remove Association, Nonce and UserSocialAuth from my ...
0
votes
1answer
12 views

override django_adminreadonlyfield.html

I'm working on the django admin change form page, using django 1.8 and material design. I have a field, color, which was a long array that didn't fit on one line, and since ArrayField apparently only ...
0
votes
1answer
11 views

Django 1.9 admin - where to put a customized base.css file?

I am using the Django 1.9 admin and I copied the base.css file and renamed it base2.css and put it in the directory mysitedirectory\myprojectdirectory\templates\admin\static\admin\css. In the ...
0
votes
0answers
34 views

How to set queryset or limit or filter in ManytoManyField

Hello all here I am new in Django till now I worked with simple models and generic views. Now I have two models, Server and InventaryGroups, where InventoryGroups is group of Servers. class ...
0
votes
1answer
28 views

Upgrading from 1.8 to 1.9 Django Admin get_urls not working

I am using the Django admin and have just upgraded from 1.8 to 1.9. In 1.8, I added a click button to the change_form that takes me to another html template using the get_urls override. Like this: ...
35
votes
5answers
23k views

Django Admin: Using a custom widget for only one model field

I have a DateTimeField field in my model. I wanted to display it as a checkbox widget in the Django admin site. To do this, I created a custom form widget. However, I do not know how to use my custom ...
6
votes
1answer
4k views

How to set default values in TabularInline formset in Django admin

How to set first default rows/values in django admin's inline? class Employee(models.Model): username = models.CharField(_('Username'), max_length=150, null=False, blank=False) ...
8
votes
6answers
5k views

Django: Admin inline forms initial data for every instance

I've been reading a lot but I don't seem to be able to figure out a solution to this. I'm writing an application in Django, I'm still writing the admin side. I have a model called "Environments" and ...
10
votes
2answers
5k views

Django InlineModelAdmin - set inline field from request on save (set user field automatically) (save_formset vs save_model)

I have two models, a MainModel and a related InlineModel that i'd like to show as an inline in the admin. This InlineModel can be used for, say, making notes about the model and should track the ...
0
votes
0answers
8 views

how to initialize admin inline via url parameters

In Dgjango 1.8 let's assume I have a simple model like this: class Car(models.Model): brand = models.TextField() class Condition(models.Model): car = models.ForeignKey(Car) price = ...
1
vote
1answer
30 views

Looking for a simple way to display a code block in Django admin

I'm looking for a way to display a block of code (i.e. show a snippet of markup) in Django admin. I've been digging around for a while, and my current (non-working) approach is: from django.template ...
0
votes
3answers
32 views

Django admin gives error “'Model' object has no attribute 'field_name'” after field name change

To improve my code and database, I needed to change the field name in a model away from a value that was confusing and close to a reserved word. The original model was effectively this: class ...
0
votes
0answers
10 views

Deactive A Customer on a Django Website

I am trying to teach myself how to use Django. I am trying to add radio buttons in my admin to active/deactive a user's account. During signup they are automatically active. But if they cause any ...
1
vote
1answer
31 views

Filter django admin by logged in user (Foreign Key showing up)

I want the admin users to see only the model instances they created. I followed these instructions Filter django admin by logged in user class FilterUserAdmin(admin.ModelAdmin): def ...
-1
votes
2answers
23 views

How to add Django ldap users to Django ModelBackend Groups

I am running Django-1.7.7 with ModelBackend(default) with few users and 2 groups. Now i have implemented Ldap Backend too with Model Backend. But after that i have to add all of the Ldap ...
4
votes
1answer
2k views

Link in django admin to foreign key object

I have a model A with a ForeignKey to a model B. In Django admin, how can I add a link in the admin page of model A next to the ForeignKey field which open the admin page of the model B ?
-2
votes
0answers
25 views

About AUTH_USER_MODEL and ValueError: Related model 'users.User' cannot be resolved

users.User is my custom User model. In blog APP, define one foreign key related with users.User. After run “python manage.py migrate”, it report error ‘ValueError: Related model 'users.User' cannot be ...
0
votes
0answers
19 views

Use custom manager in django admin

I have django model with custom manager that generate data for the model based on 2 values. class SomeModelManager(models.Manager): def create_account(self, user, name, region): lvl = ...
0
votes
2answers
31 views

Django upgrade from 1.2.5 to 1.3 error in admin

I am attempting to upgrade a website running django 1.2.5 to 1.3 The only error I have encountered so far is in the admin part of the site: __init__() got an unexpected keyword argument 'field_path' ...
0
votes
2answers
20 views

Group objects by specific column in admin page

class Attack(models.Model): action_id = models.IntegerField() village_id = models.IntegerField() unit_name = models.CharField(max_length = 30) enemy_village_id = models.IntegerField() ...
1
vote
1answer
26 views

Allowing a Django-admin user to add an <option> to a <select> dropdown

I have a contact form that is posting values to a model called Enquiry. The Enquiry model has an attribute named enquiry_type which is a dropdown select box on the form. Current options are 'general ...
1
vote
2answers
1k views

django-admin.py: command not found (bluehost server)

After struggling more than 6 hours, I decided to ask for help. Mission: To create a project with the help of Django Tools: Windows Vista, Putty SSH Location: Bluehost (www.bluehost.com) Server I ...
-1
votes
0answers
30 views

How can I expand a modified User model's field coverage in the Django admin?

I've been working on adding some functionality on a project in which I am perhaps controversially customizing a Pinax application and its Django installation. I have added three integer fields to the ...
0
votes
0answers
7 views

How to integrate TimePicker in Forms.py Django?

forms.py time = forms.TimeField(widget=forms.TextInput(attrs={'class':'timepicker'})) Html <script> $(function() { $(".timepicker").timepicker({}); }); ...
4
votes
1answer
1k views

Adding indexes to model fields in Django with migrations

I am trying to add indexes on model fields using Field.db_index for an app that has migrations. Looking at Django's documentation all I need to do is to set db_index=True: class Person(models.Model): ...
0
votes
0answers
16 views

Adding new table from admin view

I am looking for a way to add a new table in one of two ways: Add a new model to app from admin view. , or: Two apps A and B. If a new entry to the first model in model A is created then it will ...
0
votes
1answer
12 views

Decouple django admin inline in different apps

I'm trying to decouple 2 apps, so far I've decouple different parts of the implementation. However I'm stuck when decoupling the django-admin. The dependency between apps must be clear, (i.e. NO ...
0
votes
1answer
20 views

Django Custom Auth Model can't login from Admin portal

I've created custom user profile model for Django's auth app, and the issue that I can't login using Django Admin login form. Note: User is_superuser=1 and is_staff=1 models.py ...
1
vote
1answer
26 views

How to add custom page to django admin with custom form, not related to any Model?

I want to bulk_create models by importing csv data through django admin, with TextArea or FileField. I learned how to override template blocks, how to add new urls to django admin. But I have no idea ...
0
votes
1answer
15 views

Adding Image into Django Admin ImageField and displaying it in html

Could anyone give a simple working example how to display in html file images added through ImageField in Django Admin? There are many solutions to specific problems but I could not found one simple ...
1
vote
2answers
28 views

Django auth: Where to put custom templates?

I want to set up user authentication with Django (1.9). As described in the documentation I included the auth view in my project's urls.py like urlpatterns = [ ..., url('^accounts/', ...
0
votes
0answers
31 views

Django show object count on admin interface

I have modified my dashboard with the help of dashboard.py file. There in I have added a custom module/widget called 'My Widget' (haven't created myself but rather just appended as a child referring ...
0
votes
1answer
44 views

Limit choices and validate django's foreign key to related objects (also in REST)

I have my models.py like this: class Category(models.Model): user = models.ForeignKey(User) name = models.CharField(max_length=256, db_index=True) class Todo(models.Model): user = ...
7
votes
5answers
4k views

Admin Site: TemplateDoesNotExist at /admin/

I'm following Django's official Tutorial 2 but for some reason cannot create an admin site despite following all the steps correctly to my understanding. This is the error I get: ...
1
vote
1answer
24 views

Django count today's logged in users

I want to show on my admin interface the count of the users those did log in today. My admin interface looks like following: When I print from my view count = ...
0
votes
0answers
12 views

Staff access automatically removed on login to Django + ldap

On my Django site I have two accounts, one regular user that I login through ldap, and one admin that I created with createsuperuser. When I changed my regular user account status to "staff" in the ...
0
votes
1answer
16 views

Showing hyperlinked reverse foreign key in Django Admin

I have two models class Transaction(TimeStampedModel): """ Stores transaction details """ user = models.ForeignKey(settings.AUTH_USER_MODEL) payment_method = ...
3
votes
3answers
4k views

Add custom html between two model fields in Django admin's change_form

Let's say I've two models: class Book(models.Model): name = models.CharField(max_length=50) library = models.ForeignKeyField('Library') class Library(models.Model): name = ...
4
votes
3answers
562 views

Django 1.7 removing Add button from inline form

I'm having problems achieving a (probably) rather simple task. I have fully modifiable models (Prodotto, Comune) which are shown as "addable" fields, as shown in picture below. What I'd rather not see ...