Get the user ID logged in Python

0

I'm having a project in Python and Django. Where I have an INSCRIPTION class, and in this table I would like to record in the "Person" column the user ID logged in the application, in the "Events" column record the event that he is doing registration, which in case I am using Slug, for access of this event.

class Inscricao(models.Model):
    pessoa = models.ForeignKey(User, verbose_name='usuario', on_delete=models.CASCADE)
    evento = models.ForeignKey(Evento, verbose_name='evento', on_delete=models.CASCADE)
    categoria = models.ForeignKey(Categoria, verbose_name='categoria', on_delete=models.CASCADE)
    numero = models.IntegerField(verbose_name='número', blank=True)
    data_inscricao = models.DateField(verbose_name='data de inscrição', blank=True)
    detalhe = models.TextField(max_length=100, verbose_name='observação', blank=True)
    
asked by anonymous 29.10.2018 / 13:29

0 answers