django-admin

How to Save page as Draft

I Had created a detailed form in Django having some mandatory fields .I want to save page as Draft option without exception if mandatory fields are not set that time. How can I do it? ...

Making a CharField use a PasswordInput in the admin

I have a Django site in which the site admin inputs their Twitter Username/Password in order to use the Twitter API. The Model is set up like this: class TwitterUser(models.Model): screen_name = models.CharField(max_length=100) password = models.CharField(max_length=255) def __unicode__(self): return self.screen_name I need the A...

Django ForeignKey TemplateSyntaxError and ProgrammingError

This is are my models i want to relate. i want for collection to appear in the form of occurrence. class Collection(models.Model): id = models.AutoField(primary_key=True, null=True) code = models.CharField(max_length=100, null=True, blank=True) address = models.CharField(max_length=100, null=True, blank=True) collection_...

Django make model field name a link

what Im looking to do is to have a link on the name of a field of a model. So when im filling the form using the admin interface i can access some information. I know this doesn't work but shows what i want to do class A(models.Model): item_type = models.CharField(max_length=100, choices=ITEMTYPE_CHOICES, verbose_name="<a href='htt...

Is there a way to have separate pages for inline admin forms in Django?

Lets say i have a model A. Then, i have several models B, C, D, E etc that each have a foreignKey to model A. I know that i can set B, C, D etc as inlines to model A so that when i create a model A it will show formsets for adding multiple items for each subModel, but i think this would make a fairly cluttered and very large page. I...

How do I add a custom button to the admin listing?

What I want is to put a custom button in each row of a page of the admin listing. These buttons will have a function associate to it acting over that line. I've already knew the "admin actions", but it's not what I want, ok? Thank you! ...

Django remove list_editable on a per row basis.

On the back of Django 1.2RC1, I have built a great administrator for my client! It's awesome. The client has one request that, if not satisfied, could bring this house of cards crashing down. I have a list of swim meet results. A meet result is added by a superuser. A team rep can edit a meet result (which they must be able to do inline...

extending satchmo user profile

I'm trying to extend the basic user registration form and profile included in satchmo store, but I'm in problems with that. This what I've done: Create a new app "extendedprofile" Wrote a models.py that extends the satchmo_store.contact.models class and add the custom name fields. wrote an admin.py that unregister the Contact class ...

Alternate User select interface in django admin to reduce page size on large site?

I have a Django-based site with roughly 300,000 User objects. Admin pages for objects with a ForeignKey field to User take a very long time to load as the resulting form is about 6MB in size. Of course, the resulting dropdown isn't particularly useful, either. Are there any off-the-shelf replacements for handling this case? I've been go...

How to bind events with jquery in django admin when new *Inline is added

I made a jquery function that binds some fields, but it doesn't work when i add a new inline. The main problem is that i don't know how to detect the insertion in DOM and bind it to my function. Thanks ...

ValueError with multi-table inheritance in Django Admin

I created two new classes which inherit model Entry: class Entry(models.Model): LANGUAGE_CHOICES = settings.LANGUAGES language = models.CharField(max_length=2, verbose_name=_('Comment language'), choices=LANGUAGE_CHOICES) user = models.ForeignKey(User) country = models.ForeignKey(Country, null=True, blank=True) cre...

Dynamically setting the queryset of a ModelMultipleChoiceField to a custom recordset

I've seen all the howtos about how you can set a ModelMultipleChoiceField to use a custom queryset and I've tried them and they work. However, they all use the same paradigm: the queryset is just a filtered list of the same objects. In my case, I'm trying to get the admin to draw a multiselect form that instead of using usernames as th...

Django admin: how do I add an unrelated model field to a model change/add page?

I have the following models: class Foo(models.Model): field1 = models.IntegerField() ... class Bar(models.Model): field1 = models.IntegerField() ... class Foo_bar(models.Model): foo = models.ForeignKey(Foo) bar = models.ForeignKey(Bar) ... In the admin, I want it so that in the Foo change/add page, you ca...

Django Admin: how to get the admin widget to appear for both models in a many-to-many relationship?

In the Django docs, it says: By default, admin widgets for many-to-many relations will be displayed on whichever model contains the actual reference to the ManyToManyField I want the widget to appear on the add/change page for both models in the relationship. How do I do that? ...

Django Admin: Many-to-Many listbox doesn't show up with a through parameter

Hi All, I have the following models: class Message(models.Model): date = models.DateTimeField() user = models.ForeignKey(User) thread = models.ForeignKey('self', blank=True, null=True) ... class Forum(models.Model): name = models.CharField(max_length=24) messages = models.ManyToManyField(Message, through="M...

Sinatra Web Admin (like Django Admin)

Is there a way to get a Django Admin style web-admin for Sinatra? ...

Adding links to full change forms for inline items in django admin?

I have a standard admin change form for an object, with the usual StackedInline forms for a ForeignKey relationship. I would like to be able to link each inline item to its corresponding full-sized change form, as the inline item has inlined items of its own, and I can't nest them. I've tried everything from custom widgets to custom te...

How do I reference Django Model from another model

Im looking to create a view in the admin panel for a test program which logs Books, publishers and authors (as on djangoproject.com) I have the following two models defined. class Author(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30) email = models.EmailField() d...

Django: How to get current user in admin forms

In Django's ModelAdmin I need to display forms customized according to the permissions an user has. Is there a way of getting the current user object into the form class, so that i can customize the form in its __init__ method? I think saving the current request in a thread local would be a possibility but this would be my last resort th...

Django admin - remove field if editing an object

I have a model which is accessible through the Django admin area, something like the following: # model class Foo(models.Model): field_a = models.CharField(max_length=100) field_b = models.CharField(max_length=100) # admin.py class FooAdmin(admin.ModelAdmin): pass Let's say that I want to show field_a and field_b if the u...