Re: Django don't save a form using Floppyforms on a foreign key field

2020-12-05 Thread Walter Randazzo
Hi dudes, Here is an update on this: Workarround: I removed floppyforms on my Project and use Select2 instead because it supports searches on foreignkey field and also create an instance with a form easily. Template $(document).ready(function() { $('#id_medicamento').select2(); }); forms.py

Re: Pulling a user to save a form

2010-02-07 Thread Daniel Roseman
On Feb 6, 10:11 pm, kamilski81 wrote: > No I am not, once the user is logged in I just want to pull the user > from there...sort of like this > >   if request.method == 'POST': >         instance = request.user >         goal = Goal(user=instance) >         form = GoalForm(request.POST, goal) >  

Re: Pulling a user to save a form

2010-02-06 Thread kamilski81
No I am not, once the user is logged in I just want to pull the user from there...sort of like this if request.method == 'POST': instance = request.user goal = Goal(user=instance) form = GoalForm(request.POST, goal) if form.is_valid(): form.save()

Re: Pulling a user to save a form

2010-02-06 Thread Daniel Roseman
On Feb 6, 7:00 pm, kamilski81 wrote: > Basically I am doing the following: > >   u=User.objects.get(username="kamilski81") >   goal = Goal(user=u) >   form = GoalForm(request.POST, goal) > > and get this error: > > (1048, "Column 'user_id' cannot be null") > > FROM THE front-end... > > Kamil Are

Re: Pulling a user to save a form

2010-02-06 Thread kamilski81
pm, Dylan Evans wrote: > user = User.objects.get(username__exact='bob') > Works fine for me, you may want to try get since it will throw an exception > if there is no matching user. Then you know the problem is elsewhere. > > > > On Sat, Feb 6, 2010 at 11:30 AM, kamilski81

Re: Pulling a user to save a form

2010-02-06 Thread kamilski81
, you may want to try get since it will throw an exception > if there is no matching user. Then you know the problem is elsewhere. > > > > On Sat, Feb 6, 2010 at 11:30 AM, kamilski81 wrote: > > I would like to save a form by doing the following: > > > #Goal has

Re: Pulling a user to save a form

2010-02-05 Thread Dylan Evans
user = User.objects.get(username__exact='bob') Works fine for me, you may want to try get since it will throw an exception if there is no matching user. Then you know the problem is elsewhere. On Sat, Feb 6, 2010 at 11:30 AM, kamilski81 wrote: > I would like to save a form

Pulling a user to save a form

2010-02-05 Thread kamilski81
I would like to save a form by doing the following: #Goal has a User ForeignKey (django.contrib.auth.models.User) - class GoalForm(ModelForm): class Meta: model = Goal --- class Goal(models.Model): user = models.ForeignKey(User, editable=False) -- view.py

Re: save a form

2009-08-20 Thread luca72
Thanks for you reply. But i have this problem i need to check a value from a field before the validation of the form. How i can do this. Sorry for my stupid question but i'm very newbie On 19 Ago, 19:44, Alex Gaynor wrote: > On Wed, Aug 19, 2009 at 11:22 AM,luca72 wrote: > > > how i can get the

Re: save a form

2009-08-19 Thread Alex Gaynor
On Wed, Aug 19, 2009 at 11:22 AM, luca72 wrote: > > how i can get the value of the fields? > > On 19 Ago, 17:45, Daniel Roseman wrote: >> On Aug 19, 3:40 pm, luca72 wrote: >> >> > Iis but form.save don't work >> >> That's true. >> -- >> DR. > > > On a validated form the values will be in the di

Re: save a form

2009-08-19 Thread luca72
how i can get the value of the fields? On 19 Ago, 17:45, Daniel Roseman wrote: > On Aug 19, 3:40 pm, luca72 wrote: > > > Iis but form.save don't work > > That's true. > -- > DR. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

Re: save a form

2009-08-19 Thread Daniel Roseman
On Aug 19, 3:40 pm, luca72 wrote: > Iis but form.save don't work > That's true. -- DR. --~--~-~--~~~---~--~~ 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@googlegr

Re: save a form

2009-08-19 Thread luca72
Iis but form.save don't work On 19 Ago, 16:23, Daniel Roseman wrote: > On Aug 19, 3:21 pm, luca72 wrote: > > > Hello i have a POST form (not modelform) how i can save the data in > > the db, and if i need to change the data before the save how i can do? > > > Thanks > > If it's not a modelform,

Re: save a form

2009-08-19 Thread Daniel Roseman
On Aug 19, 3:21 pm, luca72 wrote: > Hello i have a POST form (not modelform) how i can save the data in > the db, and if i need to change the data before the save how i can do? > > Thanks If it's not a modelform, what does it mean to save it in the database? It's not associated with any model, b

save a form

2009-08-19 Thread luca72
Hello i have a POST form (not modelform) how i can save the data in the db, and if i need to change the data before the save how i can do? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.