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: Different between Object-save and form-save

2015-03-18 Thread Peter of the Norse
data. > if request.method == 'POST': > # Attempt to grab information from the raw form information. > # Note that we make use of both UserForm and UserProfileForm. > user_form = UserForm(data=request.POST) > profile_form = UserProfileForm(data=re

Re: Different between Object-save and form-save

2015-03-01 Thread Babatunde Akinyanmi
gt;> registered = False >>> >>> # If it's a HTTP POST, we're interested in processing form data. >>> if request.method == 'POST': >>> # Attempt to grab information from the raw form information. >>> # Note that we make use

Re: Different between Object-save and form-save

2015-03-01 Thread ADEWALE ADISA
ttempt to grab information from the raw form information. >> # Note that we make use of both UserForm and UserProfileForm. >> user_form = UserForm(data=request.POST) >> profile_form = UserProfileForm(data=request.POST) >> >> # If the two forms ar

Re: Different between Object-save and form-save

2015-03-01 Thread Vijay Khemlani
> # Note that we make use of both UserForm and UserProfileForm. > user_form = UserForm(data=request.POST) > profile_form = UserProfileForm(data=request.POST) > > # If the two forms are valid... > if user_form.is_valid() and profile_form.i

Different between Object-save and form-save

2015-03-01 Thread ADEWALE ADISA
forms are valid... if user_form.is_valid() and profile_form.is_valid(): # Save the user's form data to the database. user = user_form.save() # Now we hash the password with the set_password method. # Once hashed, we can update the user object

Re: Pulling a user to save a form

2010-02-07 Thread Daniel Roseman
e null") > > Thanks for the quick responses so far. If the user field is not in request.POST, it will be set to None on form save. The easiest thing to do is this: goal = form.save() goal.user = user goal.save() -- DR. -- You received this message because you are subscribed to t

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

Re: Pulling a user to save a form

2010-02-06 Thread kamilski81
<kamilsk...@gmail.com> wrote: > > 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 > &

Re: Pulling a user to save a form

2010-02-06 Thread kamilski81
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 <kamilsk...@gmail.com> wrote: > > I would like to save a form by doin

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 <kamilsk...@gmail.com> wrote: > I would like to sa

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

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. >>

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

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

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

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

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.