extending django usermodel

Posted by imran-glt on Stack Overflow See other posts from Stack Overflow or by imran-glt
Published on 2010-06-05T21:22:11Z Indexed on 2010/06/05 21:42 UTC
Read the original article Hit count: 411

Filed under:
|
|

Hi i am trying to create a signup form for my django app. for this i have extended the user model. This is my Forms.py

from contact.models import register
from django import forms
from django.contrib import auth
class registerForm(forms.ModelForm):

class Meta:
model=register
    fields = ('latitude', 'longitude', 'status')
class Meta:
    model = auth.models.User # this gives me the User fields
    fields = ('username', 'first_name', 'last_name', 'email')

and this is my model.py

from django.db import models
from django.contrib.auth.models import User
STATUS_CHOICES = (
('Online', 'Online.'),
('Busy', 'Busy.'),
('AppearOffline', 'AppearOffline.'),)
 class register(models.Model): 

    user = models.ForeignKey('auth.User', unique = True) 
    latitude = models.DecimalField(max_digits=8, decimal_places=6)
    longitude = models.DecimalField(max_digits=8, decimal_places=6)
status = models.CharField(max_length=8,choices=STATUS_CHOICES, blank= True, null=True)

i dont know where i am making a mistake. the users passwords are not accepted at the login and the latitude and logitude are not saved against the created user user. i am fiarly new to django and dont know what to do any body have any solution .?

© Stack Overflow or respective owner

Related posts about django

Related posts about model