feat: Make Task class swappable
This commit is contained in:
parent
16b0d5b29b
commit
46046007f7
1 changed files with 7 additions and 1 deletions
|
@ -2,6 +2,7 @@ from __future__ import unicode_literals
|
|||
|
||||
import datetime
|
||||
import os
|
||||
import swapper
|
||||
import textwrap
|
||||
|
||||
from django.conf import settings
|
||||
|
@ -68,7 +69,7 @@ class TaskList(models.Model):
|
|||
unique_together = ("group", "slug")
|
||||
|
||||
|
||||
class Task(models.Model):
|
||||
class BaseTask(models.Model):
|
||||
title = models.CharField(max_length=140)
|
||||
task_list = models.ForeignKey(TaskList, on_delete=models.CASCADE, null=True)
|
||||
created_date = models.DateField(default=timezone.now, blank=True, null=True)
|
||||
|
@ -125,6 +126,11 @@ class Task(models.Model):
|
|||
ordering = ["priority", "created_date"]
|
||||
|
||||
|
||||
class Task(BaseTask):
|
||||
class Meta:
|
||||
swappable = swapper.swappable_setting("todo", "Task")
|
||||
|
||||
|
||||
class Comment(models.Model):
|
||||
"""
|
||||
Not using Django's built-in comments because we want to be able to save
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue