V
V
Vampre2018-07-29 05:53:57
Django
Vampre, 2018-07-29 05:53:57

What is the best way to store data temporarily?

It is necessary to implement the following functionality: when registering, the user first enters a login and password (User model), and then fills out a questionnaire (Profile model). At the same time, if the questionnaire is not filled out (for example, the user sent the username and password, but did not fill out the questionnaire and closed the tab), then the account should not be created.

from django.db import models
from django.contrib.auth.models import User
from django import forms
from django.conf import settings


class Profile(models.Model):
    user = models.OneToOneField(settings.AUTH_USER_MODEL)
    firstName = models.CharField("Имя", max_length=10)
    lastName = models.CharField("Фамилия", max_length=20)
    fatherName = models.CharField("Отчество", max_length=20)
    phoneNum = models.CharField("Номер телефона", max_length=12, default='')
    age = models.PositiveSmallIntegerField("Возраст", blank=True)
    reg_num = models.IntegerField("Регистрационный номер", default=0)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2018-07-29
@Vampre

What if I can’t or don’t want to complete my profile right now, but I can do it later?
if functionality is tied to the profile, do not give access to it without filling it out.
make some reasonable period after which delete accounts with an empty profile.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question