# Path: basic_cms/testproj/documents/models.py
# class Document(models.Model):
#     "A dummy model used to illsutrate the use of linked models in django-page-cms"
# 
#     title = models.CharField(_('title'), max_length=100, blank=False)
#     text = models.TextField(_('text'), blank=True)
# 
#     # the foreign key _must_ be called page
#     page = models.ForeignKey(Page)


from django.template import RequestContext
from django.shortcuts import render_to_response
from basic_cms.testproj.documents.models import Document


def document_view(request, *args, **kwargs):
    context = kwargs
    if kwargs.get('current_page', False):
        documents = Document.objects.filter(page=kwargs['current_page'])
        context['documents'] = documents
    if 'document_id' in kwargs:

# Path: basic_cms/testproj/documents/models.py
# class Document(models.Model):
#     "A dummy model used to illsutrate the use of linked models in django-page-cms"
# 
#     title = models.CharField(_('title'), max_length=100, blank=False)
#     text = models.TextField(_('text'), blank=True)
# 
#     # the foreign key _must_ be called page
#     page = models.ForeignKey(Page)


# Path: basic_cms/testproj/documents/views.py
from django.template import RequestContext
from django.shortcuts import render_to_response
from basic_cms.testproj.documents.models import Document



def document_view(request, *args, **kwargs):
    context = kwargs
    if kwargs.get('current_page', False):
        documents = Document.objects.filter(page=kwargs['current_page'])
        context['documents'] = documents
    if 'document_id' in kwargs:

        document = Document.objects.get(pk=int(kwargs['document_id']))