django-admin

how to add readonly_field in django admin site?

Hi all, I have the following problem: I have two models: Article and Comment, in Comments, i have parent = models.ForeignKey(Article). I have it set up so that Comments is inline to ArticleAdmin(admin.ModelAdmin), and CommentInline(admin.StackedInline). Also, all fields in CommentInline i've put into readonly_fields. What I would like ...

Cannot Extend Django 1.2.1 Admin Template

I am attempting to override/extend the header for the Django admin in version 1.2.1. However when I try to extend the admin template and simply change what I need documented here: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-vs-replacing-an-admin-template), I run into a recursion problem. I have an index.html file...

django-admin - how to modify ModelAdmin to create multiple objects at once?

let's assume that I have very basic model class Message(models.Model): msg = models.CharField(max_length=30) this model is registered with admin module: class MessageAdmin(admin.ModelAdmin): pass admin.site.register(Message, MessageAdmin) Currently when I go into the admin interface, after clicking "Add message" I have on...

Strange bug in Django admin list-editing mode

We have Django as DB editor for our customers. We have 2 installations on different servers - one talking to dev DB and used for testing new features (we do some customizations to admin), another used on production. It's convenient for customer to use list editing mode for batch updating one field for one model. The set of list-editable...

Django Caught an exception while rendering: No module named registration

I seem to have run into a bit of an issue. I am busy creating an app, and over the last few weeks setup my server to use Git, mod_wsgi to host this app. Since deploying it, everything seems to be running smoothly however, I had to go through all my files and insert the absolute url of the project to make sure it works fine. on my loca...

Django admin urls return INVALID REQUEST! - Django

Hi folks, my admin urls are sat behind a prefix by doing the following. 1# (r'^admin/', include(admin.site.urls)), is placed within urls_core.py 2# (r'^api/', include('project.urls_core')), is palced within urls.py All admin URLs work fine except app indexes. If I go to any URL such as: /api/admin/core/ /api/admin/registr...

How to add link to Django admin inline

I have an admin page with inlines. In each inline, I want to put some custom text with link to the regular admin page for the object from that inline. Is this possible without customizing/hacking admin templates? ...

Setting custom SQL in django admin

I'm trying to set up a proxy model in django admin. It will represent a subset of the original model. The code from models.py: class MyManager(models.Manager): def get_query_set(self): return super(MyManager, self).get_query_set().filter(some_column='value') class MyModel(OrigModel): objects = MyManager() class Me...

Using Django Admin for a custom database solution

A client wants to have a simple intranet application to manage his process. He runs a Quarry and wishes to track number of loads delivered per day and associated activities. Since I knew about Django's excellent Admin interface, I figured I could define the "Schema" in models.py and have Django Admin generate the forms. I did exactly t...

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 logged in admin user making changes. While this seems simple (and indeed, the docs show an example for this when the user field is part of the M...

how to customize django admin for clickable list_editable

Hi all, Currently, i have a class MyAdmin(admin.ModelAdmin), and i have a field in there called name, which belongs to both list_editable and list_display. The current behavior is such that all fields that is in list_editable displays a form field. However, i would like to change that only when people click on the field would it turn in...

where is everything in django admin?

Hi all, I would like to figure out where everything is in django admin. Since i am currently trying to modify the behavior rather heavily right now, so perhaps a reference would be helpful. For example, where is ModelAdmin located, i cannot find it anywhere in C:\Python26\Lib\site-packages\django\contrib\admin. I need that because i wou...

Django not recognizing django admin urls

I just registered my models my models with django admin. I navigate to the django admin at /admin. I log in sucessfully and I can see all my models. great so far. But now if I try to click one of the links, for Ex: 'users', django gives me a 404 saying The current URL, admin/auth/user/, didn't match any of these. Its really weird b...

Why can't Django find my admin media files once I leave the built-in runserver?

When I was using the built-in simple server, everything is OK, the admin interface is beautiful: python manage.py runserver However, when I try to serve my application using a wsgi server with django.core.handlers.wsgi.WSGIHandler, Django seems to forget where the admin media files is, and the admin page is not styled at all: gunicorn...

Django admin, filter objects by ManyToMany reference

Hello! There's photologue application, simple photo gallery for django, implementing Photo and Gallery objects. Gallery object has ManyToMany field, which references Photo objects. I need to be able to get list of all Photos for a given Gallery. Is it possible to add Gallery filter to Photo's admin page? If it's possible, how to do it...

Hacking Django Admin, hooks for login/logout.

How do I add hooks to the Django Admin, such that I can execute a function when the user logs in or out? ...

Django model manager use_for_related_fields and ModelAdmin relationships

I am having trouble getting my model manager to behave correctly when using the Admin interface. Basically, I have two models: class Employee(models.Model): objects = models.EmployeeManager() username = models.CharField(max_length=45, primary_key=True) . . . class Eotm(models.Model): #Employee of the Month date = models...

How to display total record count against models in django admin

Is there a neat way to make the record/object count for a model appear on the main model list in the django admin module? I have found techniques for showing counts of related objects within sets in the list_display page (and I can see the total in the pagination section at the bottom of the same), but haven't come across a neat way to ...

how to display inline elements in list_display?

Hi all, I have the following problem: I have two models: Article and Comment, in Comments, i have parent = models.ForeignKey(Article). I have it set up so that Comments is inline to ArticleAdmin(admin.ModelAdmin), and CommentInline(admin.StackedInline). What i would like is that for Article list view (elements chosen in list_display), ...

why save_model method doesn't work in admin.StackedInline?

Hi all, I have a similar problem as a previously solved problem of mine, except this time solution doesn't seem to work: http://stackoverflow.com/questions/2991365/how-to-auto-insert-the-current-user-when-creating-an-object-in-django-admin Previously i used to override the save_model to stamp the user submitting the article. Now i nee...