Commits

Julian Moritz  committed 605a77e

some bugfixes in templates and admin

  • Participants
  • Parent commits b3b4ad1
  • Tags 0.2.10

Comments (0)

Files changed (7)

 NEWS = open(os.path.join(here, 'NEWS.txt')).read()
 
 
-version = '0.2.9'
+version = '0.2.10'
 
 install_requires = [
     'Django',

File src/photos/admin.py

 from django.template.loader import get_template
 from django.template import Context
 
-class BaseAdmin():
+class BaseAdmin(admin.ModelAdmin):
     def queryset(self, request):
-        qs = super(PhotoAdmin, self).queryset(request)
+        qs = super(BaseAdmin, self).queryset(request)
         if request.user.is_superuser:
             return qs
         return qs.filter(user=request.user)
         obj.user = request.user
         obj.save()
 
-class PhotoAdmin(admin.ModelAdmin, BaseAdmin):
+class PhotoAdmin(BaseAdmin):
     list_filter = ('display', 'timestamp_created', )
     list_display = ('name', 'display', 'timestamp_created', 'get_thumbnail', )
     date_hierarchy = 'timestamp_created'
 
 admin.site.register(Photo, PhotoAdmin)
 
-class AlbumAdmin(admin.ModelAdmin, BaseAdmin):
+class AlbumAdmin(BaseAdmin):
     list_filter = ('display', 'timestamp_created', )
     date_hierarchy = 'timestamp_created'
     description = _('Manage your galleries.')

File src/photos/templates/photos/admin_thumbnail.html

 {% load thumbnail %}
-<img src="{% thumbnail photo.photo 85x65 crop quality=50 %}" alt="{{ photo.name }}" />
+<img src="{% thumbnail photo.photo 100x60 crop quality=60 %}" alt="{{ photo.name }}" />

File src/photos/templates/photos/album_detail.html

 {% block title %}{{block.super}} - Album{% endblock %}
 
 {% block content %}
-<h1>Album from {{ album.user }}</h1>
+<h1>Album from {{ object.user }}</h1>
 
 <ul>
 {% for photo in object.get_photos %}

File src/photos/templates/photos/album_list.html

 {% block title %}{{block.super}} - List of Albums{% endblock %}
 
 {% block content %}
-{% if user %}
-<h1>List of albums for user {{user}}.</h1>
+{% if album_user %}
+<h1>List of albums for user {{ album_user }}.</h1>
 {% else %}
 <h1>List of albums</h1>
 {% endif %}

File src/photos/templates/photos/photo_list.html

 
 {% block content %}
 
-{% if user %}
-<h1>Photos from {{ user }}</h1>
+{% if photo_user %}
+<h1>Photos from {{ photo_user }}</h1>
 {% else %}
 <h1>Photos</h1> 
 {% endif %}

File src/photos/views.py

     elif username is not None:
         user = get_object_or_404(User, username=username)
         qs = qs.filter(user=user)
-        
+    
     if user:
         extra_context = kwargs.get('extra_context', {})
-        extra_context.update({'user': user})
+        extra_context.update({'album_user': user})
         kwargs.update({'extra_context': extra_context})
-        
+    
     return object_list(request, queryset=qs, *args, **kwargs)
 
 def photo_list(request, user_id=0, username=None, *args, **kwargs):
         
     if user:
         extra_context = kwargs.get('extra_context', {})
-        extra_context.update({'user': user})
+        extra_context.update({'photo_user': user})
         kwargs.update({'extra_context': extra_context})
     
     return object_list(request, queryset=qs, *args, **kwargs)