Hi,

i have following Models:

##############################
class speiseplan(models.Model):
    kalenderwoche =
models.PositiveSmallIntegerField(blank=True,null=True)
    start = models.DateField()
    end = models.DateField(blank=True,null=True)
    veroeffentlicht = models.BooleanField(default=False)

class artikel(models.Model):
    artikel = models.CharField(max_length=30)
    aktiv = models.BooleanField(default=False)

class speiseplan_artikel(models.Model):
    speiseplan = models.ForeignKey("speiseplan")
    datum = models.DateField()
    speise =
models.ManyToManyField(artikel,limit_choices_to={'ist_menu':
True,},null=True,blank=True)
########################

and i have a ModelForm

########################
class SpeiseplanWochenForm(ModelForm):
    from django.forms.widgets import DateInput
    datum = forms.DateField(input_formats=('%d.%m.
%Y',),widget=DateInput(format='%d.%m.%Y',attrs={'readonly':True}))
    class Meta:
        model = speiseplan_artikel
        fields = ('datum','speise',)
########################

Django creates an other Table in the Database:

CREATE TABLE "speiseplan_artikel_speise" (
    "id" integer NOT NULL PRIMARY KEY,
    "speiseplan_artikel_id" integer NOT NULL,
    "artikel_id" integer NOT NULL REFERENCES "artikel" ("id"),
    UNIQUE ("speiseplan_artikel_id", "artikel_id")
);

This are the Relations between my "Artikel" and my "speiseplan". How
do i get this id from the "speiseplan_artikel_speise"? I need this in
the Templates.

I hope someone can help.

Regards,
Manuel

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.

Reply via email to