forked from expo/troggle
quick hack to make work in django1.0 Photo to DPhoto
This commit is contained in:
parent
e4496e4cd8
commit
20eac2d04b
@ -44,7 +44,7 @@ class QMsFoundInline(admin.TabularInline):
|
|||||||
extra=1
|
extra=1
|
||||||
|
|
||||||
class PhotoInline(admin.TabularInline):
|
class PhotoInline(admin.TabularInline):
|
||||||
model = Photo
|
model = DPhoto
|
||||||
exclude = ['is_mugshot' ]
|
exclude = ['is_mugshot' ]
|
||||||
extra = 1
|
extra = 1
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ class CaveAdmin(TroggleModelAdmin):
|
|||||||
class EntranceAdmin(TroggleModelAdmin):
|
class EntranceAdmin(TroggleModelAdmin):
|
||||||
search_fields = ('caveandentrance__cave__kataster_number',)
|
search_fields = ('caveandentrance__cave__kataster_number',)
|
||||||
|
|
||||||
admin.site.register(Photo)
|
admin.site.register(DPhoto)
|
||||||
admin.site.register(Cave, CaveAdmin)
|
admin.site.register(Cave, CaveAdmin)
|
||||||
admin.site.register(Area)
|
admin.site.register(Area)
|
||||||
#admin.site.register(OtherCaveName)
|
#admin.site.register(OtherCaveName)
|
||||||
@ -136,5 +136,5 @@ def export_as_xml(modeladmin, request, queryset):
|
|||||||
serializers.serialize("xml", queryset, stream=response)
|
serializers.serialize("xml", queryset, stream=response)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
admin.site.add_action(export_as_xml)
|
#admin.site.add_action(export_as_xml)
|
||||||
admin.site.add_action(export_as_json)
|
#admin.site.add_action(export_as_json)
|
@ -531,7 +531,7 @@ class QM(TroggleModel):
|
|||||||
return u"%s%s%s" % ('[[QM:',self.code(),']]')
|
return u"%s%s%s" % ('[[QM:',self.code(),']]')
|
||||||
|
|
||||||
photoFileStorage = FileSystemStorage(location=settings.PHOTOS_ROOT, base_url=settings.PHOTOS_URL)
|
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)
|
caption = models.CharField(max_length=1000,blank=True,null=True)
|
||||||
contains_logbookentry = models.ForeignKey(LogbookEntry,blank=True,null=True)
|
contains_logbookentry = models.ForeignKey(LogbookEntry,blank=True,null=True)
|
||||||
contains_person = models.ManyToManyField(Person,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.template.defaultfilters import stringfilter
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from core.models import QM, Photo, LogbookEntry, Cave
|
from core.models import QM, DPhoto, LogbookEntry, Cave
|
||||||
import re, urlparse
|
import re, urlparse
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
@ -122,7 +122,7 @@ def wiki_to_html_short(value, autoescape=None):
|
|||||||
linkText=None
|
linkText=None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
photo=Photo.objects.get(file=matchdict['photoName'])
|
photo=DPhoto.objects.get(file=matchdict['photoName'])
|
||||||
if not linkText:
|
if not linkText:
|
||||||
linkText=str(photo)
|
linkText=str(photo)
|
||||||
res=r'<a href=' + photo.get_admin_url() +'>' + linkText + '</a>'
|
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
|
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.
|
# 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
|
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.conf import settings
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.template import loader, Context
|
from django.template import loader, Context
|
||||||
@ -28,7 +28,7 @@ def frontpage(request):
|
|||||||
expeditions = Expedition.objects.order_by("-year")
|
expeditions = Expedition.objects.order_by("-year")
|
||||||
logbookentry = LogbookEntry
|
logbookentry = LogbookEntry
|
||||||
cave = Cave
|
cave = Cave
|
||||||
photo = Photo
|
photo = DPhoto
|
||||||
from django.contrib.admin.templatetags import log
|
from django.contrib.admin.templatetags import log
|
||||||
return render_with_context(request,'frontpage.html', locals())
|
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),
|
url(r'^eyecandy$', views_other.eyecandy),
|
||||||
|
|
||||||
(r'^admin/doc/?', include('django.contrib.admindocs.urls')),
|
(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'^accounts/', include('registration.urls')),
|
||||||
(r'^profiles/', include('profiles.urls')),
|
(r'^profiles/', include('profiles.urls')),
|
||||||
|
Loading…
Reference in New Issue
Block a user