mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 15:21:52 +00:00
quick hack to make work in django1.0 Photo to DPhoto
This commit is contained in:
parent
c66b5e2dad
commit
0ea70273fe
@ -44,7 +44,7 @@ class QMsFoundInline(admin.TabularInline):
|
||||
extra=1
|
||||
|
||||
class PhotoInline(admin.TabularInline):
|
||||
model = Photo
|
||||
model = DPhoto
|
||||
exclude = ['is_mugshot' ]
|
||||
extra = 1
|
||||
|
||||
@ -104,7 +104,7 @@ class CaveAdmin(TroggleModelAdmin):
|
||||
class EntranceAdmin(TroggleModelAdmin):
|
||||
search_fields = ('caveandentrance__cave__kataster_number',)
|
||||
|
||||
admin.site.register(Photo)
|
||||
admin.site.register(DPhoto)
|
||||
admin.site.register(Cave, CaveAdmin)
|
||||
admin.site.register(Area)
|
||||
#admin.site.register(OtherCaveName)
|
||||
@ -136,5 +136,5 @@ def export_as_xml(modeladmin, request, queryset):
|
||||
serializers.serialize("xml", queryset, stream=response)
|
||||
return response
|
||||
|
||||
admin.site.add_action(export_as_xml)
|
||||
admin.site.add_action(export_as_json)
|
||||
#admin.site.add_action(export_as_xml)
|
||||
#admin.site.add_action(export_as_json)
|
@ -531,7 +531,7 @@ class QM(TroggleModel):
|
||||
return u"%s%s%s" % ('[[QM:',self.code(),']]')
|
||||
|
||||
photoFileStorage = FileSystemStorage(location=settings.PHOTOS_ROOT, base_url=settings.PHOTOS_URL)
|
||||
class Photo(TroggleImageModel):
|
||||
class DPhoto(TroggleImageModel):
|
||||
caption = models.CharField(max_length=1000,blank=True,null=True)
|
||||
contains_logbookentry = models.ForeignKey(LogbookEntry,blank=True,null=True)
|
||||
contains_person = models.ManyToManyField(Person,blank=True,null=True)
|
||||
|
@ -3,7 +3,7 @@ from django.utils.html import conditional_escape
|
||||
from django.template.defaultfilters import stringfilter
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.conf import settings
|
||||
from core.models import QM, Photo, LogbookEntry, Cave
|
||||
from core.models import QM, DPhoto, LogbookEntry, Cave
|
||||
import re, urlparse
|
||||
|
||||
register = template.Library()
|
||||
@ -122,7 +122,7 @@ def wiki_to_html_short(value, autoescape=None):
|
||||
linkText=None
|
||||
|
||||
try:
|
||||
photo=Photo.objects.get(file=matchdict['photoName'])
|
||||
photo=DPhoto.objects.get(file=matchdict['photoName'])
|
||||
if not linkText:
|
||||
linkText=str(photo)
|
||||
res=r'<a href=' + photo.get_admin_url() +'>' + linkText + '</a>'
|
||||
|
@ -10,7 +10,8 @@ from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponseRedirect
|
||||
|
||||
# Django uses Context, not RequestContext when you call render_to_response. We always want to use RequestContext, so that django adds the context from settings.TEMPLATE_CONTEXT_PROCESSORS. This way we automatically get necessary settings variables passed to each template. So we use a custom method, render_response instead of render_to_response. Hopefully future Django releases will make this unnecessary.
|
||||
from troggle.alwaysUseRequestContext import render_response
|
||||
from django.shortcuts import render_to_response as render_response
|
||||
#from troggle.alwaysUseRequestContext import render_response
|
||||
|
||||
import re
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from troggle.core.models import Cave, Expedition, Person, LogbookEntry, PersonExpedition, PersonTrip, Photo, QM
|
||||
from troggle.core.models import Cave, Expedition, Person, LogbookEntry, PersonExpedition, PersonTrip, DPhoto, QM
|
||||
from django.conf import settings
|
||||
from django import forms
|
||||
from django.template import loader, Context
|
||||
@ -28,7 +28,7 @@ def frontpage(request):
|
||||
expeditions = Expedition.objects.order_by("-year")
|
||||
logbookentry = LogbookEntry
|
||||
cave = Cave
|
||||
photo = Photo
|
||||
photo = DPhoto
|
||||
from django.contrib.admin.templatetags import log
|
||||
return render_with_context(request,'frontpage.html', locals())
|
||||
|
||||
|
2
urls.py
2
urls.py
@ -67,7 +67,7 @@ urlpatterns = patterns('',
|
||||
url(r'^eyecandy$', views_other.eyecandy),
|
||||
|
||||
(r'^admin/doc/?', include('django.contrib.admindocs.urls')),
|
||||
(r'^admin/', include(admin.site.urls)),
|
||||
#(r'^admin/', include(admin.site.urls)),
|
||||
|
||||
(r'^accounts/', include('registration.urls')),
|
||||
(r'^profiles/', include('profiles.urls')),
|
||||
|
Loading…
Reference in New Issue
Block a user