Ok, now I've other problem, and it is that in the HTML the *Select* doesn't
changes the value selected (it is always the first one, *"-"*). Any
particullary reason for it?
El domingo, 9 de agosto de 2015, 18:51:30 (UTC+2), durir...@gmail.com
escribió:
>
> Have you created some in that
>
> Have you created some in that test?
Now I realized I forget to add a *setUp* function with the DB rows...
.__.
It doesn't matter how many time I pass coding, always the same fails.
Thanks both.
El domingo, 9 de agosto
On Saturday, 8 August 2015 12:58:59 UTC+1, durir...@gmail.com wrote:
>
> I searched in the web for some example of setting a FK in a ModelForm
> (bound and unbound), but the examples I founded didn't worked for me. The
> best thing I think I've is this:
>
> *forms.py*
>
>
>
>
>
>
>
>
> *class
I get the same, an empty select.
El sábado, 8 de agosto de 2015, 22:49:19 (UTC+2), James Schneider escribió:
>
> Try removing the .values_list() portion of the query set in your
> ModelForm. You should be passing a query set, not a list of values. The
> form knows how to iterate through the
Try removing the .values_list() portion of the query set in your ModelForm.
You should be passing a query set, not a list of values. The form knows how
to iterate through the query set.
-James
On Aug 8, 2015 4:59 AM, wrote:
> I searched in the web for some example of
I searched in the web for some example of setting a FK in a ModelForm
(bound and unbound), but the examples I founded didn't worked for me. The
best thing I think I've is this:
*forms.py*
*class RegistroComentarioForm(ModelForm):def __init__(self, *args,
**kwargs):
Ahhh... That sounds good. Too easy, in fact. I can't wait to give it a
try!
Thanks!
On Monday, July 28, 2014 11:17:16 AM UTC-7, Daniel Roseman wrote:
>
> On Monday, 28 July 2014 15:46:11 UTC+1, Tom Evans wrote:
>>
>>
>>
>> You can use kwargs, but it is much cleaner and less typing to use
On Monday, 28 July 2014 15:46:11 UTC+1, Tom Evans wrote:
>
>
>
> You can use kwargs, but it is much cleaner and less typing to use
> Model.objects.create() as you can omit the subsequent save() as
> create() creates valid objects (they have pks).
>
>
You're right as far as that goes, but note
, and I can't find anything that addresses
> this. Using Python 2.7 and Django 1.6.5, in a ModelForm containing a foreign
> key, rather than returning the key value itself the form returns an object
> that represents the __unicode__(self) value of the model. So it isn't an
>
containing a foreign key, rather than returning the key value itself the
form returns an object that represents the __unicode__(self) value of the
model. So it isn't an integer of a string, and I get a TypeError when I
try to save it.
class Pad_info(models.Model):
site_id = models.IntegerField
10 matches
Mail list logo