aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/organisations/models.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-01-20 19:47:15 +0000
committerMatthew Lemon <lemon@matthewlemon.com>2020-01-20 19:47:15 +0000
commitb56df3b59558e790b1e9a7a4aab16fa4c798110c (patch)
treef0b2e5d192a95e1634df96a89f6c3b4d7dc46334 /ctrack/organisations/models.py
parent9ebc666f819897aac04e9bc529a39fb40ee7abfb (diff)
first passing test!
Diffstat (limited to '')
-rw-r--r--ctrack/organisations/models.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/ctrack/organisations/models.py b/ctrack/organisations/models.py
new file mode 100644
index 0000000..976e661
--- /dev/null
+++ b/ctrack/organisations/models.py
@@ -0,0 +1,15 @@
+from django.db import models
+
+# Create your models here.
+from django.urls import reverse
+from slugify import slugify
+
+
+class Organisation(models.Model):
+ name = models.CharField(max_length=255, blank=False)
+
+ def get_absolute_url(self):
+ return reverse("organisations:detail", kwargs={"name": self.slugify_name()})
+
+ def slugify_name(self):
+ return slugify(self.name)