2.1.36 route is_highlighted_now
This commit is contained in:
@@ -201,29 +201,17 @@ def get_routes_Dict(user=None, data=None):
|
|||||||
})
|
})
|
||||||
|
|
||||||
if key not in (
|
if key not in (
|
||||||
'from_address_point_txt', 'to_address_point_txt', 'csrfmiddlewaretoken', 'sort', 'weight',
|
'from_city', 'to_city', 'csrfmiddlewaretoken', 'sort', 'weight',
|
||||||
'from_el', 'to_el', 'from_address_point', 'to_address_point', 'type_transport',
|
'from_el', 'to_el', 'type_transport',
|
||||||
'departure_DT', 'arrival_DT'
|
'departure_DT', 'arrival_DT'
|
||||||
):
|
):
|
||||||
kwargs.update({key: val})
|
kwargs.update({key: val})
|
||||||
|
|
||||||
if key == 'from_address_point': # в from_address_point всегда город
|
if key == 'from_city':
|
||||||
# city = get_city_by_type_transport_and_address_point(type_transport, val)
|
kwargs.update({f'from_city_id': val})
|
||||||
city = get_city_by_address_point(val)
|
|
||||||
kwargs.update({f'from_city': city})
|
|
||||||
|
|
||||||
|
if key == 'to_city':
|
||||||
res_Dict.update({
|
kwargs.update({f'to_city_id': val})
|
||||||
'from_address_point_txt': city.get_country_n_city_str()
|
|
||||||
})
|
|
||||||
|
|
||||||
if key == 'to_address_point': # в to_address_point всегда город
|
|
||||||
# city = get_city_by_type_transport_and_address_point(type_transport, val)
|
|
||||||
city = get_city_by_address_point(val)
|
|
||||||
kwargs.update({f'to_city': city})
|
|
||||||
res_Dict.update({
|
|
||||||
'to_address_point_txt': city.get_country_n_city_str()
|
|
||||||
})
|
|
||||||
|
|
||||||
if key == 'from_el':
|
if key == 'from_el':
|
||||||
from_el = int(val)
|
from_el = int(val)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from django.db import models
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from BaseModels.base_models import BaseModel
|
from BaseModels.base_models import BaseModel
|
||||||
from colorfield.fields import ColorField
|
from colorfield.fields import ColorField
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
type_transport_choices = [
|
type_transport_choices = [
|
||||||
@@ -116,6 +117,13 @@ class Route(BaseModel):
|
|||||||
verbose_name_plural = _(u'Маршруты')
|
verbose_name_plural = _(u'Маршруты')
|
||||||
ordering = ('name',)
|
ordering = ('name',)
|
||||||
|
|
||||||
|
|
||||||
|
def is_highlighted_now(self):
|
||||||
|
if self.highlight_end_DT and datetime.now() < self.highlight_end_DT:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def get_permission_for_raise(self):
|
def get_permission_for_raise(self):
|
||||||
from SubscribesApp.funcs import get_cur_user_subscribe
|
from SubscribesApp.funcs import get_cur_user_subscribe
|
||||||
user_subscribe = get_cur_user_subscribe(self.owner)
|
user_subscribe = get_cur_user_subscribe(self.owner)
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ class Admin_SubscribeForUser(Admin_Trans_BaseModel):
|
|||||||
list_display_links = ['id']
|
list_display_links = ['id']
|
||||||
|
|
||||||
list_filter = [
|
list_filter = [
|
||||||
|
'enable',
|
||||||
'subscribe', 'last_paid_DT', 'paid_period_from_DT', 'paid_period_to_DT',
|
'subscribe', 'last_paid_DT', 'paid_period_from_DT', 'paid_period_to_DT',
|
||||||
'auto_continue', 'receive_finish_subscribe_msg',
|
'auto_continue', 'receive_finish_subscribe_msg',
|
||||||
'modifiedDT', 'createDT'
|
'modifiedDT', 'createDT'
|
||||||
|
|||||||
Reference in New Issue
Block a user