About my problem: there are items (~100) and their prices. We would like store history of prices and analyse it later.. Every week we going add new prices on this items.
my model: class Item(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=200) ... def __unicode__(self): return self.name class UpdateDay(models.Model): day = models.DateField(primary_key=True, auto_now=False, auto_now_add=True) items = models.ManyToManyField(Item, through='Review') ... def __unicode__(self): return u'%s' % (self.day) class Review(models.Model): id = models.AutoField(primary_key=True) item = models.ForeignKey(Item) day = models.ForeignKey(UpdateDay) price = models.DecimalField(max_digits=7, decimal_places=2) ... def __unicode__(self): return self.price my admin.py: ... class ItemInline(admin.TabularInline): model = Review extra = Item.objects.count() class UpdateDayAdmin(admin.ModelAdmin): ... inlines = [ItemInline] class ItemAdmin(admin.ModelAdmin): ... admin.site.register(UpdateDay, UpdateDayAdmin) admin.site.register(Item, ItemAdmin) This is my current model. And this is my question: what i should modify to add this feature: if we'll try add new UpdateDay, system will auto-generate all Review- Item relationships on edit page? In current app we must create this relationships manually (its take a lot of time)... IMHO i should update my ItemInline class.. How?.. or not?.. Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---