aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2020-02-17 20:55:54 +0000
committerMatthew Lemon <matt@matthewlemon.com>2020-02-17 20:55:54 +0000
commit7b6de8f88d2673ffdd61dc8cc7f1fca754c8cf88 (patch)
tree6ac039c2b4237ae7c1e9a5cee5213489e518b76d
parent05d56d5033fd65eb12c18d0497b1a8cddeda0cb1 (diff)
added active, comments, updated_by fields to organisation
-rw-r--r--ctrack/organisations/admin.py2
-rw-r--r--ctrack/organisations/migrations/0017_auto_20200217_2050.py31
-rw-r--r--ctrack/organisations/migrations/0018_organisation_comments.py19
-rw-r--r--ctrack/organisations/migrations/0019_organisation_active.py18
-rw-r--r--ctrack/organisations/models.py8
5 files changed, 76 insertions, 2 deletions
diff --git a/ctrack/organisations/admin.py b/ctrack/organisations/admin.py
index 019ec05..02f0373 100644
--- a/ctrack/organisations/admin.py
+++ b/ctrack/organisations/admin.py
@@ -24,7 +24,7 @@ class AddressInLine(admin.StackedInline):
class OrganisationAdmin(admin.ModelAdmin):
inlines = [AddressInLine]
- list_display = ("name", "submode")
+ list_display = ("name", "submode", "date_updated", "updated_by")
class PersonAdmin(admin.ModelAdmin):
diff --git a/ctrack/organisations/migrations/0017_auto_20200217_2050.py b/ctrack/organisations/migrations/0017_auto_20200217_2050.py
new file mode 100644
index 0000000..7fe2de2
--- /dev/null
+++ b/ctrack/organisations/migrations/0017_auto_20200217_2050.py
@@ -0,0 +1,31 @@
+# Generated by Django 2.2.9 on 2020-02-17 20:50
+
+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),
+ ('organisations', '0016_auto_20200217_1712'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='person',
+ options={'verbose_name_plural': 'People'},
+ ),
+ migrations.AddField(
+ model_name='organisation',
+ name='date_updated',
+ field=models.DateField(auto_now=True),
+ ),
+ migrations.AddField(
+ model_name='organisation',
+ name='updated_by',
+ field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
+ preserve_default=False,
+ ),
+ ]
diff --git a/ctrack/organisations/migrations/0018_organisation_comments.py b/ctrack/organisations/migrations/0018_organisation_comments.py
new file mode 100644
index 0000000..f4a29ff
--- /dev/null
+++ b/ctrack/organisations/migrations/0018_organisation_comments.py
@@ -0,0 +1,19 @@
+# Generated by Django 2.2.9 on 2020-02-17 20:53
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('organisations', '0017_auto_20200217_2050'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='organisation',
+ name='comments',
+ field=models.TextField(default='NA', max_length=500),
+ preserve_default=False,
+ ),
+ ]
diff --git a/ctrack/organisations/migrations/0019_organisation_active.py b/ctrack/organisations/migrations/0019_organisation_active.py
new file mode 100644
index 0000000..affb7b8
--- /dev/null
+++ b/ctrack/organisations/migrations/0019_organisation_active.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.2.9 on 2020-02-17 20:55
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('organisations', '0018_organisation_comments'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='organisation',
+ name='active',
+ field=models.BooleanField(default=True),
+ ),
+ ]
diff --git a/ctrack/organisations/models.py b/ctrack/organisations/models.py
index 5493f06..7e4c624 100644
--- a/ctrack/organisations/models.py
+++ b/ctrack/organisations/models.py
@@ -1,7 +1,9 @@
from django.db import models
-# Create your models here.
+from django.contrib.auth import get_user_model
+
from django.urls import reverse
+from django.conf import settings
from django_extensions.db.fields import AutoSlugField
from slugify import slugify
@@ -68,6 +70,10 @@ class Organisation(models.Model):
designation_type = models.IntegerField(choices=DESIGNATION_TYPE, default=1)
registered_company_name = models.CharField(max_length=255, blank=True)
registered_company_number = models.CharField(max_length=100, blank=True)
+ date_updated = models.DateField(auto_now=True)
+ updated_by = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)
+ comments = models.TextField(max_length=500)
+ active = models.BooleanField(default=True)
def get_absolute_url(self):
return reverse("organisations:detail", kwargs={"slug": self.slug})