Source

beerfingers / bf / bouncer / models.py

Full commit
#BOUNCER model
from django.db import models
from django.db.models.signals import pre_save
from django.contrib.auth.models import User
from django.contrib.localflavor.us.models import PhoneNumberField


class UserProfile(models.Model):
	user = models.ForeignKey(User, unique=True)
	#need to build a authorization process for CELL PHONES
	cell1 = PhoneNumberField(blank=True, null=True, verbose_name='US Mobile Number')	
	#cell2 = PhoneNumberField(blank=True, null=True)
	location = models.CharField(max_length=450, blank=True, null=True)
	newsletter = models.BooleanField()
	public_profile = models.BooleanField()
	#Twitter
	oauth_token = models.CharField(max_length=200,blank=True)
	oauth_secret = models.CharField(max_length=200,blank=True)

	
	#Does not fire, POST immutable
	#def pre_save(sender, instance):
	#	if not POST['cell1'][:1] == '1':
	#		POST['cell1'] =  '1' + POST['cell1']
	

	@models.permalink
	def get_absolute_url(self):
		return ('profiles_profile_detail', (), { 'username': self.user.username })
	get_absolute_url = models.permalink(get_absolute_url)
	
	#def get_absolute_url(self):
	#	return "/profile/"
	
	def __unicode__(self):
		return self.cell1