예제 #1
0
"""Views for Objectapp authors"""
from django.shortcuts import get_object_or_404
from django.views.generic.list_detail import object_list

from objectapp.models import Author
from objectapp.settings import PAGINATION
from objectapp.views.decorators import update_queryset
from objectapp.views.decorators import template_name_for_gbobject_queryset_filtered


author_list = update_queryset(object_list, Author.published.all)


def author_detail(request, username, page=None, **kwargs):
    """Display the gbobjects of an author"""
    extra_context = kwargs.pop('extra_context', {})

    author = get_object_or_404(Author, username=username)
    if not kwargs.get('template_name'):
        kwargs['template_name'] = template_name_for_gbobject_queryset_filtered(
            'author', author.username)

    extra_context.update({'author': author})
    kwargs['extra_context'] = extra_context

    return object_list(request, queryset=author.gbobjects_published(),
                       paginate_by=PAGINATION, page=page,
                       **kwargs)
예제 #2
0
"""Views for Objectapp gbobjects"""
from django.shortcuts import redirect
from django.shortcuts import get_object_or_404
from django.views.generic.list_detail import object_list
from django.views.generic.date_based import archive_year
from django.views.generic.date_based import archive_month
from django.views.generic.date_based import archive_day
from django.views.generic.date_based import object_detail

from objectapp.models import Gbobject
from objectapp.views.decorators import protect_gbobject
from objectapp.views.decorators import update_queryset


gbobject_index = update_queryset(object_list, Gbobject.published.all)

gbobject_year = update_queryset(archive_year, Gbobject.published.all)

gbobject_month = update_queryset(archive_month, Gbobject.published.all)

gbobject_day = update_queryset(archive_day, Gbobject.published.all)

gbobject_detail = protect_gbobject(object_detail)


def gbobject_shortlink(request, object_id):
    """
    Redirect to the 'get_absolute_url' of an Gbobject,
    accordingly to 'object_id' argument
    """
    gbobject = get_object_or_404(Gbobject, pk=object_id)
예제 #3
0
파일: authors.py 프로젝트: PhiTheta/ISON
#     You should have received a copy of the GNU Affero General Public License
#     along with this program.  If not, see <http://www.gnu.org/licenses/>.


"""Views for Objectapp authors"""
from django.shortcuts import get_object_or_404
from django.views.generic.list_detail import object_list

from objectapp.models import Author
from objectapp.settings import PAGINATION
from objectapp.views.decorators import update_queryset
from objectapp.views.decorators import template_name_for_gbobject_queryset_filtered


author_list = update_queryset(object_list, Author.published.all)


def author_detail(request, username, page=None, **kwargs):
    """Display the gbobjects of an author"""
    extra_context = kwargs.pop('extra_context', {})

    author = get_object_or_404(Author, username=username)
    if not kwargs.get('template_name'):
        kwargs['template_name'] = template_name_for_gbobject_queryset_filtered(
            'author', author.username)

    extra_context.update({'author': author})
    kwargs['extra_context'] = extra_context

    return object_list(request, queryset=author.gbobjects_published(),
예제 #4
0
#     You should have received a copy of the GNU Affero General Public License
#     along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Views for Objectapp gbobjects"""
from django.shortcuts import redirect
from django.shortcuts import get_object_or_404
from django.views.generic.list_detail import object_list
from django.views.generic.date_based import archive_year
from django.views.generic.date_based import archive_month
from django.views.generic.date_based import archive_day
from django.views.generic.date_based import object_detail

from objectapp.models import Gbobject
from objectapp.views.decorators import protect_gbobject
from objectapp.views.decorators import update_queryset

gbobject_index = update_queryset(object_list, Gbobject.published.all)

gbobject_year = update_queryset(archive_year, Gbobject.published.all)

gbobject_month = update_queryset(archive_month, Gbobject.published.all)

gbobject_day = update_queryset(archive_day, Gbobject.published.all)

gbobject_detail = protect_gbobject(object_detail)


def gbobject_shortlink(request, object_id):
    """
    Redirect to the 'get_absolute_url' of an Gbobject,
    accordingly to 'object_id' argument
    """