26 lines
738 B
Python
26 lines
738 B
Python
# Create your views here.
|
|
from django.template import RequestContext
|
|
from django.shortcuts import render_to_response
|
|
from django.contrib.contenttypes.models import ContentType
|
|
|
|
def index(request):
|
|
context = RequestContext(request, {})
|
|
return render_to_response("index.html", context)
|
|
|
|
def edit(request, ctype_id):
|
|
ctypes = []
|
|
|
|
for c in ContentType.objects.all():
|
|
if hasattr(c.model_class(), 'is_openmumbai_model'):
|
|
ctypes.append(c)
|
|
|
|
try:
|
|
content_type_id = int(ctype_id)
|
|
except:
|
|
content_type_id = ctypes[0].id
|
|
|
|
context = RequestContext(request, {
|
|
'ctypes': ctypes,
|
|
'content_type_id': content_type_id
|
|
})
|
|
return render_to_response("edit.html", context)
|