1.6.12 fix next package for my_routes
This commit is contained in:
@@ -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']
|
||||
|
||||
@@ -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='Количество часов выделения цветом объявлений'),
|
||||
),
|
||||
]
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user