Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Filling a form with database model content [RSS Feed]

#1 March 25, 2008 00:47:01

t.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Filling a form with database model content


Hi there,

I've been working on a rather large Django project and I've hit one
roadblock. I've been using django-registration to handle my
registration of users, but I also wanted to have more profile fields,
so I extended the user model.

Here is a paste of my forms.py for my BigfootProfile (This is my
AUTH_PROFILE_MODULE) .. This works great so far, registering it passes
all the data great and all is swell.

However, I now want the ability for the user to be able to edit the
data. I've tried several things to output
RegistrationFormBigfootProfile with pre-filled data from the database
and it did not work

Any suggestions as to what I should do? I do not want to use django-
profiles (It's from the same author as django-registration) because it
has too much things I do not need and I simply want to be able to edit
the fields inline within another page.

Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#2 March 25, 2008 00:56:10

d.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Filling a form with database model content


You need to send initial values to the form when you define the form
in its view.

For example, this call would intialize the form with your data:

form = myform(initial={'company':myprofileinfo.company,
'gender':myprofileinfo.gender,})

where 'company' and 'gender' correspond to the names of your form
fields, and myprofileinfo.company and myprofileinfo.gender correspond
to your instance values.

Dave

On Mar 24, 4:46 pm, truebosko <> wrote:
> Hi there,
>
> I've been working on a rather large Django project and I've hit one
> roadblock. I've been using django-registration to handle my
> registration of users, but I also wanted to have more profile fields,
> so I extended the user model.
>
> Here is a paste of my forms.py for my BigfootProfile (This is my
> AUTH_PROFILE_MODULE) .. This works great so far, registering it passes
> all the data great and all is swell.
>
> However, I now want the ability for the user to be able to edit the
> data. I've tried several things to output
> RegistrationFormBigfootProfile with pre-filled data from the database
> and it did not work
>
> Any suggestions as to what I should do? I do not want to use django-
> profiles (It's from the same author as django-registration) because it
> has too much things I do not need and I simply want to be able to edit
> the fields inline within another page.
>
> Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

  • Root
  • » Django
  • » Filling a form with database model content [RSS Feed]

Board footer

Moderator control

Enjoy the 16th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support