mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-05-15 15:31:28 +01:00
feat(activities): Add Activity models
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class ActivitiesConfig(AppConfig):
|
||||||
|
name = 'activities'
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# Generated by Django 2.2.9 on 2020-02-14 09:47
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='ActivitySeries',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=1023)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name_plural': 'activity series',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Activity',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=1023)),
|
||||||
|
('series', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='instances', to='activities.ActivitySeries')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name_plural': 'activities',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
class ActivitySeries(models.Model):
|
||||||
|
"""
|
||||||
|
A series of related :class:`Activity`s
|
||||||
|
"""
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name_plural = 'activity series'
|
||||||
|
|
||||||
|
#: Name of activity series
|
||||||
|
name = models.CharField(max_length=1023,
|
||||||
|
blank=False, null=False)
|
||||||
|
|
||||||
|
|
||||||
|
class Activity(models.Model):
|
||||||
|
"""
|
||||||
|
An instance of an activity - e.g. a workshop
|
||||||
|
"""
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name_plural = 'activities'
|
||||||
|
|
||||||
|
#: Name of activity
|
||||||
|
name = models.CharField(max_length=1023,
|
||||||
|
blank=False, null=False)
|
||||||
|
|
||||||
|
#: Optional :class:`ActivitySeries` to which this activity belongs
|
||||||
|
series = models.ForeignKey(ActivitySeries, related_name='instances',
|
||||||
|
on_delete=models.PROTECT,
|
||||||
|
blank=True, null=True)
|
||||||
@@ -72,6 +72,7 @@ THIRD_PARTY_APPS = [
|
|||||||
|
|
||||||
FIRST_PARTY_APPS = [
|
FIRST_PARTY_APPS = [
|
||||||
'people',
|
'people',
|
||||||
|
'activities',
|
||||||
]
|
]
|
||||||
|
|
||||||
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + FIRST_PARTY_APPS
|
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + FIRST_PARTY_APPS
|
||||||
|
|||||||
Reference in New Issue
Block a user