admin files stable v1
This commit is contained in:
commit
a8662509c4
|
@ -7,32 +7,34 @@ class RouteScheduleInline(admin.StackedInline):
|
||||||
extras = 0
|
extras = 0
|
||||||
|
|
||||||
class AreaAdmin(admin.OSMGeoAdmin):
|
class AreaAdmin(admin.OSMGeoAdmin):
|
||||||
list_display = ("code", "name")
|
list_display = ("code","display_name", "name_mr", "name", "slug")
|
||||||
list_editable = ("name",)
|
list_editable = ("display_name", "name_mr",)
|
||||||
|
readonly_fields = ("code", "name")
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
models.TextField: {'widget': forms.TextInput},
|
models.TextField: {'widget': forms.TextInput},
|
||||||
}
|
}
|
||||||
default_lon = 72.855211097628413
|
default_lon = 8110203.9998955
|
||||||
default_lat = 19.415775291486027
|
default_lat = 2170000.4068373
|
||||||
default_zoom = 4
|
default_zoom = 10
|
||||||
|
search_fields = ("name","display_name", "name_mr","slug")
|
||||||
|
|
||||||
class RoadAdmin(admin.OSMGeoAdmin):
|
class RoadAdmin(admin.OSMGeoAdmin):
|
||||||
list_display = ("code","name")
|
list_display = ("code","display_name", "name_mr", "name", "slug")
|
||||||
list_editable = ("name",)
|
list_editable = ("display_name", "name_mr",)
|
||||||
|
readonly_fields = ("code", "name")
|
||||||
|
search_fields = ("name","display_name", "name_mr","slug")
|
||||||
|
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
models.TextField: {'widget': forms.TextInput},
|
models.TextField: {'widget': forms.TextInput},
|
||||||
}
|
}
|
||||||
default_lon = 72.855211097628413
|
|
||||||
default_lat = 19.415775291486027
|
|
||||||
default_zoom = 4
|
|
||||||
|
|
||||||
|
default_lon = 8110203.9998955
|
||||||
|
default_lat = 2170000.4068373
|
||||||
|
default_zoom = 10
|
||||||
|
|
||||||
class FareAdmin(admin.ModelAdmin):
|
class FareAdmin(admin.ModelAdmin):
|
||||||
list_display = ("slab","ordinary","limited","express","ac","ac_express")
|
list_display = ("slab","ordinary","limited","express","ac","ac_express")
|
||||||
readonly_fields = ("slab","ordinary","limited","express","ac","ac_express")
|
readonly_fields = ("slab","ordinary","limited","express","ac","ac_express")
|
||||||
list_editable = ("ordinary","limited","express","ac","ac_express")
|
|
||||||
|
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
models.TextField: {'widget': forms.TextInput},
|
models.TextField: {'widget': forms.TextInput},
|
||||||
|
@ -49,12 +51,13 @@ class StopForm(forms.ModelForm):
|
||||||
|
|
||||||
|
|
||||||
class StopAdmin(admin.OSMGeoAdmin):
|
class StopAdmin(admin.OSMGeoAdmin):
|
||||||
list_display = ("code","name","name_mr", "road","area","dbdirection","depot","chowki" )
|
list_display = ("code","display_name", "name_mr","name", "road","area","depot", "point")
|
||||||
list_editable = ("name", "name_mr","dbdirection","depot","chowki")
|
list_editable = ("display_name", "name_mr","depot",)
|
||||||
search_fields = ("code",'name', 'depot__name')
|
readonly_fields = ("code","name","road","area","depot","chowki" )
|
||||||
|
search_fields = ("code",'name', 'depot__name', "road__name", "area__name")
|
||||||
ordering = ('name',)
|
ordering = ('name',)
|
||||||
list_per_page = 20
|
list_per_page = 20
|
||||||
|
"""
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(None, {
|
(None, {
|
||||||
'fields': ('name', 'area', 'road')
|
'fields': ('name', 'area', 'road')
|
||||||
|
@ -65,19 +68,20 @@ class StopAdmin(admin.OSMGeoAdmin):
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
form = StopForm
|
form = StopForm
|
||||||
|
"""
|
||||||
# For mapping widget
|
# For mapping widget
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
models.TextField: {'widget': forms.TextInput},
|
models.TextField: {'widget': forms.TextInput},
|
||||||
}
|
}
|
||||||
default_lon = 72.855211097628413
|
|
||||||
default_lat = 19.415775291486027
|
|
||||||
default_zoom = 4
|
|
||||||
|
|
||||||
|
|
||||||
|
default_lon = 8110203.9998955
|
||||||
|
default_lat = 2170000.4068373
|
||||||
|
default_zoom = 10
|
||||||
|
|
||||||
class RouteDetailAdmin(admin.ModelAdmin):
|
class RouteDetailAdmin(admin.ModelAdmin):
|
||||||
list_display = ("route","serial","stop","stage","km")
|
list_display = ("route_code","serial","stop","stage","km")
|
||||||
readonly_fields = ("route","serial","stop","stage","km")
|
readonly_fields = ("route_code","serial","stop","stage","km")
|
||||||
|
search_fields = ("route_code","stop__name")
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
models.TextField: {'widget': forms.TextInput},
|
models.TextField: {'widget': forms.TextInput},
|
||||||
}
|
}
|
||||||
|
@ -85,6 +89,7 @@ class RouteDetailAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
class RouteAdmin(admin.ModelAdmin):
|
class RouteAdmin(admin.ModelAdmin):
|
||||||
list_display = ("alias","code","from_stop","to_stop","distance","stages")
|
list_display = ("alias","code","from_stop","to_stop","distance","stages")
|
||||||
|
search_fields = ("alias","from_stop__name","to_stop__name")
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
models.TextField: {'widget': forms.TextInput},
|
models.TextField: {'widget': forms.TextInput},
|
||||||
}
|
}
|
||||||
|
@ -92,7 +97,8 @@ class RouteAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
class RouteTypeAdmin(admin.ModelAdmin):
|
class RouteTypeAdmin(admin.ModelAdmin):
|
||||||
list_display = ("code","rtype","faretype")
|
list_display = ("code","rtype","faretype")
|
||||||
readonly_fields = ("code","rtype","faretype")
|
readonly_fields = ("code","rtype","faretype")
|
||||||
|
search_fields = ("code","rtype","faretype")
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
models.TextField: {'widget': forms.TextInput},
|
models.TextField: {'widget': forms.TextInput},
|
||||||
}
|
}
|
||||||
|
@ -101,20 +107,22 @@ class RouteTypeAdmin(admin.ModelAdmin):
|
||||||
class HardCodedRouteAdmin(admin.ModelAdmin):
|
class HardCodedRouteAdmin(admin.ModelAdmin):
|
||||||
list_display = ("code","alias","faretype")
|
list_display = ("code","alias","faretype")
|
||||||
readonly_fields = ("code","alias","faretype")
|
readonly_fields = ("code","alias","faretype")
|
||||||
|
search_fields = ("code","alias","faretype")
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
models.TextField: {'widget': forms.TextInput},
|
models.TextField: {'widget': forms.TextInput},
|
||||||
}
|
}
|
||||||
|
|
||||||
class LandmarkAdmin(admin.OSMGeoAdmin):
|
class LandmarkAdmin(admin.OSMGeoAdmin):
|
||||||
list_display = ("name", "name_mr")
|
list_display = ("name", "display_name", "name_mr", "slug", "point" )
|
||||||
#list_editable = ("name","name_mr")
|
list_editable = ("display_name","name_mr")
|
||||||
|
search_fields = ("name", "display_name", "name_mr","slug")
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
models.TextField: {'widget': forms.TextInput},
|
models.TextField: {'widget': forms.TextInput},
|
||||||
}
|
}
|
||||||
default_lon = 72.855211097628413
|
|
||||||
default_lat = 19.415775291486027
|
|
||||||
default_zoom = 4
|
|
||||||
|
|
||||||
|
default_lon = 8110203.9998955
|
||||||
|
default_lat = 2170000.4068373
|
||||||
|
default_zoom = 10
|
||||||
|
|
||||||
class StopLocationAdmin(admin.OSMGeoAdmin):
|
class StopLocationAdmin(admin.OSMGeoAdmin):
|
||||||
list_display = ("stop", "direction", "point")
|
list_display = ("stop", "direction", "point")
|
||||||
|
@ -122,14 +130,17 @@ class StopLocationAdmin(admin.OSMGeoAdmin):
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
models.TextField: {'widget': forms.TextInput},
|
models.TextField: {'widget': forms.TextInput},
|
||||||
}
|
}
|
||||||
default_lon = 72.855211097628413
|
|
||||||
default_lat = 19.415775291486027
|
default_lon = 8110203.9998955
|
||||||
default_zoom = 4
|
default_lat = 2170000.4068373
|
||||||
|
default_zoom = 10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DepotAdmin(admin.ModelAdmin):
|
class DepotAdmin(admin.ModelAdmin):
|
||||||
list_display = ("code", "name", "stop")
|
list_display = ("code", "name", "stop")
|
||||||
readonly_fields = ("code", "name", "stop")
|
readonly_fields = ("code", "name", "stop")
|
||||||
|
search_fields = ("code", "name", "stop__name")
|
||||||
#list_editable = ("name",)
|
#list_editable = ("name",)
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
models.TextField: {'widget': forms.TextInput},
|
models.TextField: {'widget': forms.TextInput},
|
||||||
|
@ -138,8 +149,8 @@ class DepotAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
class HolidayAdmin(admin.ModelAdmin):
|
class HolidayAdmin(admin.ModelAdmin):
|
||||||
list_display = ("date", "name")
|
list_display = ("date", "name")
|
||||||
readonly_fields = ("date", "name")
|
readonly_fields = ("date", "name")
|
||||||
list_editable = ("name",)
|
search_fields = ("name", "date")
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
models.TextField: {'widget': forms.TextInput},
|
models.TextField: {'widget': forms.TextInput},
|
||||||
}
|
}
|
||||||
|
@ -157,9 +168,8 @@ admin.site.register(Route, RouteAdmin)
|
||||||
admin.site.register(RouteType, RouteTypeAdmin)
|
admin.site.register(RouteType, RouteTypeAdmin)
|
||||||
admin.site.register(HardCodedRoute, HardCodedRouteAdmin)
|
admin.site.register(HardCodedRoute, HardCodedRouteAdmin)
|
||||||
|
|
||||||
admin.site.register(Landmark, LandmarkAdmin )
|
admin.site.register(Landmark, LandmarkAdmin)
|
||||||
admin.site.register(Depot,DepotAdmin)
|
admin.site.register(Depot,DepotAdmin)
|
||||||
admin.site.register(Holiday,HolidayAdmin)
|
admin.site.register(Holiday,HolidayAdmin)
|
||||||
admin.site.register(StopLocation,StopLocationAdmin)
|
admin.site.register(StopLocation,StopLocationAdmin)
|
||||||
|
|
||||||
admin.site.register(UniqueRoute, UniqueRouteAdmin)
|
admin.site.register(UniqueRoute, UniqueRouteAdmin)
|
||||||
|
|
|
@ -40,8 +40,10 @@ SCHED = {
|
||||||
|
|
||||||
class Area(models.Model):
|
class Area(models.Model):
|
||||||
code = models.IntegerField() #primary_key=True)
|
code = models.IntegerField() #primary_key=True)
|
||||||
|
slug = models.SlugField(null=True)
|
||||||
name = models.TextField(blank=True, max_length=255)
|
name = models.TextField(blank=True, max_length=255)
|
||||||
name_mr= models.TextField(null=True, blank=True, max_length=512) #null=True,
|
name_mr= models.TextField(null=True, blank=True, max_length=512) #null=True,
|
||||||
|
display_name = models.TextField(blank=True, max_length=255)
|
||||||
geometry = models.PolygonField(blank=True, null=True)
|
geometry = models.PolygonField(blank=True, null=True)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
|
@ -50,8 +52,10 @@ class Area(models.Model):
|
||||||
|
|
||||||
class Road(models.Model):
|
class Road(models.Model):
|
||||||
code = models.IntegerField()#primary_key=True)
|
code = models.IntegerField()#primary_key=True)
|
||||||
|
slug = models.SlugField(null=True)
|
||||||
name = models.TextField(blank=True, max_length=255)
|
name = models.TextField(blank=True, max_length=255)
|
||||||
name_mr= models.TextField(null=True, blank=True, max_length=512)
|
name_mr= models.TextField(null=True, blank=True, max_length=512)
|
||||||
|
display_name = models.TextField(blank=True, max_length=255)
|
||||||
geometry = models.LineStringField(blank=True, null=True)
|
geometry = models.LineStringField(blank=True, null=True)
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
@ -70,13 +74,16 @@ class Fare(models.Model):
|
||||||
|
|
||||||
class Stop(models.Model):
|
class Stop(models.Model):
|
||||||
code = models.IntegerField()
|
code = models.IntegerField()
|
||||||
|
slug = models.SlugField(null=True)
|
||||||
name = models.TextField(blank=True, max_length=255)
|
name = models.TextField(blank=True, max_length=255)
|
||||||
|
display_name = models.TextField(blank=True, max_length=255)
|
||||||
dbdirection = models.CharField(null=True, blank=True, max_length=5, choices=STOP_CHOICES) #stopfl - > direction
|
dbdirection = models.CharField(null=True, blank=True, max_length=5, choices=STOP_CHOICES) #stopfl - > direction
|
||||||
chowki = models.NullBooleanField(null=True, blank=True) # this is nullable since in the next datafeed , they might have blank to represent a 0.
|
chowki = models.NullBooleanField(null=True, blank=True) # this is nullable since in the next datafeed , they might have blank to represent a 0.
|
||||||
road = models.ForeignKey(Road, default=None, null=True, blank=True)
|
road = models.ForeignKey(Road, default=None, null=True, blank=True)
|
||||||
area = models.ForeignKey(Area, default=None, null=True, blank=True)
|
area = models.ForeignKey(Area, default=None, null=True, blank=True)
|
||||||
depot = models.ForeignKey("Depot", default=None, null=True, blank=True, related_name="is_depot_for") #models.CharField(null=True, blank=True, max_length=5)
|
depot = models.ForeignKey("Depot", default=None, null=True, blank=True, related_name="is_depot_for") #models.CharField(null=True, blank=True, max_length=5)
|
||||||
name_mr= models.TextField(null=True, blank=True, max_length=512)#null=True,
|
name_mr= models.TextField(null=True, blank=True, max_length=512)#null=True,
|
||||||
|
|
||||||
point = models.PointField(null=True)
|
point = models.PointField(null=True)
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
@ -84,6 +91,7 @@ class Stop(models.Model):
|
||||||
|
|
||||||
class Route(models.Model):
|
class Route(models.Model):
|
||||||
code = models.TextField(max_length=255, unique=True)
|
code = models.TextField(max_length=255, unique=True)
|
||||||
|
slug = models.SlugField(null=True)
|
||||||
alias = models.TextField(max_length=255)
|
alias = models.TextField(max_length=255)
|
||||||
from_stop_txt = models.TextField(max_length=500)
|
from_stop_txt = models.TextField(max_length=500)
|
||||||
to_stop_txt = models.TextField(max_length=500)
|
to_stop_txt = models.TextField(max_length=500)
|
||||||
|
@ -120,6 +128,9 @@ class UniqueRoute(models.Model):
|
||||||
distance = models.FloatField(blank=True, null=True)
|
distance = models.FloatField(blank=True, null=True)
|
||||||
is_full = models.BooleanField()
|
is_full = models.BooleanField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = 'Atlas'
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return "%s: %s to %s" % (self.route.alias, self.from_stop_txt, self.to_stop_txt)
|
return "%s: %s to %s" % (self.route.alias, self.from_stop_txt, self.to_stop_txt)
|
||||||
|
|
||||||
|
@ -176,9 +187,11 @@ class HardCodedRoute(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class Landmark(models.Model):
|
class Landmark(models.Model):
|
||||||
|
slug = models.SlugField(null=True)
|
||||||
name = models.TextField(max_length=500, blank=True, null=True)
|
name = models.TextField(max_length=500, blank=True, null=True)
|
||||||
stops = models.ManyToManyField(Stop, related_name='is_near_to')
|
stops = models.ManyToManyField(Stop, related_name='is_near_to', blank=True)
|
||||||
name_mr = models.TextField(max_length=512, blank=True, null=True)
|
name_mr = models.TextField(max_length=512, blank=True, null=True)
|
||||||
|
display_name = models.TextField(blank=True, max_length=255)
|
||||||
point = models.PointField(blank=True, null=True)
|
point = models.PointField(blank=True, null=True)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
|
|
|
@ -2,5 +2,6 @@
|
||||||
#-e svn+http://code.djangoproject.com/svn/django/trunk/#egg=django
|
#-e svn+http://code.djangoproject.com/svn/django/trunk/#egg=django
|
||||||
-e bzr+http://code.0x2620.org/python-ox/#egg=python-ox
|
-e bzr+http://code.0x2620.org/python-ox/#egg=python-ox
|
||||||
-e git+git://github.com/seatgeek/fuzzywuzzy.git#egg=fuzzywuzzy
|
-e git+git://github.com/seatgeek/fuzzywuzzy.git#egg=fuzzywuzzy
|
||||||
django_extensions
|
-e git+git://github.com/bit/django-extensions.git#egg=django_extensions
|
||||||
|
#django_extensions
|
||||||
django-grappelli
|
django-grappelli
|
||||||
|
|
43
sqldiff/sqldiff070212.sql
Normal file
43
sqldiff/sqldiff070212.sql
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
BEGIN;
|
||||||
|
ALTER TABLE "mumbai_area"
|
||||||
|
ADD "display_name" text;
|
||||||
|
ALTER TABLE "mumbai_area"
|
||||||
|
ADD "slug" varchar(50);
|
||||||
|
CREATE INDEX "mumbai_area_slug_idx"
|
||||||
|
ON "mumbai_area" ("slug");
|
||||||
|
-- Comment: Unknown database type for field 'geometry' (16394)
|
||||||
|
-- Model: Road
|
||||||
|
ALTER TABLE "mumbai_road"
|
||||||
|
ADD "display_name" text;
|
||||||
|
ALTER TABLE "mumbai_road"
|
||||||
|
ADD "slug" varchar(50);
|
||||||
|
CREATE INDEX "mumbai_road_slug_idx"
|
||||||
|
ON "mumbai_road" ("slug");
|
||||||
|
-- Comment: Unknown database type for field 'geometry' (16394)
|
||||||
|
-- Model: Stop
|
||||||
|
ALTER TABLE "mumbai_stop"
|
||||||
|
ADD "display_name" text;
|
||||||
|
ALTER TABLE "mumbai_stop"
|
||||||
|
ADD "slug" varchar(50);
|
||||||
|
CREATE INDEX "mumbai_stop_slug_idx"
|
||||||
|
ON "mumbai_stop" ("slug");
|
||||||
|
-- Comment: Unknown database type for field 'point' (16394)
|
||||||
|
-- Model: Route
|
||||||
|
ALTER TABLE "mumbai_route"
|
||||||
|
ADD "slug" varchar(50);
|
||||||
|
CREATE INDEX "mumbai_route_slug_idx"
|
||||||
|
ON "mumbai_route" ("slug");
|
||||||
|
-- Model: RouteDetail
|
||||||
|
--ALTER TABLE "mumbai_routedetail"
|
||||||
|
-- ADD "route_code" text;
|
||||||
|
-- Model: Landmark
|
||||||
|
ALTER TABLE "mumbai_landmark"
|
||||||
|
ADD "display_name" text;
|
||||||
|
ALTER TABLE "mumbai_landmark"
|
||||||
|
ADD "slug" varchar(50);
|
||||||
|
CREATE INDEX "mumbai_landmark_slug_idx"
|
||||||
|
ON "mumbai_landmark" ("slug");
|
||||||
|
-- Comment: Unknown database type for field 'point' (16394)
|
||||||
|
-- Model: StopLocation
|
||||||
|
-- Comment: Unknown database type for field 'point' (16394)
|
||||||
|
COMMIT;
|
Loading…
Reference in New Issue
Block a user