Questions tagged [django-modeladmin]
132 questions
1
vote
2 answers
Django's admin does not login after custom authentication
The custom authentication I wrote follows the instructions from the docs. I am able to register, login, and logout the user, no problem there. Then, when I create a superuser python manage.py createsuperuser, it creates a user in the database, but…

EarlyCoder
- 1,213
- 2
- 18
- 42
1
vote
1 answer
django-autocomplete-light foreign key form
I have followed the tutorial for django-autocomplete-light
http://django-autocomplete-light.readthedocs.io/en/master/tutorial.html
but i have the following question.
I have a model
class Order(models.Model):
client = models.ForeignKey(Client)
…

thodoris
- 69
- 8
1
vote
0 answers
Use Django list_display ModelAdmin in mainsite?
I've got a reasonably good AdminSite working for my app (very much a data-entry / dashboard-style app for scientists working in a collaborative team).
The users have a bunch of experiments they can sort, filter, edit, etc. This works well in the…

nippoo
- 167
- 1
- 6
1
vote
1 answer
Add link to ModelAdmin
I have a ModelForm:
class SomeModelForm(forms.ModelForm):
class Meta:
model = SomeModel
def __init__(self, *args, **kwargs):
super(ApiBackendConfigForm, self).__init__(*args, **kwargs)
if kwargs['instance'].name ==…

rva4
- 43
- 1
- 4
1
vote
1 answer
How can I subclass my ModelAdmins in a Django FeinCMS project?
I have a number of models that extend from feincms.models.Base, and use the FeinCMS item editor in the admin site (i.e. they all use feincms.admin.item_editor.ItemEditor as their ModelAdmin).
The models have some shared functionality that I want…

seddonym
- 16,304
- 6
- 66
- 71
1
vote
1 answer
django admin custom model admin url
So I have a Bookings model in my django app. I am using django admin to display information about the booking. I want to create a custom url directly from the changelist view -- (not the change view).
I want the url to be something like:…

Atul Bhatia
- 1,633
- 5
- 25
- 50
1
vote
1 answer
Django admin creating inline model object
Inside my django admin, I am creating an admin model that has a one to many relationship with another table. Let us call it Recipes and Ingredients. Each recipe has multiple ingredients.
I want to make it so in the admin page a user can create a…

Atul Bhatia
- 1,633
- 5
- 25
- 50
1
vote
2 answers
Django-admin list_editable enable/disable on the fly (edit/view mode check)
I want to change edit/view mode of the page by button (or something like it).
Edit mode is equal to list_editable specified in EntityModelAdmin body.
View mode is equal to empty list_editable.
@admin.register(models.EntityModel)
class…

Mikhail
- 71
- 8
1
vote
1 answer
Django: Order AdminModel by Custom Property
I have a model with a property that I'd like to have the adminmodel ordered by.
class StoreAdmin(admin.ModelAdmin):
list_display = ('user', 'total',)
admin.site.register(Store, StoreAdmin)
Model:
class Store(models.Model):
user =…

Emile
- 3,464
- 8
- 46
- 77
1
vote
2 answers
django user field (populated with django.contrib.auth) in admin
I dont know why but the Django Admin App does not find the user field in the model. Can you help with that?
model.py:
from django.db import models
from django.forms import ModelForm
from django.contrib.auth.models import User
class…

Below the Radar
- 7,321
- 11
- 63
- 142
1
vote
1 answer
How to customize the "Clear" checkbox for a models.ImageField in django Admin page?
i have a Model for a user profile in my django app that has a models.ImageField and i have an ModelAdmin for it
when a user uploads an image , in the admin page , when i go in that user's Customize page , in the ImageField section , there is the url…

Kozet
- 1,103
- 1
- 11
- 19
1
vote
1 answer
Django ModelAdmin with request/user based restrictions on the fieldsets (needs to be Thread Safe)
I have several very customized Django ModelAdmins that I would like to add extra field(s) if the user is a superuser. I found somewhere that someone said to override the get_fieldsets method like this
def get_fieldsets(self, request, obj=None):
…

byoungb
- 1,771
- 20
- 31
0
votes
2 answers
Swap the field type/widget rendered in AdminPage depending on the permissions
Like in the title I want to swap the field that is rendered on to the form.
For example I have the following model:
models.py
class Project(models.Model):
name = models.TextField(max_length=200)
finished =…

KoleS46
- 3
- 1
0
votes
1 answer
ModelAdmin - Many-to-many inlines
Okay, so I have a model that looks like this:
class OpHour( models.Model ):
days_of_the_week =((0,"Sunday"),
(1,"Monday"),
(2,"Tuesday"),
(3,"Wednesday"),
…

George Griffin
- 634
- 7
- 17
0
votes
1 answer
TypeError while rendering: 'long' object is not iterable
I have a few models with some ForeignKey relationship.
Through forms.py I added a ModelMultipleChoiceField widget
class VariableFieldForm(ModelForm):
custom_field = forms.ModelMultipleChoiceField(queryset=VariableField.objects.all(),…

ApPeL
- 4,801
- 9
- 47
- 84