7 and python 2.7. i want to add extra field in django registration. i try to extend with my model like this:
class Seller(models.Model):
user = models.ForeignKey(User, unique=True)
name = models.CharField(max_length=25)
phone_number = models.BigIntegerField()
email = models.EmailField(max_length=75)
def __str__(self):
return self.name;
and i add form.py like this
from django import forms
from registration.forms import RegistrationForm
from django.forms import ModelForm
from django.contrib.auth.models import User
from kerajinan.models import Product, Category, Seller
class SellerForm(forms.ModelsForm):
class Meta:
model = Seller
fields = ('name','phone_number','email')
and modify url.py like this:
url(r'^accounts/', 'registration.views.register',{'form_class':SellerForm,'backend': 'registration.backends.default.DefaultBackend'})
how to use those model with django registration and i get error syntax with my ulr.py?
thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…