a little better admin interface and cleaner code
This commit is contained in:
parent
3b3d544c9a
commit
3d0c79f68c
68
chaloBEST/admin.py
Normal file
68
chaloBEST/admin.py
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
from django import forms
|
||||||
|
from mumbai.models import *
|
||||||
|
|
||||||
|
class AreaAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ("a_code", "areanm")
|
||||||
|
|
||||||
|
|
||||||
|
class RoadAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ("roadcd","roadnm")
|
||||||
|
|
||||||
|
|
||||||
|
class FareAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ("slab","ordinary","limited","express","ac","ac_express")
|
||||||
|
|
||||||
|
|
||||||
|
class StopForm(forms.ModelForm):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = Stop
|
||||||
|
|
||||||
|
|
||||||
|
class StopAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ("stopcd","stopnm", "roadcd","a_code","stopfl","depot","chowki")
|
||||||
|
fieldsets = (
|
||||||
|
(None, {
|
||||||
|
'fields': ('stopnm', 'a_code', 'roadcd')
|
||||||
|
}),
|
||||||
|
('Advanced options', {
|
||||||
|
'classes': ('collapse',),
|
||||||
|
'fields': ('stopcd', 'chowki', 'depot')
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
form = StopForm
|
||||||
|
# For mapping widget
|
||||||
|
#formfield_overrides = {
|
||||||
|
# models.TextField: {'widget': RichTextEditorWidget},
|
||||||
|
#}
|
||||||
|
|
||||||
|
|
||||||
|
class RouteDetailsAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ("rno","stopsr","stopcd","stage","km")
|
||||||
|
|
||||||
|
|
||||||
|
class RouteAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ("routealias","route","from_stop","to_stop","distance","stages")
|
||||||
|
|
||||||
|
|
||||||
|
class RouteTypesAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ("routecode","routetype","faretype")
|
||||||
|
|
||||||
|
|
||||||
|
class HardCodedRoutesAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ("routecode","routealias","faretype")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.register(Area, AreaAdmin)
|
||||||
|
admin.site.register(Road, RoadAdmin)
|
||||||
|
admin.site.register(Fare,FareAdmin)
|
||||||
|
|
||||||
|
admin.site.register(Stop, StopAdmin)
|
||||||
|
admin.site.register(RouteDetails, RouteDetailsAdmin)
|
||||||
|
admin.site.register(Route, RouteAdmin)
|
||||||
|
|
||||||
|
admin.site.register(RouteTypes, RouteTypesAdmin)
|
||||||
|
admin.site.register(HardCodedRoutes, HardCodedRoutesAdmin)
|
||||||
|
|
Binary file not shown.
|
@ -19,5 +19,12 @@ def csvToJSON():
|
||||||
jsonFile = open(join(PROJECT_ROOT, "../db_csv_files/Atlas.json"), "w")
|
jsonFile = open(join(PROJECT_ROOT, "../db_csv_files/Atlas.json"), "w")
|
||||||
jsonFile.write(json.dumps(atlasDict, indent=2))
|
jsonFile.write(json.dumps(atlasDict, indent=2))
|
||||||
jsonFile.close()
|
jsonFile.close()
|
||||||
|
<<<<<<< TREE
|
||||||
|
|
||||||
|
def csvClean1():
|
||||||
|
atlasCSV = csv.reader(open(join(PROJECT_ROOT, "../db_csv_files/Atlas.csv"), "r"), delimiter="\t")
|
||||||
|
|
||||||
|
=======
|
||||||
|
|
||||||
|
|
||||||
|
>>>>>>> MERGE-SOURCE
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.contrib.gis.db import models
|
from django.contrib.gis.db import models
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django import forms
|
||||||
|
|
||||||
class Area(models.Model):
|
class Area(models.Model):
|
||||||
a_code = models.IntegerField(primary_key=True)
|
a_code = models.IntegerField(primary_key=True)
|
||||||
|
@ -92,39 +92,3 @@ class HardCodedRoutes(models.Model):
|
||||||
return self.routecode + " " +self.routealias
|
return self.routecode + " " +self.routealias
|
||||||
|
|
||||||
|
|
||||||
class AreaAdmin(admin.ModelAdmin):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class RoadAdmin(admin.ModelAdmin):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class FareAdmin(admin.ModelAdmin):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class StopAdmin(admin.ModelAdmin):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class RouteDetailsAdmin(admin.ModelAdmin):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class RouteAdmin(admin.ModelAdmin):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class RouteTypesAdmin(admin.ModelAdmin):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class HardCodedRoutesAdmin(admin.ModelAdmin):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Area, AreaAdmin)
|
|
||||||
admin.site.register(Road, RoadAdmin)
|
|
||||||
admin.site.register(Fare,FareAdmin)
|
|
||||||
|
|
||||||
admin.site.register(Stop, StopAdmin)
|
|
||||||
admin.site.register(RouteDetails, RouteDetailsAdmin)
|
|
||||||
admin.site.register(Route, RouteAdmin)
|
|
||||||
|
|
||||||
admin.site.register(RouteTypes, RouteTypesAdmin)
|
|
||||||
admin.site.register(HardCodedRoutes, HardCodedRoutesAdmin)
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user