Changes between Initial Version and Version 1 of Ticket #8795
- Timestamp:
- Sep 2, 2008, 7:16:37 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #8795 – Description
initial v1 3 3 when you have model like this: 4 4 5 {{{ 6 #!python 5 7 class FunkcjeProdukt(models.Model): 6 8 funkcja = models.ForeignKey(FunkcjeRodzina) … … 9 11 class Meta: 10 12 unique_together = ("produkt", "funkcja") 11 13 }}} 12 14 13 15 and form from model: 16 {{{ 17 #!python 14 18 class FunkcjeProduktForm(ModelForm): 15 19 wartosc = forms.CharField(widget=forms.TextInput(attrs={'size':'40','class':'formularz'})) … … 17 21 model = FunkcjeProdukt 18 22 exclude=('produkt','funkcja') 23 }}} 24 end if you want only edit "wartosc" from existing instance: 19 25 20 end if you want only edit "wartosc" from existing instance: 26 {{{ 27 #!python 21 28 form_fp = FunkcjeProduktForm(data=request.POST,instance=finst) 22 29 if form_fp.is_valid(): 23 30 form_fp.save() 31 }}} 24 32 25 33 error is throw: 26 34 27 KeyError at /cms/r_produkt/8/ 28 'produkt'Request Method: POST 35 {{{ 36 #!python 37 KeyError at /cms/r_produkt/8/'produkt' 38 Request Method: POST 29 39 Request URL: http://posiflex.com.pl/cms/r_produkt/8/ 30 40 Exception Type: KeyError 31 41 Exception Value: 'produkt' 32 42 Exception Location: /home/posiflex/django/forms/models.py in validate_unique, line 238 43 }}} 33 44 34 45 because: