Hi everyone, I'm using 1.0 Final, MySQL 5, and I'm getting this lovely error for the first time. Here is my model:
from django.db import models from django.contrib import admin from crider_law.sidebar_modules.models import SidebarModule class Page(models.Model): name = models.CharField(max_length=100, help_text='This value is for your reference only.') content = models.TextField(blank=True) title = models.CharField(max_length=100, help_text='This value will be appended to "Crider Law |" in the browser window') keywords = models.TextField(help_text='Please separate keywords and/or phrases with a comma.', blank=True) description = models.TextField(help_text='Please enter a description for the page. This value appears in search result listings.', blank=True) topic = models.TextField(help_text='Please enter a topic for this page. This value appears in search result listings.', blank=True) sidebar_modules = models.ManyToManyField(SidebarModule, blank=True) body_class = models.CharField(max_length=50, editable=False) class Meta(): abstract = True class StaticPage(Page): can_have_child_pages = models.BooleanField() slug = models.SlugField(editable=False) def __unicode__(self): return format_name(self.name) class EditablePage(Page): parent_page = models.ForeignKey(StaticPage, help_text='The static page this page should appear under.', limit_choices_to={'can_have_child_pages' : True}) slug = models.SlugField(help_text='This field is suggessted for you, but can be changed.', unique=True) def __unicode__(self): return format_name(self.name) class StaticPageAdmin(admin.ModelAdmin): list_display = ['__unicode__', 'title'] fieldsets = ( ('Fields marked in bold are required', { 'fields' : ('name', 'title',) } ), ('Page Content', { 'fields' : ('content',) } ), ('Sidebar Modules', { 'fields' : ('sidebar_modules',) } ), ('Meta Page Properties (optional, but recommended)', { 'fields' : ('keywords', 'description', 'topic',) } ), ) class Meta: ordering = ['name'] class Media: js = ('/static/upload_media/jquery.js','/static/upload_media/ tiny_mce/tiny_mce.js', '/static/upload_media/model.js') class EditablePageAdmin(admin.ModelAdmin): list_display = ['__unicode__', 'title'] prepopulated_fields = ({ 'slug' : ('title',) }) fieldsets = ( ('Fields marked in bold are required', { 'fields' : ('parent_page', 'name', 'title', 'slug',) } ), ('Page Content', { 'fields' : ('content',) } ), ('Sidebar Modules', { 'fields' : ('sidebar_modules',) } ), ('Meta Page Properties (optional, but recommended)', { 'fields' : ('keywords', 'description', 'topic',) } ), ) class Meta: ordering = ['name'] class Media: js = ('/static/upload_media/jquery.js','/static/upload_media/ tiny_mce/tiny_mce.js', '/static/upload_media/model.js') def save_model(self, request, obj, form, change): obj.body_class = obj.parent_page.body_class obj.save() admin.site.register(EditablePage, EditablePageAdmin) admin.site.register(StaticPage, StaticPageAdmin) def format_name(name): return name[0].upper() + name[1:].replace('_', ' ') I've found a few posts regarding this, but I can't seem to figure out what the duplicate key is. Can anyone see what I'm missing? Many thanks in advance, Brandon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---