Permalink
Browse files

Model tweaks

  • Loading branch information...
1 parent fc02ba2 commit 47673cb48b01ace099e2d436f77c5a944acc48c6 @amites committed Feb 26, 2012
Showing with 15 additions and 13 deletions.
  1. +14 −7 general/models/contact.py
  2. +1 −6 general/models/location.py
View
@@ -1,7 +1,7 @@
from django.contrib.localflavor.us.models import PhoneNumberField
from django.db import models
-from general.models import DefaultModel
+#from general.models import DefaultModel
from general.models.choices_privacy import PRIVACY_LEVEL
PHONE_TYPES = (
@@ -11,17 +11,24 @@
('voip', 'VOIP'),
)
-class Phone(DefaultModel):
- number = PhoneNumberField()
- type = models.CharField(max_length=10, choices=PHONE_TYPES, default='home')
+
+class Contact(models.Model):
+ first_name = models.CharField(max_length=200, null=True, blank=True)
+ last_name = models.CharField(max_length=200, null=True, blank=True)
+
+ class Meta:
+ abstract = True
+
+class Phone(models.Model):
+ number = PhoneNumberField(null=True, blank=True)
+ type = models.CharField(max_length=10, choices=PHONE_TYPES, default='home', null=True, blank=True)
privacy = models.IntegerField(max_length=5, choices=PRIVACY_LEVEL, default=20, blank=True, null=True)
class Meta:
abstract = True
-
-class Email(DefaultModel):
- address = models.CharField(max_length=250)
+class Email(models.Model):
+ address = models.EmailField(max_length=250, null=True, blank=True)
privacy = models.IntegerField(max_length=5, choices=PRIVACY_LEVEL, default=30, blank=True, null=True)
class Meta:
@@ -6,11 +6,6 @@
from general.models.choices_location import COUNTRY_CHOICES
class AddressStreet(models.Model):
- #DefaultModel
- created = models.DateTimeField(auto_now_add=True)
- modified = models.DateTimeField(auto_now=True)
- objects = models.Manager()
-
street = models.CharField(max_length=250, null=True, blank=True)
city = models.CharField(max_length=250, null=True, blank=True)
state = models.CharField(max_length=2, null=True, blank=True, choices=US_STATES)
@@ -28,7 +23,7 @@ def __unicode__(self):
class AddressExtended(AddressStreet):
latitude = models.CharField(max_length=50, null=True, blank=True, verbose_name='Latitude')
longitude = models.CharField(max_length=50, null=True, blank=True, verbose_name='Longitude')
- geolocation = models.CharField(max_length=100, blank=True)
+ geolocation = models.CharField(max_length=100, null=True, blank=True)
class Meta:
abstract = True

0 comments on commit 47673cb

Please sign in to comment.