django-admin

django.contrib.auth: how to keep site and admin sessions separate?

I'm using a user profile model with a ForeignKey to the User, authenticated by django.contrib.auth. The same auth module is of course used for the admin interface, so if a superuser/staff member is logged in to the admin interface, and enters the main site, the site will accept session cookie and authenticate him. This creates a proble...

excel in django

Hi,How can i make user to downlaoad a excel from the django app.i HAVE A MODEL WHICH gives the report.Now i want a option from user can download the file in excel form.ANy Solution ...

How to manage many to one relationship in Django

Hello, I am trying to make a many to one relationship and want to be able to control it (add -remove etc) via the admin panel. So this is my model.py: from django.db import models class Office(models.Model): name = models.CharField(max_length=30) class Province(models.Model): numberPlate = models.IntegerField(primary_key=True...

django one to many issue at the admin panel

Greetings, I have these 2 models: from django.db import models class Office(models.Model): name = models.CharField(max_length=30) person = models.CharField(max_length=30) phone = models.CharField(max_length=20) fax = models.CharField(max_length=20) address = models.CharField(max_length=100) def __unicode__(self)...

Smarter removing objects with many-to-many relationship in Django admin interface

I'd like to remove some object with many-to-many relationship using Django admin interface. Standard removing also removes all related objects and the list of removed objects displayed on confirmation page. But I don't need to remove related objects! Assume we have ContentTopic and ContentItem: class ContentTopic(models.Model): nam...

How to get the value of a dropdown menu in the admin interface?

Hi, Does anybody know how to get the selected item of a dropdown menu from within a clean method in a modelform object, before the object has been saved? I have tried the following: def clean_something(self): dropdown = self.cleaned_data.get('dropdown') where 'dropdown' is the field representing the dropdown menu, but this doesn't...

Django Admin -> Change Order of Fields, including Inline Fields

Hi I have a "Person" Model which has a one-to-many Relations to other Models, for instance Address. I want to edit these models on the same page as Person, which I can already do via inlines. But I also want to change the order of the fields. I want the (inline) field "Address" to be the third item in the list, but for fields ('first_...

Indefinitely repeating events in django calendar

I am working on a calendar application in django and want to support events which repeat an infinite amount of times after a given start date. I will store "block events" where each block includes data about a certain event (title, description...) as well as the pattern with which it repeats and an "expiration date". This way I only stor...

Overriding a Django admin.ModelAdmin function for all models

I'm sort of stitching together contrib.databrowse (to view) and contrib.admin (to edit), and I'd like to override the *response_change* function in admin.ModelAdmin so that when you click save, it redirects back to the object in databrowse rather than the admin. I know how to do this for a specific model in admin.py, like: class Whateve...

Allowing the " - " character in usernames in the Django Admin interface.

In our webapp we needed to allow dashes "-" in our usernames. I've enabled that for the consumer signup process just fine with this regex r'^[\w-]+$' How can I tell the admin app so that I can edit usernames in auth > users to allows the "-" character in usernames? Currently I am unable to edit any usernames with dashes in them as it...

Customizing Django admin with list_display?

I'm trying to customize the Django Admin. models.py ============= class Question(models.Model): poll = models.ForeignKey(Poll) name = models.CharField(max_length=100) pub_date = models.DateTimeField('date published') admin.py =========== class QuestionAdmin(admin.ModelAdmin): list_display = ('name', 'poll'. 'pub_dat...

Filter ManyToMany box in Django Admin

I have a object with a many-to-many relation with another object. In the Django Admin this results in a very long list in a multiple select box. I'd like to filter the ManyToMany relation so I only fetch Categories that is available in the City that the Customer have selected. Is this possible? Will I have to create a widget for it? An...

Django: models last mod date and mod count

I have a django model called Blog. I'd like to add a field to my current model that is for last_modified_date. I know how to set a default value, but I would like somehow for it to get automatically updated anytime I modify the blog entry via the admin interface. Is there some way to force this value to the current time on each adm...

how to overwrite User model

I don't like models.User, but I like Admin view, and I will keep admin view in my application. How to overwirte models.User ? Make it just look like following: from django.contrib.auth.models import User class ShugeUser(User) username = EmailField(uniqute=True, verbose_name='EMail as your username', ...) email = CharField(...

view only user group for django admin panel

Greetings I am trying to find a way to implement "view only user group" for selected models at the django admin site. In details, when a selected user of a group logs in, he/she can only browse and see allowed model entries. Thanks ...

Django admin , save function and forms

Hi guys, i dont know how ill ask this, im new with Django, but ill try. I have a form in the private user section, well this form save the username logged, a encrypted data from another function, and some more fields. Now my problem is that in the Admin, i need to use "this form" too, but i dont know how render the form in different wa...

Admin, two links to different views ?

Hi guys, in django admin the views that show the register's just have a link to "edit", but what happen if a need an extra(S) links to another views? for example: i have view that show the list of registered People, the nick is linking to the Edit page (the normal way of Django), but i need another links that will show me the "arti...

implementing a simple jquery function to the django admin site

Greetings I have extended my admin add screen (tabularinline) by using the http://www.djangosnippets.org/snippets/1594/ Now I have a field in my model: start = models.CharField(max_length=5) this is intended as a special time format, it will be in a HH:MM format such as 16:30 . Now I want to implement a way that site auto assigns ":"...

Django admin: exclude field on change form only

If there a way to detect if information in a model is being added or changed. If there is can this information be used to exclude fields. Some pseudocode to illustrate what I'm talking about. class SubSectionAdmin(admin.ModelAdmin): if something.change_or_add = 'change': exclude = ('field',) ... Thanks ...

implementing a javascript graph application to the existing admin panel's listing view

Hello I want to implement a javascript graph plot application (ie http://people.iola.dk/olau/flot/examples/turning-series.html) to the existing admin view, where the instances of a model at the listing view also showing charts of these items and can be filtered through by using the already implemented list_filter option which I added at...