Skip to content
Snippets Groups Projects
Commit 8cf238d4 authored by florimondmanca's avatar florimondmanca
Browse files

remove unused fields on user model

parent 1a7a1ed3
No related branches found
No related tags found
1 merge request!4Release version ready to welcome first users
...@@ -56,22 +56,6 @@ class UserModelTest(ModelTestCase): ...@@ -56,22 +56,6 @@ class UserModelTest(ModelTestCase):
'blank': False, 'blank': False,
'null': False, 'null': False,
}, },
'date_of_birth': {
'verbose_name': 'date de naissance',
'blank': True,
'null': True,
},
'gender': {
'verbose_name': 'sexe',
'max_length': 1,
'choices': (('M', 'Homme'), ('F', 'Femme')),
'blank': True,
},
'phone_number': {
'verbose_name': 'téléphone',
'blank': True,
'null': True,
},
'profile_type': { 'profile_type': {
'verbose_name': 'type de profil', 'verbose_name': 'type de profil',
'blank': False, 'blank': False,
......
...@@ -40,8 +40,7 @@ class CustomUserAdmin(UserAdmin): ...@@ -40,8 +40,7 @@ class CustomUserAdmin(UserAdmin):
fieldsets = ( fieldsets = (
(None, {'fields': ('email', 'password')}), (None, {'fields': ('email', 'password')}),
(_('Personal info'), {'fields': ( (_('Personal info'), {'fields': (
'first_name', 'last_name', 'date_of_birth', 'gender', 'first_name', 'last_name',
'phone_number',
)}), )}),
(_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser', (_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser',
'groups', 'user_permissions')}), 'groups', 'user_permissions')}),
......
...@@ -34,11 +34,6 @@ class UserFactory(factory.DjangoModelFactory): ...@@ -34,11 +34,6 @@ class UserFactory(factory.DjangoModelFactory):
# this is a default, override by passing `profile_type='...'` in create() # this is a default, override by passing `profile_type='...'` in create()
profile_type = None profile_type = None
date_of_birth = factory.Faker('date_this_century',
before_today=True, after_today=False,
locale='fr')
phone_number = factory.Faker('phone_number', locale='fr')
gender = factory.Iterator([User.MALE, User.FEMALE])
@classmethod @classmethod
def _create(cls, model_class, *args, **kwargs): def _create(cls, model_class, *args, **kwargs):
......
# Generated by Django 2.1.1 on 2018-09-11 20:23
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='date_of_birth',
),
migrations.RemoveField(
model_name='user',
name='gender',
),
migrations.RemoveField(
model_name='user',
name='phone_number',
),
]
...@@ -65,22 +65,6 @@ class User(AbstractUser): ...@@ -65,22 +65,6 @@ class User(AbstractUser):
objects = UserManager() objects = UserManager()
date_of_birth = models.DateField(blank=True, null=True,
verbose_name='date de naissance')
MALE = 'M'
FEMALE = 'F'
GENDER_CHOICES = (
(MALE, 'Homme'),
(FEMALE, 'Femme'),
)
gender = models.CharField('sexe', blank=True, null=True,
max_length=1, choices=GENDER_CHOICES)
# TODO add a proper phone number validator
phone_number = models.CharField('téléphone',
max_length=20, null=True, blank=True)
# type of profile of the user # type of profile of the user
PROFILE_STUDENT = 0 PROFILE_STUDENT = 0
PROFILE_TUTOR = 1 PROFILE_TUTOR = 1
......
...@@ -12,9 +12,7 @@ class UserSerializer(serializers.HyperlinkedModelSerializer): ...@@ -12,9 +12,7 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta: # noqa class Meta: # noqa
model = User model = User
fields = ('id', 'email', 'profile_type', fields = ('id', 'email', 'profile_type',
'first_name', 'last_name', 'first_name', 'last_name', 'url',)
'gender',
'phone_number', 'date_of_birth', 'url',)
extra_kwargs = { extra_kwargs = {
'email': {'read_only': True}, 'email': {'read_only': True},
'url': {'view_name': 'api:user-detail'}, 'url': {'view_name': 'api:user-detail'},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment