django-admin

My apps not visible when using custom AdminSite

Hello. I'd have a problem with custom AdminSite - my apps are not visible at the admin index and not accessible if i type appropriate URL to view their models. My problem is very similar to this: http://groups.google.com/group/django-users/browse_thread/thread/881feb7eef80853a but it's kind of reverse problem - the bundled models are vis...

'datetime.date' object has no attribute 'date'

This code: import datetime d_tomorrow = datetime.date.today() + datetime.timedelta(days=1) class Model(models.Model): ... timeout = models.DateTimeField(null=True, blank=True, default=d_tomorrow) ... resuls in this error: 'datetime.date' object has no attribute 'date' What am I doing wrong? ...

easy question about managing static content in django

Hi, I have a simple website in django where the content is static. Where i use templates like "AboutUs.html" ,"OurServices.html" or "contact.html".. now i want to use the django admin so anyone could change the content for those pages using a WYSIWYG editor (cause the people who will change this dont know html).. i wanted to create a cl...

Nested inlines in the Django admin?

Alright, I have a fairly simple design. class Update(models.Model): pub_date = models.DateField() title = models.CharField(max_length=512) class Post(models.Model): update = models.ForeignKey(Update) body = models.TextField() order = models.PositiveIntegerField(blank=True) class Media(models.Model): post = mode...

Django, error with custom admin commands when executing with absolute path

I have a custom admin command named temperature.py which is under /home/user/project/monitor/management/commands. If I change directory to /home/user/ and execute: user@localhost:~/project$ ./manage.py temperature It runs ok, and its listed in the available commands. But if I try running it with the absolute path: user@localhost:/$ /...

Django admin - How can I add the green plus sign for Many-to-many Field in custom admin form

The green plus sign button for adding new instances in the admin form disappears for my MultiSelect field (photos) when I define it in my form. Ie, removing the line with the definition (photos = ...) makes the plus sign appear. However, in order to use a custom Field/Widget I need to figure this out. class GalleryForm(ModelForm): ...

In Django, how do I mimic the two-step method of adding users through the admin for my own models?

I have a model where I would like to make a custom admin change_form mimicking the behavior of the Add User functionality of the stock Django Admin Interface. That is, I want a two-step action where the user will first input only a device-id and then be taken to a page where he can enter information on the device. Similar to how you firs...

django tiny mce is normal text field instead of rich text formatting? a fix please. Settings included.

I installed Django tiny mce however i am getting a normal text area in my admin. Can anyone help me to correct this to a rich text area where i can acces text formating? here are my settings.py import os PROJECT_DIR = os.path.dirname(__file__) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', '[email protected]...

Django admin - Autoselect field with javascript

class Zipcode(models.Model): city = models.CharField(max_length=100) zipcode = models.CharField(max_length=6) class Meta: ordering = ('zipcode',) verbose_name = 'Zipcode' verbose_name_plural = 'Zipcodes' def __unicode__(self): return self.zipcode + ' ' +self.city class Area(models.Model)...

How to show a message to a django admin after saving a model?

I want to display a message to admins after they save a particular model, something like "Now enable the series". I can see how I'd do this if it were a list action (message_user) but I can't see how to do this from the main CRUD form. Does anyone know how? Thanks ...

Password field in Django model

I'm trying to create a model where I can store usernames and passwords for other applications. How can I set a password field in Django so that it is not in plain text in admin? Thanks in advance. ...

UnicodeEncodeError: 'ascii' codec can't encode character

When uploading files with non-ASCII characters I get UnicodeEncodeError: Exception Type: UnicodeEncodeError at /admin/studio/newsitem/add/ Exception Value: 'ascii' codec can't encode character u'\xf8' in position 78: ordinal not in range(128) See full stack trace. I run Django 1.2 with MySQL and nginx and FastCGI. This is a problem...

Django. You don't have permission to edit anything.

I created a little app a while ago. I created admin.py and used admin.site.register(MenuEntry) to add the class to admin console. It showed the items of that class just fine. Then I began working on another app and created everything as before. But now it says: You don't have permission to edit anything. I compared files from that and f...

accessing various schemas in Django admin interface?

I am using mysql database. I have many schemas with many tables. I want to create a Django admin interface for various tables in different schemas. Currently for a single schema I am using a setting like this: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'schema1', ...

Adding model-wide help text to a django model's admin form

In my django app, I would like to be able to add customized help text to the admin change form for some of my models. Note I'm not talking about the field specific help_text attribute that I can set on individual fields. For example, at the top of the change form for My_Model in My_App I'd like to be able to add some HTML that says "Fo...

django ManyToManyField show slug as label

Hi guys, i have a "rare" behavior here, i this model: models.py class Area(models.Model): area = models.CharField(max_length=150,unique=True) slug = models.SlugField(max_length=200) fecha = models.DateTimeField(default=datetime.date.today,editable=False) activa = models.BooleanField(default=True) class Empresa(models.M...

Django admin search_fields with model property

I'm trying to use a property in my model as a field in django admin (1.2). Here's an example of my code: class Case(models.Model): reference = models.CharField(_(u'Reference'), max_length=70) client_read = models.BooleanField(default=0) def __unicode__(self): return self.case_id @property def case_id(self)...

Issue with Django admin registering an inline user profile admin

I'm currently working on a django project. I'm attempting to add a UserProfile model inline to my User model. In my models.py I have: class UserProfile(models.Model): ''' Extension to the User model in django admin. ''' user = models.ForeignKey(User) site_role = models.CharField(max_length=128, choices=SITE_ROLE) ...

Is there a ready-to-use form to display lists of objects in the django forms api?

Is there a form(or any other solution) that allows me to quickly build forms that display lists of models(with filtering, ordering etc) like the django admin site does? ...

Django How to show user's name in his profile in admin console

I attached a UserProfile class to User this way: class UserProfile(models.Model): url = models.URLField() home_address = models.TextField() user = models.ForeignKey(User, unique=True) I have also implemented auto-creating of UserProfile if needed this way: def user_post_save(sender, instance, signal, *args, **kwargs): ...