1.6.12 fix next package for my_routes

This commit is contained in:
SDE
2024-08-13 14:41:11 +03:00
parent a99ffcc9d2
commit 42c2843cab
8 changed files with 72 additions and 10 deletions

View File

@@ -45,7 +45,8 @@ class Admin_SubscribeOption(Admin_Trans_BaseModel):
(None, {
'classes': ['wide'],
'fields': (
'allow_route_rising_count', 'allow_route_highlight_count'
('allow_route_rising_count',),
('allow_route_highlight_count', 'route_highlight_hours'),
)
}),
)
@@ -53,6 +54,8 @@ class Admin_SubscribeOption(Admin_Trans_BaseModel):
list_display = [
'id', 'enable',
'name',
'allow_route_rising_count',
'allow_route_highlight_count', 'route_highlight_hours',
'order', 'modifiedDT', 'createDT'
]
list_editable = ['enable']

View File

@@ -0,0 +1,18 @@
# Generated by Django 4.2.2 on 2024-08-13 13:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('SubscribesApp', '0006_rename_allow_route_select_count_subscribeoption_allow_route_highlight_count'),
]
operations = [
migrations.AddField(
model_name='subscribeoption',
name='route_highlight_hours',
field=models.IntegerField(default=24, verbose_name='Количество часов выделения цветом объявлений'),
),
]

View File

@@ -17,8 +17,12 @@ from datetime import datetime, timedelta
class SubscribeOption(BaseModel):
allow_route_rising_count = models.IntegerField(verbose_name=_('Количество поднятий объявлений') ,default=0)
allow_route_highlight_count = models.IntegerField(verbose_name=_('Количество выделений объявлений'), default=0)
allow_route_rising_count = models.IntegerField(
verbose_name=_('Количество поднятий объявлений') ,default=0)
allow_route_highlight_count = models.IntegerField(
verbose_name=_('Количество выделений объявлений'), default=0)
route_highlight_hours = models.IntegerField(
verbose_name=_('Количество часов выделения цветом объявлений'), default=24)
class Meta:
verbose_name = _('Опция подписки')
@@ -88,6 +92,14 @@ class SubscribeForUser(BaseModel):
res += f' {str(self.id)}'
return res
def get_highlight_hours(self):
options = self.subscribe.options.filter(
allow_route_highlight_count__gt=0,
)
if options:
return options[0].route_highlight_hours
return 0
def remains_route_adding_options(self):
total_data = SubscribeOption.objects.filter(