Which version of Django are you using? edit_inline is deprecated (or
even removed) in Django 1.0. You should be using admin inlines instead.
Erik
On 28.10.2008, at 12:47, Daniel Austria wrote:
>
> Hello,
>
> i got a huge problem. I have got an Idea class and an ideacomment
> class. You can guess what these classes are used for. What i do is the
> following:
>
> - the ideacomment class has an foreignkey
> - this foreignkey is marked as edit_inline
> - when i edit an idea instance in the admin i can also add some
> comments in the same html page
> - BUT: the comments are not saved .... ??????
>
> Strange... what should i try / debugg or look at .....
>
>
> Dan
>
> ps. i did not write any views or else... the code below is the whole
> code i have ....
>
> -------------- CODE-------------------------
>
> from django.db import models
> from base.models import Participant
> from settings import MEDIA_DIR, BASE_DIR
>
>
> STATUS_CHOICES = ((1, 'IN_DISCUSSION'), (2, 'ACCEPTED'), (3,
> 'DONT_KNOW'))
>
>
> class Category(models.Model):
> Name = models.CharField('Category Name', maxlength=50, core=True)
> LastModified = models.DateTimeField('Last Modified', core=True,
> auto_now = True)
>
> def __unicode__(self):
> return self.Name
> def __str__(self):
> return self.__unicode__()
>
> class Admin:
> list_display = ('Name', 'LastModified')
> search_fields = ['Name']
> ordering = ['-LastModified']
>
> class Meta:
> ordering = ['id']
>
>
> class IdeaProject(models.Model):
> Name = models.CharField('Ideation-Project name', maxlength=50,
> core=True)
> UrlLocation = models.CharField('URL location', maxlength=20,
> core=True, unique=True)
> Active = models.BooleanField('Project active')
> Version = models.TextField('A short description', blank=True)
> Categories = models.ManyToManyField(Category,
> related_name='Category', null=True)
> Template = models.CharField('Template directory', maxlength=50,
> core=True, default='ideation')
> DefaultLang = models.CharField('Default language', maxlength=2,
> core=True, default='en')
> LastModified = models.DateTimeField('Last Modified', core=True,
> auto_now = True)
>
> def __unicode__(self):
> return self.Name
> def __str__(self):
> return self.__unicode__()
>
> class Admin:
> list_display = ('Name', 'Active', 'UrlLocation',
> 'LastModified', 'Version')
> search_fields = ['Name']
> ordering = ['-LastModified']
>
> class Meta:
> ordering = ['id']
>
>
>
> class Idea(models.Model):
> Header = models.CharField('Header', maxlength=500, core=True)
> Text = models.TextField('Description', core=True)
> IsParticipant = models.ForeignKey(Participant, null=True)
> IsIdeaProject = models.ForeignKey(IdeaProject, null=True)
> Categories = models.ManyToManyField(Category,
> related_name='Categories', null=True)
> LastModified = models.DateTimeField('Last Modified', core=True,
> auto_now = True)
> Points = models.IntegerField('Idea points', core=True, default=0)
> Status = models.IntegerField('Idea status',
> choices=STATUS_CHOICES, default=1)
> UrlToPic = models.CharField('Url path 2 picture', maxlength=50,
> blank=True, null=True)
>
> def __unicode__(self):
> return self.Header
> def __str__(self):
> return self.__unicode__()
>
> class Admin:
> list_display = ('Header', 'LastModified', 'IsParticipant')
> search_fields = ['Name']
> ordering = ['-LastModified']
>
> class Meta:
> ordering = ['id']
>
>
> class IdeaComment(models.Model):
> Header = models.CharField('Header', maxlength=500, core=True)
> Text = models.TextField('Description', core=True)
> IsParticipant = models.ForeignKey(Participant, core=True)
> LastModified = models.DateTimeField('Last Modified', core=True,
> auto_now = True)
> IsIdea = models.ForeignKey(Idea, edit_inline=models.STACKED,
> min_num_in_admin=6, num_extra_on_change=6)
>
> def __unicode__(self):
> return self.Header
> def __str__(self):
> return self.__unicode__()
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---