I'm trying to extend the basic user registration form and profile included in satchmo store, but I'm in problems with that.
This what I've done:
Create a new app "extendedprofile"
Wrote a models.py that extends the satchmo_store.contact.models class and add the custom name fields.
wrote an admin.py that unregister the Contact class and register my newapp but this still showing me the default user profile form.
Maybe some one can show me the correct way to do this?
It sounds like you are doing it right, but it would help if you post your source. When I take this route, I treat the extended profile as an inline to the user model:
class UserProfileInline(admin.StackedInline):
model = UserProfile
fk_name = 'user'
max_num = 1
fieldsets = [
('User Information', {'fields': ['street', 'street2', 'city', 'state', 'country', 'latitude', 'longitude']}),
('Site Information', {'fields': ['sites']}),
('User Account', {'fields': ['account_balance']}),
]
class NewUserAdmin(admin.ModelAdmin):
inlines = [UserProfileInline, ]
admin.site.unregister(User)
admin.site.register(User, NewUserAdmin)
Hopefully that helps you.
Wrote a models.py that extends the satchmo_store.contact.models class and add the custom name fields.
wrote an admin.py that unregister the Contact class and register my newapp but this still showing me the default user profile form.
This is related to overriding the django registration User class; the satchmo project creates a foreign key to the User class (as of 0.9.2). But what you want to do is create an extended profile class with new fields.
So, in this specific case you're going to need to do a few things to override the profile template that shows the Contact information:
satchmo_store.contact.views
but use your own class instead of the Contact class)satchmo_store.contact.forms.ExtendedContactInfoForm
form class with entries for your editable form fields.contact/view_profile.html
template to include the custom name fields.Then you may want to unregister the Contact class as above, admin.site.unregister(Contact)
, and only admini your new subclass.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With