Add phone number field to profiles and establishments
This commit is contained in:
parent
0a16b8ed7d
commit
c5604bd255
3 changed files with 11 additions and 3 deletions
|
@ -5,6 +5,7 @@ from django.contrib.auth import get_user_model
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from django_countries.fields import CountryField
|
from django_countries.fields import CountryField
|
||||||
|
from phonenumber_field.modelfields import PhoneNumberField
|
||||||
|
|
||||||
from .helpers import profile_to_coords, upload_path
|
from .helpers import profile_to_coords, upload_path
|
||||||
|
|
||||||
|
@ -95,7 +96,13 @@ class ImageMixin(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
class Profile(AddressMixin):
|
class PhoneMixin(models.Model):
|
||||||
|
phone = PhoneNumberField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
|
class Profile(AddressMixin, PhoneMixin):
|
||||||
user = models.OneToOneField(User, models.CASCADE)
|
user = models.OneToOneField(User, models.CASCADE)
|
||||||
company = models.CharField(max_length=64, null=True, blank=True)
|
company = models.CharField(max_length=64, null=True, blank=True)
|
||||||
vat_id = models.CharField(max_length=32, null=True, blank=True)
|
vat_id = models.CharField(max_length=32, null=True, blank=True)
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
from django.contrib.gis.db import models
|
from django.contrib.gis.db import models
|
||||||
|
|
||||||
from localauth.models import User, Profile, LocationMixin, ImageMixin
|
from localauth.models import User, Profile, LocationMixin, ImageMixin, PhoneMixin
|
||||||
|
|
||||||
from django_countries.fields import CountryField
|
from django_countries.fields import CountryField
|
||||||
|
|
||||||
class PartnerProfile(Profile):
|
class PartnerProfile(Profile):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class Establishment(LocationMixin, ImageMixin):
|
class Establishment(LocationMixin, ImageMixin, PhoneMixin):
|
||||||
owner = models.ForeignKey(PartnerProfile, models.CASCADE)
|
owner = models.ForeignKey(PartnerProfile, models.CASCADE)
|
||||||
name = models.CharField(max_length=64)
|
name = models.CharField(max_length=64)
|
||||||
stars = models.IntegerField(null=True, blank=True)
|
stars = models.IntegerField(null=True, blank=True)
|
||||||
|
|
|
@ -14,6 +14,7 @@ INSTALLED_APPS = [
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
|
'phonenumber_field',
|
||||||
'localauth',
|
'localauth',
|
||||||
'public',
|
'public',
|
||||||
'partners',
|
'partners',
|
||||||
|
|
Loading…
Reference in a new issue