remove from_stop to_stop list_editable
This commit is contained in:
parent
8207b33a30
commit
c19d3b1edf
|
@ -4,7 +4,7 @@ from mumbai.models import *
|
||||||
from django.contrib.contenttypes import generic
|
from django.contrib.contenttypes import generic
|
||||||
from django.contrib.admin.filterspecs import FilterSpec, RelatedFilterSpec
|
from django.contrib.admin.filterspecs import FilterSpec, RelatedFilterSpec
|
||||||
|
|
||||||
|
'''
|
||||||
class CustomFilterSpec(RelatedFilterSpec):
|
class CustomFilterSpec(RelatedFilterSpec):
|
||||||
def __init__(self, f, *args, **kwargs):
|
def __init__(self, f, *args, **kwargs):
|
||||||
super(CustomFilterSpec, self).__init__(f, *args, **kwargs)
|
super(CustomFilterSpec, self).__init__(f, *args, **kwargs)
|
||||||
|
@ -17,7 +17,7 @@ class CustomFilterSpec(RelatedFilterSpec):
|
||||||
|
|
||||||
|
|
||||||
FilterSpec.filter_specs.insert(0, (lambda f: bool(f.rel and hasattr(f, 'custom_filter_spec')), CustomFilterSpec))
|
FilterSpec.filter_specs.insert(0, (lambda f: bool(f.rel and hasattr(f, 'custom_filter_spec')), CustomFilterSpec))
|
||||||
|
'''
|
||||||
|
|
||||||
class RouteScheduleInline(admin.StackedInline):
|
class RouteScheduleInline(admin.StackedInline):
|
||||||
model = RouteSchedule
|
model = RouteSchedule
|
||||||
|
@ -77,7 +77,7 @@ class UniqueRouteForm(forms.ModelForm):
|
||||||
|
|
||||||
class UniqueRouteAdmin(admin.ModelAdmin):
|
class UniqueRouteAdmin(admin.ModelAdmin):
|
||||||
list_display = ("route","from_stop", "from_stop_txt", "to_stop", "to_stop_txt", "distance","is_full")
|
list_display = ("route","from_stop", "from_stop_txt", "to_stop", "to_stop_txt", "distance","is_full")
|
||||||
list_editable = ("from_stop", "to_stop")
|
# list_editable = ("from_stop", "to_stop")
|
||||||
readonly_fields = ("route","distance","is_full")
|
readonly_fields = ("route","distance","is_full")
|
||||||
search_fields = ("route__alias", "from_stop__name", "to_stop__name")
|
search_fields = ("route__alias", "from_stop__name", "to_stop__name")
|
||||||
ordering = ('route',)
|
ordering = ('route',)
|
||||||
|
|
|
@ -303,8 +303,8 @@ class UniqueRoute(models.Model):
|
||||||
to_stop = models.ForeignKey(Stop, related_name="unique_routes_to")
|
to_stop = models.ForeignKey(Stop, related_name="unique_routes_to")
|
||||||
distance = models.FloatField(blank=True, null=True)
|
distance = models.FloatField(blank=True, null=True)
|
||||||
is_full = models.BooleanField()
|
is_full = models.BooleanField()
|
||||||
from_stop.custom_filter_spec = True # this is used to identify the fields which use the custom filter
|
# from_stop.custom_filter_spec = True # this is used to identify the fields which use the custom filter
|
||||||
to_stop.custom_filter_spec = True # this is used to identify the fields which use the custom filter
|
# to_stop.custom_filter_spec = True # this is used to identify the fields which use the custom filter
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = 'Atlas'
|
verbose_name = 'Atlas'
|
||||||
verbose_name_plural = 'Atlas'
|
verbose_name_plural = 'Atlas'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user