# Copyright 2010, 2011 Andrew Glen-Young
# 
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#    http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


from django.conf import settings
from django.conf.urls.defaults import *
from django.views.generic import list_detail

from jumpsuit.core.models import Release

urlpatterns = patterns('',
    url(r'^add/?$', 'web.views.add_release',
            name='jumpsuit_release_add'),
    url(r'^(?P<release>[a-z0-9]+[a-z0-9\-]*)/delete/?$', 'web.views.delete_release',
            name='jumpsuit_release_delete'),
    url(r'^(?P<release>[a-z0-9]+[a-z0-9\-]*)/edit/?$', 'web.views.edit_release',
            name='jumpsuit_release_edit'),
    url(r'^(?P<slug>[a-z0-9]+[a-z0-9\-]*)/(?:list/)?$', list_detail.object_detail,
        {'queryset': Release.objects.select_related(),
         'slug_field': 'name',
         'template_name': 'releases/detail.html',
         'extra_context': {'state': 'release'},
        },
        name='jumpsuit_release_detail'),
    url(r'^(?:list/)?$', list_detail.object_list,
        {'queryset': Release.objects.select_related(),
         'paginate_by': getattr(settings, 'PAGINATION_NUMBER,', 20),
         'template_name': 'releases/list.html',
         'extra_context': {'state': 'release'},
        },
        name='jumpsuit_release_list'),
)
