Files
edx-platform/lms/djangoapps/user_tours/models.py
Dillon Dumesnil 2f2a6317a5 feat: AA-1055: Add in User Tours to the platform
User Tours are walkthroughs we are able to give in our frontends.
This sets up the backend support for them by creating the model,
setting up the initial backfill, adds in a signal handler to init
the UserTour model on User creation, and sets up some endpoints
to get user tour information and update it. It is also being
initialized with a waffle flag to control the rollout. The flag is
intended to control all tours and not allow for opting into only some tours.
2021-11-30 18:21:09 +00:00

28 lines
969 B
Python

""" Models for the User Tour Experience. """
from django.contrib.auth import get_user_model
from django.db import models
from django.utils.translation import gettext_lazy as _
User = get_user_model()
class UserTour(models.Model):
"""
Model to track which tours a user needs to be shown.
Note: This does not track which tours a user has seen, only the ones they should.
.. no_pii:
"""
class CourseHomeChoices(models.TextChoices):
EXISTING_USER_TOUR = 'show-existing-user-tour', _('Show existing user tour')
NEW_USER_TOUR = 'show-new-user-tour', _('Show new user tour')
NO_TOUR = 'no-tour', _('Do not show user tour')
course_home_tour_status = models.CharField(
max_length=50, choices=CourseHomeChoices.choices, default=CourseHomeChoices.NEW_USER_TOUR
)
show_courseware_tour = models.BooleanField(default=True)
user = models.OneToOneField(User, related_name='tour', on_delete=models.CASCADE)