django-admin

Is it possible to override the method used to call Django's admin delete confirmation page?

On Django's admin pages, I'd like to perform an action when the administrator clicks the Delete button for an object. In other words, I'd like to execute some code prior to arriving on the "Are you sure?" delete confirmation page. I realize I could override the template page for this object, but I was hoping for something easier (i.e.,...

Linking to the django admin site

Very basic question, but I'm having trouble tracking down the answer on the web. I have a template, which I want to link to the django admin site (i.e. localhost:8000/admin). What is the code for this? I'm imagining something like <a href="{% url admin.site.root %}">link to admin panel</a> However, when I try the above snippet I get:...

Django admin -- restricting access by user

I was wondering if the django admin page can be used for external users. Let's say that I have these models: class Publisher(models.Model): admin_user = models.ForeignKey(Admin.User) .. class Publication(models.Model): publisher = models.ForeignKey(Publisher) .. I'm not exactly sure what admin_user would be -- perhaps it cou...

Conditional Django Middleware (or how to exclude the Admin System)

Hi all, I want to use some middleware I wrote across the whole of my site (large # of pages, so I chose not to use decorators as I wanted to use the code for all pages). Only issue is that I don't want to use the middleware for the admin code, and it seems to be active on them. Is there any way I can configure the settings.py or urls.p...

How to make a customizable user survey in Django.

I am making a system for a company which among other things must hold information about the satisfactory level about various things, I have made it work fine using a fixed model with fixed questions and answers, but I am sure that they will need to change or add questions. So I want to make a system where users can make custom evaluatio...

In Django admin, can I require fields in a model but not when it is inline?

In django admin, there are fields I'd like to require if a model is being edited standalone. If it is inline, I don't want them to be required. Is there a way to do this? ...

For the django admin, how do I add a field to the User model and have it editable in the admin?

Heyas I'm trying to understand the django admin better and at the same time, I'm trying to add one more field to the current user admin. In models.py I've done User.add_to_class('new_field', models.BooleanField(default=False)) and in admin.py I've got the following (with fieldsets basically just copied from django/contrib/auth/admin...

What is the best way to add an API to a Django application?

I am adding MetaWeblog API support to a Django CMS, and am not quite sure how to layer the application. I am using django_xmlrpc, which allows me to map to parameterised functions for each request. It is just a case of what level do I hook in calls to the django application from the service functions (AddPage, EditPage etc) For django-...

define a django model relationship

Hi, I'm writing an app that have recursive relations like this (pseudocode): class atist: name = charfield (...) class press: pub = foreingkey(artist) class works: work = foreingkey(artist) class img: im = foreingkey(works) I'm was thinking if this is the better approach to solve this problem, or if ...

storing file content in DB

I am making a model in which i have a filefield.I wan to store file content in the DB column instead of file path.ANy suggestions ...

Incorporate custom template into the django admin interface and session.

Hi I have made a custom formwizard and incorporated it into my admin interface. Basically I have taken the change_form.html and left it under the admin interface url: (r'^admin/compilation/evaluation/add/$', EvaluationWizard([EvaluationForm1, EvaluationForm2])), It works, but the admin "session" is not kept. I can access the pag...

redirecting to a page

I am facing a problem .I want to give a link in my change form that will redirect to a page which may be simple php page also or any page ,in that page i want to perform some db queries and display them.I also wan to pass id on click.Is it posssible. in my view.py i wrote: from django.shortcuts import render_to_response from django....

Django static page?

I want to make a static page which will be shown to the user only if he/she clicks on a link provided in one of my models. I can do this by making a Python page alone and calling it, but I want it be called from Django. The user interface should constructed using the Django API only. Any suggestions? ...

Is it worth it using the built-in Django admin for a decent sized project?

I haven't been using Django too long, but I'm about to start a pretty hefty-sized project. I'm always nervous using fairly new frameworks (new to me) on large projects because I've been burned before. However, I'm pretty confident in Django...this will finally be the project that makes me leap from my home-grown PHP framework to a popula...

Dropdown sorting in django-admin

I'd like to know how can I sort values in the Django admin dropdowns. For example, I have a model called Article with a foreign key pointing to the Users model, smth like: class Article(models.Model): title = models.CharField(_('Title'), max_length=200) slug = models.SlugField(_('Slug'), unique_for_date='pub...

Show related inlines in the admin on form of model with GenericForeignKey.

I have simple models with generic relations from this example at the Django Project: class Image(models.Model): image = models.ImageField(upload_to="images") class ImageLink(models.Model): image = models.ForeignKey(Image) content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content...

Django admin custom javascript load order

I am using jquery to add a few features onto some fields in the django admin, inlcuding my code by using something like the following: class SomeAdmin(admin.ModelAdmin): class Media: js = ( "/static/js/lib/jquery-1.3.2.min.js", "/static/js/admin/app/model.js" ) ... .. . ...

Djang-admin : How to display link to object info page instead of edit form , in records change list ?

I am customizing Django-admin for an application am working on . so far the customization is working file , added some views . but I am wondering how to change the records link in change_list display to display an info page instead of change form ?! in this blog post :http://www.theotherblog.com/Articles/2009/06/02/ extending-the-django...

unique value field based on another field in django

Preface: I am new to django and to db design. SUPEREDIT: I made some significant changes, so the answers before my changes may reference things not here. I apologize. I'll get right to the code: models.py: class Player(models.Model): name = models.CharField() class Team(models.Model): name = models.CharField() members = m...

django users and groups - show group membership in admin?

The django admin's User management gives us easy access to setting a User's group allegiances via the list for picking the Groups. This is the ManyToMany relationship default widget for assignment. And for the most part that's nice for User creation from the get go. However, say I have a huge number of users and groups...I'd like the ...