Commit d8a3b968 authored by Imane Misrar's avatar Imane Misrar
Browse files

feat(lastVisitedUniversities) : add LastVisitedUniversity model and migration of the new model

Relates to #149
parent a3c22926
......@@ -14,6 +14,7 @@ from backend_app.models.exchange import Exchange, UnivMajorMinors
from backend_app.models.exchangeFeedback import ExchangeFeedback
from backend_app.models.for_testing.moderation import ForTestingModeration
from backend_app.models.for_testing.versioning import ForTestingVersioning
from backend_app.models.lastVisitedUniversities import LastVisitedUniversity
from backend_app.models.offer import Offer
from backend_app.models.partner import Partner
from backend_app.models.pendingModeration import PendingModeration
......@@ -38,6 +39,7 @@ ALL_MODELS = [
Course,
CourseFeedback,
Currency,
LastVisitedUniversity,
Offer,
PendingModeration,
Exchange,
......
# Generated by Django 2.1.7 on 2020-05-24 08:53
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("backend_app", "0004_merge_20200503_1749"),
]
operations = [
migrations.CreateModel(
name="LastVisitedUniversity",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("ts", models.DateTimeField(auto_now=True)),
(
"university",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="backend_app.University",
),
),
(
"user",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
],
options={"abstract": False},
)
]
from django.db import models
from backend_app.models.abstract.base import BaseModel
from backend_app.permissions.moderation import ModerationLevels
from base_app.models import User
from backend_app.models.university import University
class LastVisitedUniversity(BaseModel):
moderation_level = ModerationLevels.NO_MODERATION
user = models.ForeignKey(User, on_delete=models.CASCADE, null=True)
university = models.ForeignKey(University, on_delete=models.CASCADE, null=True)
ts = models.DateTimeField(auto_now=True)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment