This mailing list is for the development of the Django Framework. Questions related to its usage should be posted to the django-users mailing list.
Regards, Michael Manfre On Fri, Nov 9, 2018 at 6:51 AM <pastrufa...@gmail.com> wrote: > Hi all, > > I have a very simple Profile class: > > class Profile(models.Model): > user = models.OneToOneField(User, on_delete=models.CASCADE) > location = models.CharField(max_length=30, blank=True) > birth_date = models.DateTimeField(null=True, blank=True) > date_activation = models.DateTimeField(null=True, blank=True) > > > I want to set date_activation = datetime.now the first time the user login. > I tried using "user_logged_id" signal, without success: > > @receiver(user_logged_in, sender=User) > def user_logged_in_callback(sender, user, request, **kwargs): > > Profile.objects.filter(get_user(request)).update(date_activation=datetime.now) > > > > Testing it I get this errore message below. > Any help or suggestions would be greatly appreciated! > > > TypeError at /admin/login/ > > int() argument must be a string, a bytes-like object or a number, not > 'ModelBase' > > Request Method: POST > Request URL: http://localhost:4000/admin/login/?next=/admin/ > Django Version: 1.11.16 > Exception Type: TypeError > Exception Value: > > int() argument must be a string, a bytes-like object or a number, not > 'ModelBase' > > Exception Location: > /usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py > in get_prep_value, line 966 > Python Executable: /usr/sbin/uwsgi > Python Version: 3.6.5 > Python Path: > > ['.', > '', > '/code', > '/usr/local/lib/python3.6/site-packages', > '/usr/lib/python3.6/site-packages', > '/usr/lib/python36.zip', > '/usr/lib/python3.6', > '/usr/lib/python3.6/lib-dynload'] > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To post to this group, send email to django-developers@googlegroups.com. > Visit this group at https://groups.google.com/group/django-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/fd7793b7-305a-4916-bae8-e8de687be346%40googlegroups.com > <https://groups.google.com/d/msgid/django-developers/fd7793b7-305a-4916-bae8-e8de687be346%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- GPG Fingerprint: 74DE D158 BAD0 EDF8 keybase.io/manfre -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAGdCwBuHP_w%3Do0d2kVd9YSLeFC3g2xfPozCRWtG6m2N%2BonssDg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.