Created
September 14, 2015 13:17
-
-
Save filipgorczynski/90f46ac7c2492e4adbac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
forms.py | |
# -*- coding: utf-8 -*- | |
from django import forms | |
from volontulo.models import UserProfile | |
class RegistrationForm(forms.ModelForm): | |
email = forms.CharField(max_length=254) | |
password = forms.CharField(widget=forms.PasswordInput()) | |
class Meta: | |
model = UserProfile | |
fields = ['email', 'password'] | |
models.py | |
from django.contrib.auth.models import User | |
from django.db import models | |
class UserProfile(models.Model): | |
user = models.OneToOneField(User) | |
def save(self): | |
super(UserProfile, self).save() | |
# self.user.username = self.user.email | |
def __str__(self): | |
return self.email |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment