diff --git a/swh/web/add_forge_now/apps.py b/swh/web/add_forge_now/apps.py --- a/swh/web/add_forge_now/apps.py +++ b/swh/web/add_forge_now/apps.py @@ -5,7 +5,9 @@ from django.apps import AppConfig +LABEL = "swh_web_add_forge_now" + class AddForgeNowConfig(AppConfig): name = "swh.web.add_forge_now" - label = "swh_web_add_forge_now" + label = LABEL diff --git a/swh/web/add_forge_now/migrations/0004_auto_20220329_0844.py b/swh/web/add_forge_now/migrations/0004_auto_20220329_0844.py new file mode 100644 --- /dev/null +++ b/swh/web/add_forge_now/migrations/0004_auto_20220329_0844.py @@ -0,0 +1,15 @@ +# Generated by Django 2.2.24 on 2022-03-29 08:44 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("add_forge_now", "0003_request_submitter_forward_username"), + ] + + operations = [ + migrations.AlterModelTable(name="request", table="request",), + migrations.AlterModelTable(name="requesthistory", table="requesthistory",), + ] diff --git a/swh/web/add_forge_now/models.py b/swh/web/add_forge_now/models.py --- a/swh/web/add_forge_now/models.py +++ b/swh/web/add_forge_now/models.py @@ -10,6 +10,8 @@ from django.db import models +from .apps import LABEL + class RequestStatus(enum.Enum): """Request statuses. @@ -68,7 +70,13 @@ return tuple((variant.name, variant.value) for variant in cls) -class RequestHistory(models.Model): +class _BaseModel(models.Model): + class Meta: + abstract = True + app_label = LABEL + + +class RequestHistory(_BaseModel): """Comment or status change. This is commented or changed by either submitter or moderator. @@ -81,8 +89,11 @@ date = models.DateTimeField(auto_now_add=True) new_status = models.TextField(choices=RequestStatus.choices(), null=True) + class Meta: + db_table = "requesthistory" -class Request(models.Model): + +class Request(_BaseModel): status = models.TextField( choices=RequestStatus.choices(), default=RequestStatus.PENDING.name, ) @@ -98,3 +109,6 @@ forge_contact_comment = models.TextField( null=True, help_text="Where did you find this contact information (url, ...)", ) + + class Meta: + db_table = "request"