Changes between Initial Version and Version 1 of Ticket #8795


Ignore:
Timestamp:
Sep 2, 2008, 7:16:37 AM (16 years ago)
Author:
Marc Fargas
Comment:

Rewrote Description to hightlight code and not mess with it.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #8795 – Description

    initial v1  
    33when you have model like this:
    44
     5{{{
     6#!python
    57class FunkcjeProdukt(models.Model):
    68    funkcja = models.ForeignKey(FunkcjeRodzina)
     
    911    class Meta:
    1012        unique_together = ("produkt", "funkcja")
    11 
     13}}}
    1214
    1315and form from model:
     16{{{
     17#!python
    1418class FunkcjeProduktForm(ModelForm):
    1519    wartosc = forms.CharField(widget=forms.TextInput(attrs={'size':'40','class':'formularz'}))
     
    1721        model = FunkcjeProdukt
    1822        exclude=('produkt','funkcja')
     23}}}
     24end if you want only edit "wartosc" from existing instance:
    1925
    20 end if you want only edit "wartosc" from existing instance:
     26{{{
     27#!python
    2128form_fp = FunkcjeProduktForm(data=request.POST,instance=finst)
    2229if form_fp.is_valid():
    2330       form_fp.save()
     31}}}
    2432
    2533error is throw:
    2634
    27 KeyError at /cms/r_produkt/8/
    28 'produkt'Request Method:    POST
     35{{{
     36#!python
     37KeyError at /cms/r_produkt/8/'produkt'
     38Request Method:    POST
    2939Request URL:    http://posiflex.com.pl/cms/r_produkt/8/
    3040Exception Type:    KeyError
    3141Exception Value:    'produkt'
    3242Exception Location:    /home/posiflex/django/forms/models.py in validate_unique, line 238
     43}}}
    3344
    3445because:
Back to Top