mirror of
https://github.com/TurTaskProject/TurTaskWeb.git
synced 2025-12-20 06:24:07 +01:00
Update Task sub class field
This commit is contained in:
parent
fec588f81f
commit
be1c6fd466
@ -4,3 +4,6 @@ from django.apps import AppConfig
|
|||||||
class BoardsConfig(AppConfig):
|
class BoardsConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
name = 'boards'
|
name = 'boards'
|
||||||
|
|
||||||
|
def ready(self):
|
||||||
|
import boards.signals
|
||||||
@ -0,0 +1,107 @@
|
|||||||
|
# Generated by Django 4.2.6 on 2023-11-19 20:15
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('boards', '0001_initial'),
|
||||||
|
('tasks', '0014_recurrencetask_completed_todo_completed'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='RecurrencePattern',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('recurring_type', models.IntegerField(choices=[(0, 'Daily'), (1, 'Weekly'), (2, 'Monthly'), (3, 'Yearly')])),
|
||||||
|
('max_occurrences', models.IntegerField(default=0)),
|
||||||
|
('day_of_week', models.IntegerField(choices=[(0, 'Monday'), (1, 'Tuesday'), (2, 'Wednesday'), (3, 'Thursday'), (4, 'Friday'), (5, 'Saturday'), (6, 'Sunday')])),
|
||||||
|
('week_of_month', models.IntegerField(choices=[(1, 'First'), (2, 'Second'), (3, 'Third'), (4, 'Fourth'), (5, 'Last')])),
|
||||||
|
('day_of_month', models.IntegerField(default=0)),
|
||||||
|
('month_of_year', models.IntegerField(choices=[(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'), (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'), (9, 'September'), (10, 'October'), (11, 'November'), (12, 'December')])),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='transaction',
|
||||||
|
name='user',
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='UserNotification',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='habit',
|
||||||
|
name='end_event',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='habit',
|
||||||
|
name='google_calendar_id',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='habit',
|
||||||
|
name='start_event',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='recurrencetask',
|
||||||
|
name='google_calendar_id',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='recurrencetask',
|
||||||
|
name='recurrence_rule',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='habit',
|
||||||
|
name='current_count',
|
||||||
|
field=models.IntegerField(default=0),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='recurrencetask',
|
||||||
|
name='is_active',
|
||||||
|
field=models.BooleanField(default=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='recurrencetask',
|
||||||
|
name='is_full_day_event',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='recurrencetask',
|
||||||
|
name='list_board',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='boards.listboard'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='recurrencetask',
|
||||||
|
name='parent_task',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='tasks.recurrencetask'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='recurrencetask',
|
||||||
|
name='rrule',
|
||||||
|
field=models.CharField(blank=True, max_length=255, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='todo',
|
||||||
|
name='is_active',
|
||||||
|
field=models.BooleanField(default=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='todo',
|
||||||
|
name='is_full_day_event',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='todo',
|
||||||
|
name='list_board',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='boards.listboard'),
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='Transaction',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='recurrencepattern',
|
||||||
|
name='recurrence_task',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tasks.recurrencetask'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -1,7 +1,7 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from boards.models import ListBoard
|
from boards.models import ListBoard, Board
|
||||||
|
|
||||||
class Tag(models.Model):
|
class Tag(models.Model):
|
||||||
"""
|
"""
|
||||||
@ -56,6 +56,7 @@ class Todo(Task):
|
|||||||
NOT_IMPORTANT_URGENT = 3, 'Not Important & Urgent'
|
NOT_IMPORTANT_URGENT = 3, 'Not Important & Urgent'
|
||||||
NOT_IMPORTANT_NOT_URGENT = 4, 'Not Important & Not Urgent'
|
NOT_IMPORTANT_NOT_URGENT = 4, 'Not Important & Not Urgent'
|
||||||
|
|
||||||
|
list_board = models.ForeignKey(ListBoard, on_delete=models.CASCADE, null=True)
|
||||||
is_active = models.BooleanField(default=True)
|
is_active = models.BooleanField(default=True)
|
||||||
is_full_day_event = models.BooleanField(default=False)
|
is_full_day_event = models.BooleanField(default=False)
|
||||||
start_event = models.DateTimeField(null=True)
|
start_event = models.DateTimeField(null=True)
|
||||||
@ -68,14 +69,14 @@ class Todo(Task):
|
|||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
class RecurrenceTask(Task):
|
class RecurrenceTask(Task):
|
||||||
list_board = models.ForeignKey(ListBoard, on_delete=models.CASCADE)
|
list_board = models.ForeignKey(ListBoard, on_delete=models.CASCADE, null=True)
|
||||||
rrule = models.CharField(max_length=255)
|
rrule = models.CharField(max_length=255, null=True, blank=True)
|
||||||
is_active = models.BooleanField(default=True)
|
is_active = models.BooleanField(default=True)
|
||||||
is_full_day_event = models.BooleanField(default=False)
|
is_full_day_event = models.BooleanField(default=False)
|
||||||
start_event = models.DateTimeField(null=True)
|
start_event = models.DateTimeField(null=True)
|
||||||
end_event = models.DateTimeField(null=True)
|
end_event = models.DateTimeField(null=True)
|
||||||
completed = models.BooleanField(default=False)
|
completed = models.BooleanField(default=False)
|
||||||
parent_task = models.ForeignKey("self", null=True)
|
parent_task = models.ForeignKey("self", on_delete=models.CASCADE, null=True)
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return f"{self.title} ({self.recurrence_rule})"
|
return f"{self.title} ({self.recurrence_rule})"
|
||||||
@ -119,7 +120,7 @@ class RecurrencePattern(models.Model):
|
|||||||
DECEMBER = 12, 'December'
|
DECEMBER = 12, 'December'
|
||||||
|
|
||||||
recurrence_task = models.ForeignKey(RecurrenceTask, on_delete=models.CASCADE)
|
recurrence_task = models.ForeignKey(RecurrenceTask, on_delete=models.CASCADE)
|
||||||
recurring_type = models.IntergerField(choices=RecurringType.choices)
|
recurring_type = models.IntegerField(choices=RecurringType.choices)
|
||||||
max_occurrences = models.IntegerField(default=0)
|
max_occurrences = models.IntegerField(default=0)
|
||||||
day_of_week = models.IntegerField(choices=DayOfWeek.choices)
|
day_of_week = models.IntegerField(choices=DayOfWeek.choices)
|
||||||
week_of_month = models.IntegerField(choices=WeekOfMonth.choices)
|
week_of_month = models.IntegerField(choices=WeekOfMonth.choices)
|
||||||
|
|||||||
@ -0,0 +1,38 @@
|
|||||||
|
# Generated by Django 4.2.6 on 2023-11-19 20:15
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('users', '0005_alter_userstats_endurance_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='userstats',
|
||||||
|
name='endurance',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='userstats',
|
||||||
|
name='intelligence',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='userstats',
|
||||||
|
name='luck',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='userstats',
|
||||||
|
name='perception',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='userstats',
|
||||||
|
name='strength',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='customuser',
|
||||||
|
name='last_name',
|
||||||
|
field=models.CharField(blank=True, max_length=150),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -5,7 +5,6 @@ from django.db import models
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
|
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
|
||||||
from django.core.validators import MinValueValidator, MaxValueValidator
|
|
||||||
|
|
||||||
from .managers import CustomAccountManager
|
from .managers import CustomAccountManager
|
||||||
|
|
||||||
@ -15,6 +14,7 @@ class CustomUser(AbstractBaseUser, PermissionsMixin):
|
|||||||
email = models.EmailField(_('email address'), unique=True)
|
email = models.EmailField(_('email address'), unique=True)
|
||||||
username = models.CharField(max_length=150, unique=True)
|
username = models.CharField(max_length=150, unique=True)
|
||||||
first_name = models.CharField(max_length=150, blank=True)
|
first_name = models.CharField(max_length=150, blank=True)
|
||||||
|
last_name = models.CharField(max_length=150, blank=True)
|
||||||
start_date = models.DateTimeField(default=timezone.now)
|
start_date = models.DateTimeField(default=timezone.now)
|
||||||
about = models.TextField(_('about'), max_length=500, blank=True)
|
about = models.TextField(_('about'), max_length=500, blank=True)
|
||||||
profile_pic = models.ImageField(upload_to='profile_pics', null=True, blank=True, default='profile_pics/default.png')
|
profile_pic = models.ImageField(upload_to='profile_pics', null=True, blank=True, default='profile_pics/default.png')
|
||||||
@ -35,7 +35,6 @@ class CustomUser(AbstractBaseUser, PermissionsMixin):
|
|||||||
# String representation of the user
|
# String representation of the user
|
||||||
return self.username
|
return self.username
|
||||||
|
|
||||||
|
|
||||||
def random_luck():
|
def random_luck():
|
||||||
return random.randint(1, 50)
|
return random.randint(1, 50)
|
||||||
|
|
||||||
@ -51,17 +50,6 @@ class UserStats(models.Model):
|
|||||||
health = models.IntegerField(default=100)
|
health = models.IntegerField(default=100)
|
||||||
gold = models.FloatField(default=0.0)
|
gold = models.FloatField(default=0.0)
|
||||||
experience = models.FloatField(default=0)
|
experience = models.FloatField(default=0)
|
||||||
strength = models.IntegerField(default=1,
|
|
||||||
validators=[MinValueValidator(1),
|
|
||||||
MaxValueValidator(100)])
|
|
||||||
intelligence = models.IntegerField(default=1, validators=[MinValueValidator(1),
|
|
||||||
MaxValueValidator(100)])
|
|
||||||
endurance = models.IntegerField(default=1, validators=[MinValueValidator(1),
|
|
||||||
MaxValueValidator(100)])
|
|
||||||
perception = models.IntegerField(default=1, validators=[MinValueValidator(1),
|
|
||||||
MaxValueValidator(100)])
|
|
||||||
luck = models.IntegerField(default=random_luck, validators=[MinValueValidator(1),
|
|
||||||
MaxValueValidator(50)],)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def level(self):
|
def level(self):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user