Skip to content

Instantly share code, notes, and snippets.

@filipgorczynski
Created September 14, 2015 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filipgorczynski/90f46ac7c2492e4adbac to your computer and use it in GitHub Desktop.
Save filipgorczynski/90f46ac7c2492e4adbac to your computer and use it in GitHub Desktop.
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