aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/organisations/models.py
diff options
context:
space:
mode:
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)