Commit 196d96331aa2a4eded9b6dced5927380025abc00
1 parent
7ce54a3a
Exists in
master
and in
3 other branches
Adding last_update field in users
Showing
3 changed files
with
25 additions
and
10 deletions
Show diff stats
users/forms.py
| ... | ... | @@ -40,9 +40,6 @@ class RegisterUserForm(ValidationRegister): |
| 40 | 40 | self.instance.set_password(self.cleaned_data['password']) |
| 41 | 41 | |
| 42 | 42 | self.instance.save() |
| 43 | - | |
| 44 | - if self.instance.type_profile == 2: | |
| 45 | - assign_role(self.instance, 'student') | |
| 46 | 43 | |
| 47 | 44 | return self.instance |
| 48 | 45 | ... | ... |
| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-12-20 20:00 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.db import migrations, models | |
| 6 | + | |
| 7 | + | |
| 8 | +class Migration(migrations.Migration): | |
| 9 | + | |
| 10 | + dependencies = [ | |
| 11 | + ('users', '0001_initial'), | |
| 12 | + ] | |
| 13 | + | |
| 14 | + operations = [ | |
| 15 | + migrations.RemoveField( | |
| 16 | + model_name='user', | |
| 17 | + name='type_profile', | |
| 18 | + ), | |
| 19 | + migrations.AddField( | |
| 20 | + model_name='user', | |
| 21 | + name='last_update', | |
| 22 | + field=models.DateTimeField(auto_now=True, verbose_name='Last Update'), | |
| 23 | + ), | |
| 24 | + ] | ... | ... |
users/models.py
| ... | ... | @@ -20,8 +20,8 @@ class User(AbstractBaseUser, PermissionsMixin): |
| 20 | 20 | social_name = models.CharField(_('Social Name'), max_length = 100, blank = True, null = True) |
| 21 | 21 | description = models.TextField(_('Description'), blank = True) |
| 22 | 22 | image = models.ImageField(verbose_name = _('Photo'), null=True, blank = True, upload_to = 'users/') |
| 23 | - type_profile = models.IntegerField(_('Type'), null = True, blank = True, choices = ((1, _('Professor')), (2, _('Student')), (3, _('Coordinator')))) | |
| 24 | 23 | date_created = models.DateTimeField(_('Create Date'), auto_now_add = True) |
| 24 | + last_update = models.DateTimeField(_('Last Update'), auto_now = True) | |
| 25 | 25 | show_email = models.IntegerField(_('Show email?'), null = True, choices = ((1, _('Allow everyone to see my address')), (2, _('Only classmates can see my address')), (3, _('Nobody can see my address')))) |
| 26 | 26 | is_staff = models.BooleanField(_('Administrator'), default = False) |
| 27 | 27 | is_active = models.BooleanField(_('Active'), default = True) |
| ... | ... | @@ -38,12 +38,6 @@ class User(AbstractBaseUser, PermissionsMixin): |
| 38 | 38 | def __str__(self): |
| 39 | 39 | return self.social_name or self.username |
| 40 | 40 | |
| 41 | - def save(self, *args, **kwargs): | |
| 42 | - if not self.is_staff and self.type_profile is None: | |
| 43 | - self.type_profile = 2 | |
| 44 | - | |
| 45 | - super(User, self).save(*args, **kwargs) | |
| 46 | - | |
| 47 | 41 | @property |
| 48 | 42 | def image_url(self): |
| 49 | 43 | if self.image and hasattr(self.image, 'url'): | ... | ... |