Added DCMeta - EAV based application to represent document meta-data. Started to...
[redakcja.git] / apps / newwiki / views.py
1 from django.conf import settings
2
3 from django import http
4
5 # Views
6 from django.views.generic.simple import direct_to_template
7
8 # Decorators
9 from django.contrib.auth.decorators import login_required
10 from django.views.decorators.http import require_POST, require_GET
11 from django.views.decorators.cache import never_cache
12
13 # Models
14 from django.contrib.contenttypes.models import ContentType
15 from dvcs.models import Document
16 from dcmeta.models import Description
17
18 @never_cache
19 def document_list(request):
20     return direct_to_template(request,
21         'wiki/document_list.html', extra_context={
22         'docs': Document.objects.all(),
23     })
24
25
26 @never_cache
27 def editor(request, document_id, template_name='wiki/document_details.html'):
28
29     try:
30         doc = Document.objects.get(pk=document_id)
31     except Document.DoesNotExist:
32         raise http.Http404
33
34     meta_data = Description.objects.get(object_id=document_id,
35                                         content_type=ContentType.objects.get_for_model(doc))
36
37     return direct_to_template(request, template_name, extra_context={
38         'document': doc,
39         'document_name': doc.name,
40         'document_info': meta_data,
41         'document_meta': meta_data,
42 #        'forms': {
43 #            "text_save": DocumentTextSaveForm(prefix="textsave"),
44 #            "add_tag": DocumentTagForm(prefix="addtag"),
45 #        },
46     })