Finished converting grouping app to the linking app
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from grouping.models import DocumentGroup, DocumentGroupItem
|
||||
|
||||
|
||||
class DocumentGroupItemInline(admin.StackedInline):
|
||||
model = DocumentGroupItem
|
||||
extra = 1
|
||||
classes = ('collapse-open',)
|
||||
allow_add = True
|
||||
|
||||
|
||||
class DocumentGroupAdmin(admin.ModelAdmin):
|
||||
inlines = [DocumentGroupItemInline]
|
||||
|
||||
admin.site.register(DocumentGroup, DocumentGroupAdmin)
|
||||
@@ -1,11 +0,0 @@
|
||||
"""Configuration options for the grouping app"""
|
||||
|
||||
from smart_settings.api import register_settings
|
||||
|
||||
register_settings(
|
||||
namespace=u'grouping',
|
||||
module=u'grouping.conf.settings',
|
||||
settings=[
|
||||
{'name': u'SHOW_EMPTY_GROUPS', 'global_name': u'GROUPING_SHOW_EMPTY_GROUPS', 'default': True},
|
||||
]
|
||||
)
|
||||
@@ -6,14 +6,14 @@ from project_setup.api import register_setup
|
||||
from documents.literals import PERMISSION_DOCUMENT_VIEW
|
||||
from documents.models import Document
|
||||
|
||||
from grouping.models import DocumentGroup, DocumentGroupItem
|
||||
from linking.models import SmartLink, SmartLinkCondition
|
||||
|
||||
PERMISSION_SMART_LINK_VIEW = {'namespace': 'grouping', 'name': 'group_view', 'label': _(u'View existing smart links')}
|
||||
PERMISSION_SMART_LINK_CREATE = {'namespace': 'grouping', 'name': 'group_create', 'label': _(u'Create new smart links')}
|
||||
PERMISSION_SMART_LINK_DELETE = {'namespace': 'grouping', 'name': 'group_delete', 'label': _(u'Delete smart links')}
|
||||
PERMISSION_SMART_LINK_EDIT = {'namespace': 'grouping', 'name': 'group_edit', 'label': _(u'Edit smart links')}
|
||||
PERMISSION_SMART_LINK_VIEW = {'namespace': 'linking', 'name': 'group_view', 'label': _(u'View existing smart links')}
|
||||
PERMISSION_SMART_LINK_CREATE = {'namespace': 'linking', 'name': 'group_create', 'label': _(u'Create new smart links')}
|
||||
PERMISSION_SMART_LINK_DELETE = {'namespace': 'linking', 'name': 'group_delete', 'label': _(u'Delete smart links')}
|
||||
PERMISSION_SMART_LINK_EDIT = {'namespace': 'linking', 'name': 'group_edit', 'label': _(u'Edit smart links')}
|
||||
|
||||
set_namespace_title('grouping', _(u'Smart links'))
|
||||
set_namespace_title('linking', _(u'Smart links'))
|
||||
register_permission(PERMISSION_SMART_LINK_VIEW)
|
||||
register_permission(PERMISSION_SMART_LINK_CREATE)
|
||||
register_permission(PERMISSION_SMART_LINK_DELETE)
|
||||
@@ -35,8 +35,8 @@ smart_link_condition_delete = {'text': _(u'delete'), 'view': 'smart_link_conditi
|
||||
|
||||
register_links(Document, [smart_link_instances_for_document], menu_name='form_header')
|
||||
|
||||
register_links(DocumentGroup, [document_group_edit, document_group_delete, smart_link_condition_list])
|
||||
register_links(DocumentGroupItem, [smart_link_condition_edit, smart_link_condition_delete])
|
||||
register_links(SmartLink, [document_group_edit, document_group_delete, smart_link_condition_list])
|
||||
register_links(SmartLinkCondition, [smart_link_condition_edit, smart_link_condition_delete])
|
||||
register_links(['document_group_list', 'document_group_create', 'document_group_edit', 'document_group_delete', 'smart_link_condition_list', 'smart_link_condition_create', 'smart_link_condition_edit', 'smart_link_condition_delete'], [document_group_list, document_group_create], menu_name='sidebar')
|
||||
register_links(['smart_link_condition_list', 'smart_link_condition_create', 'smart_link_condition_edit', 'smart_link_condition_delete'], [smart_link_condition_create], menu_name='sidebar')
|
||||
|
||||
16
apps/linking/admin.py
Normal file
16
apps/linking/admin.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from linking.models import SmartLink, SmartLinkCondition
|
||||
|
||||
|
||||
class SmartLinkConditionInline(admin.StackedInline):
|
||||
model = SmartLinkCondition
|
||||
extra = 1
|
||||
classes = ('collapse-open',)
|
||||
allow_add = True
|
||||
|
||||
|
||||
class SmartLinkAdmin(admin.ModelAdmin):
|
||||
inlines = [SmartLinkConditionInline]
|
||||
|
||||
admin.site.register(SmartLink, SmartLinkAdmin)
|
||||
13
apps/linking/conf/settings.py
Normal file
13
apps/linking/conf/settings.py
Normal file
@@ -0,0 +1,13 @@
|
||||
'''Configuration options for the linking app'''
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from smart_settings.api import register_settings
|
||||
|
||||
register_settings(
|
||||
namespace=u'linking',
|
||||
module=u'linking.conf.settings',
|
||||
settings=[
|
||||
{'name': u'SHOW_EMPTY_SMART_LINKS', 'global_name': u'LINKING_SHOW_EMPTY_SMART_LINKS', 'default': True, 'description': _(u'Show smart link that don\'t return any documents.')},
|
||||
]
|
||||
)
|
||||
@@ -8,18 +8,18 @@ from django.conf import settings
|
||||
|
||||
from tags.widgets import get_tags_inline_widget
|
||||
|
||||
from grouping.models import DocumentGroup, DocumentGroupItem
|
||||
from linking.models import SmartLink, SmartLinkCondition
|
||||
|
||||
|
||||
class SmartLinkForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = DocumentGroup
|
||||
model = SmartLink
|
||||
|
||||
|
||||
class SmartLinkConditionForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = DocumentGroupItem
|
||||
exclude = ('document_group',)
|
||||
model = SmartLinkCondition
|
||||
exclude = ('smart_link',)
|
||||
|
||||
|
||||
class SmartLinkImageWidget(forms.widgets.Widget):
|
||||
@@ -105,7 +105,9 @@ class SmartLinkInstanceForm(forms.Form):
|
||||
smart_link_instances = kwargs.pop('smart_link_instances', None)
|
||||
links = kwargs.pop('links', None)
|
||||
current_document = kwargs.pop('current_document', None)
|
||||
|
||||
super(SmartLinkInstanceForm, self).__init__(*args, **kwargs)
|
||||
|
||||
for smart_link_instance, data in smart_link_instances.items():
|
||||
self.fields['preview-%s' % smart_link_instance] = forms.CharField(
|
||||
widget=SmartLinkImageWidget(),
|
||||
@@ -4,13 +4,13 @@ from django.db.models import Q
|
||||
from metadata.classes import MetadataObject
|
||||
from documents.models import Document
|
||||
|
||||
from grouping.literals import INCLUSION_AND, INCLUSION_OR
|
||||
from linking.literals import INCLUSION_AND, INCLUSION_OR
|
||||
|
||||
|
||||
class SmartLinkManager(models.Manager):
|
||||
def get_groups_for(self, document, group_obj=None):
|
||||
def get_smart_link_instances_for(self, document, smart_link_obj=None):
|
||||
errors = []
|
||||
document_groups = {}
|
||||
result = {}
|
||||
metadata_dict = {}
|
||||
for document_metadata in document.documentmetadata_set.all():
|
||||
metadata_dict[document_metadata.metadata_type.name] = document_metadata.value
|
||||
@@ -18,38 +18,38 @@ class SmartLinkManager(models.Manager):
|
||||
eval_dict['document'] = document
|
||||
eval_dict['metadata'] = MetadataObject(metadata_dict)
|
||||
|
||||
if group_obj:
|
||||
groups_qs = self.model.objects.filter(Q(enabled=True) & Q(pk=group_obj.pk))
|
||||
if smart_link_obj:
|
||||
smart_link_qs = self.model.objects.filter(Q(enabled=True) & Q(pk=smart_link_obj.pk))
|
||||
else:
|
||||
groups_qs = self.model.objects.filter(enabled=True)
|
||||
smart_link_qs = self.model.objects.filter(enabled=True)
|
||||
|
||||
for group in groups_qs:
|
||||
for smart_link in smart_link_qs:
|
||||
total_query = Q()
|
||||
for item in group.documentgroupitem_set.filter(enabled=True):
|
||||
cls, attribute = item.foreign_document_data.lower().split(u'.')
|
||||
for condition in smart_link.smartlinkcondition_set.filter(enabled=True):
|
||||
cls, attribute = condition.foreign_document_data.lower().split(u'.')
|
||||
try:
|
||||
if cls == u'metadata':
|
||||
value_query = Q(**{'documentmetadata__value__%s' % item.operator: eval(item.expression, eval_dict)})
|
||||
if item.negated:
|
||||
value_query = Q(**{'documentmetadata__value__%s' % condition.operator: eval(condition.expression, eval_dict)})
|
||||
if condition.negated:
|
||||
query = (Q(documentmetadata__metadata_type__name=attribute) & ~value_query)
|
||||
else:
|
||||
query = (Q(documentmetadata__metadata_type__name=attribute) & value_query)
|
||||
if item.inclusion == INCLUSION_AND:
|
||||
if condition.inclusion == INCLUSION_AND:
|
||||
total_query &= query
|
||||
elif item.inclusion == INCLUSION_OR:
|
||||
elif condition.inclusion == INCLUSION_OR:
|
||||
total_query |= query
|
||||
|
||||
elif cls == u'document':
|
||||
value_query = Q(**{
|
||||
'%s__%s' % (attribute, item.operator): eval(item.expression, eval_dict)
|
||||
'%s__%s' % (attribute, condition.operator): eval(condition.expression, eval_dict)
|
||||
})
|
||||
if item.negated:
|
||||
if condition.negated:
|
||||
query = ~value_query
|
||||
else:
|
||||
query = value_query
|
||||
if item.inclusion == INCLUSION_AND:
|
||||
if condition.inclusion == INCLUSION_AND:
|
||||
total_query &= query
|
||||
elif item.inclusion == INCLUSION_OR:
|
||||
elif condition.inclusion == INCLUSION_OR:
|
||||
total_query |= query
|
||||
|
||||
except Exception, e:
|
||||
@@ -59,24 +59,24 @@ class SmartLinkManager(models.Manager):
|
||||
if total_query:
|
||||
try:
|
||||
document_qs = Document.objects.filter(total_query)
|
||||
document_groups[group] = {'documents': document_qs.order_by('file_filename') or []}
|
||||
result[smart_link] = {'documents': document_qs.order_by('file_filename') or []}
|
||||
except Exception, e:
|
||||
document_groups[group] = {'documents': []}
|
||||
result[smart_link] = {'documents': []}
|
||||
errors.append(e)
|
||||
else:
|
||||
document_groups[group] = {'documents': []}
|
||||
result[smart_link] = {'documents': []}
|
||||
|
||||
if group.dynamic_title:
|
||||
if smart_link.dynamic_title:
|
||||
try:
|
||||
document_groups[group]['title'] = eval(group.dynamic_title, eval_dict)
|
||||
result[smart_link]['title'] = eval(smart_link.dynamic_title, eval_dict)
|
||||
except Exception, e:
|
||||
document_groups[group]['title'] = 'Error; %s' % e
|
||||
result[smart_link]['title'] = 'Error; %s' % e
|
||||
else:
|
||||
document_groups[group]['title'] = group.title
|
||||
result[smart_link]['title'] = smart_link.title
|
||||
|
||||
if group_obj:
|
||||
if smart_link_obj:
|
||||
# Return a single group if documents even if there were
|
||||
# many matches
|
||||
return document_groups[group_obj], errors
|
||||
return result[smart_link_obj], errors
|
||||
|
||||
return document_groups, errors
|
||||
return result, errors
|
||||
@@ -1,12 +1,12 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from grouping.managers import SmartLinkManager
|
||||
from grouping.literals import OPERATOR_CHOICES, INCLUSION_AND, \
|
||||
from linking.managers import SmartLinkManager
|
||||
from linking.literals import OPERATOR_CHOICES, INCLUSION_AND, \
|
||||
INCLUSION_CHOICES
|
||||
|
||||
|
||||
class DocumentGroup(models.Model):
|
||||
class SmartLink(models.Model):
|
||||
title = models.CharField(max_length=96, verbose_name=_(u'title'))
|
||||
dynamic_title = models.CharField(blank=True, max_length=96, verbose_name=_(u'dynamic title'), help_text=_(u'This expression will be evaluated against the current selected document. The document metadata is available as variables `metadata` and document properties under the variable `document`.'))
|
||||
enabled = models.BooleanField(default=True, verbose_name=_(u'enabled'))
|
||||
@@ -21,13 +21,11 @@ class DocumentGroup(models.Model):
|
||||
verbose_name_plural = _(u'smart links')
|
||||
|
||||
|
||||
class DocumentGroupItem(models.Model):
|
||||
document_group = models.ForeignKey(DocumentGroup, verbose_name=_(u'smart link'))
|
||||
class SmartLinkCondition(models.Model):
|
||||
smart_link = models.ForeignKey(SmartLink, verbose_name=_(u'smart link'))
|
||||
inclusion = models.CharField(default=INCLUSION_AND, max_length=16, choices=INCLUSION_CHOICES, help_text=_(u'The inclusion is ignored for the first item.'))
|
||||
foreign_document_data = models.CharField(max_length=32, verbose_name=_(u'foreign document data'), help_text=_(u'This represents the metadata of all other documents. Available objects: `document.<attribute>` and `metadata.<metadata_type_name>`.'))
|
||||
operator = models.CharField(max_length=16, choices=OPERATOR_CHOICES)
|
||||
|
||||
#local_document_data = models.ForeignKey(MetadataType, related_name='metadata_type_local', verbose_name=_(u'local metadata'), help_text=_(u'This represents the metadata of the current document.'))
|
||||
expression = models.TextField(verbose_name=_(u'expression'), help_text=_(u'This expression will be evaluated against the current selected document. The document metadata is available as variables `metadata` and document properties under the variable `document`.'))
|
||||
negated = models.BooleanField(default=False, verbose_name=_(u'negated'), help_text=_(u'Inverts the logic of the operator.'))
|
||||
enabled = models.BooleanField(default=True, verbose_name=_(u'enabled'))
|
||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
@@ -1,6 +1,6 @@
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
urlpatterns = patterns('grouping.views',
|
||||
urlpatterns = patterns('linking.views',
|
||||
url(r'^action/$', 'smart_link_action', (), 'smart_link_action'),
|
||||
url(r'^document/(?P<document_id>\d+)/smart_link/(?P<smart_link_pk>\d+)/$', 'smart_link_instance_view', (), 'smart_link_instance_view'),
|
||||
url(r'^smart/for_document/(?P<document_id>\d+)/$', 'smart_link_instances_for_document', (), 'smart_link_instances_for_document'),
|
||||
@@ -13,12 +13,12 @@ from documents.views import document_list
|
||||
|
||||
from permissions.api import check_permissions
|
||||
|
||||
from grouping.models import DocumentGroup, DocumentGroupItem
|
||||
from grouping.conf.settings import SHOW_EMPTY_GROUPS
|
||||
from grouping.forms import (SmartLinkInstanceForm, SmartLinkForm,
|
||||
from linking.models import SmartLink, SmartLinkCondition
|
||||
from linking.conf.settings import SHOW_EMPTY_SMART_LINKS
|
||||
from linking.forms import (SmartLinkInstanceForm, SmartLinkForm,
|
||||
SmartLinkConditionForm)
|
||||
from grouping import smart_link_instance_view_link
|
||||
from grouping import (PERMISSION_SMART_LINK_VIEW,
|
||||
from linking import smart_link_instance_view_link
|
||||
from linking import (PERMISSION_SMART_LINK_VIEW,
|
||||
PERMISSION_SMART_LINK_CREATE, PERMISSION_SMART_LINK_DELETE,
|
||||
PERMISSION_SMART_LINK_EDIT)
|
||||
|
||||
@@ -39,8 +39,8 @@ def smart_link_instance_view(request, document_id, smart_link_pk):
|
||||
check_permissions(request.user, [PERMISSION_SMART_LINK_VIEW])
|
||||
|
||||
document = get_object_or_404(Document, pk=document_id)
|
||||
smart_link = get_object_or_404(DocumentGroup, pk=smart_link_pk)
|
||||
object_list, errors = DocumentGroup.objects.get_groups_for(document, smart_link)
|
||||
smart_link = get_object_or_404(SmartLink, pk=smart_link_pk)
|
||||
object_list, errors = SmartLink.objects.get_smart_link_instances_for(document, smart_link)
|
||||
|
||||
return document_list(
|
||||
request,
|
||||
@@ -59,13 +59,13 @@ def smart_link_instances_for_document(request, document_id):
|
||||
|
||||
subtemplates_list = []
|
||||
document = get_object_or_404(Document, pk=document_id)
|
||||
smart_link_instances, errors = DocumentGroup.objects.get_groups_for(document)
|
||||
smart_link_instances, errors = SmartLink.objects.get_smart_link_instances_for(document)
|
||||
if (request.user.is_staff or request.user.is_superuser) and errors:
|
||||
for error in errors:
|
||||
messages.warning(request, _(u'Smart link query error: %s' % error))
|
||||
|
||||
if not SHOW_EMPTY_GROUPS:
|
||||
#If GROUP_SHOW_EMPTY is False, remove empty groups from
|
||||
if not SHOW_EMPTY_SMART_LINKS:
|
||||
#If SHOW_EMPTY_SMART_LINKS is False, remove empty groups from
|
||||
#dictionary
|
||||
smart_link_instances = dict([(group, data) for group, data in smart_link_instances.items() if data['documents']])
|
||||
|
||||
@@ -103,7 +103,7 @@ def document_group_list(request):
|
||||
|
||||
return render_to_response('generic_list.html', {
|
||||
'title': _(u'smart links'),
|
||||
'object_list': DocumentGroup.objects.all(),
|
||||
'object_list': SmartLink.objects.all(),
|
||||
'extra_columns': [
|
||||
{'name': _(u'dynamic title'), 'attribute': 'dynamic_title'},
|
||||
{'name': _(u'enabled'), 'attribute': encapsulate(lambda x: two_state_template(x.enabled))},
|
||||
@@ -135,7 +135,7 @@ def document_group_create(request):
|
||||
def document_group_edit(request, smart_link_pk):
|
||||
check_permissions(request.user, [PERMISSION_SMART_LINK_EDIT])
|
||||
|
||||
smart_link = get_object_or_404(DocumentGroup, pk=smart_link_pk)
|
||||
smart_link = get_object_or_404(SmartLink, pk=smart_link_pk)
|
||||
|
||||
if request.method == 'POST':
|
||||
form = SmartLinkForm(request.POST, instance=smart_link)
|
||||
@@ -157,7 +157,7 @@ def document_group_edit(request, smart_link_pk):
|
||||
def document_group_delete(request, smart_link_pk):
|
||||
check_permissions(request.user, [PERMISSION_SMART_LINK_DELETE])
|
||||
|
||||
smart_link = get_object_or_404(DocumentGroup, pk=smart_link_pk)
|
||||
smart_link = get_object_or_404(SmartLink, pk=smart_link_pk)
|
||||
|
||||
next = request.POST.get('next', request.GET.get('next', request.META.get('HTTP_REFERER', '/')))
|
||||
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', '/')))
|
||||
@@ -187,11 +187,11 @@ def document_group_delete(request, smart_link_pk):
|
||||
def smart_link_condition_list(request, smart_link_pk):
|
||||
check_permissions(request.user, [PERMISSION_SMART_LINK_CREATE, PERMISSION_SMART_LINK_EDIT])
|
||||
|
||||
smart_link = get_object_or_404(DocumentGroup, pk=smart_link_pk)
|
||||
smart_link = get_object_or_404(SmartLink, pk=smart_link_pk)
|
||||
|
||||
return render_to_response('generic_list.html', {
|
||||
'title': _(u'conditions for smart link: %s') % smart_link,
|
||||
'object_list': smart_link.documentgroupitem_set.all(),
|
||||
'object_list': smart_link.smartlinkcondition_set.all(),
|
||||
'extra_columns': [
|
||||
{'name': _(u'enabled'), 'attribute': encapsulate(lambda x: two_state_template(x.enabled))},
|
||||
],
|
||||
@@ -205,16 +205,18 @@ def smart_link_condition_list(request, smart_link_pk):
|
||||
def smart_link_condition_create(request, smart_link_pk):
|
||||
check_permissions(request.user, [PERMISSION_SMART_LINK_CREATE, PERMISSION_SMART_LINK_EDIT])
|
||||
|
||||
smart_link = get_object_or_404(DocumentGroup, pk=smart_link_pk)
|
||||
smart_link = get_object_or_404(SmartLink, pk=smart_link_pk)
|
||||
|
||||
if request.method == 'POST':
|
||||
form = SmartLinkConditionForm(request.POST, initial={'document_group': smart_link})
|
||||
form = SmartLinkConditionForm(request.POST)
|
||||
if form.is_valid():
|
||||
smart_link_condition = form.save()
|
||||
messages.success(request, _(u'Smart link condition: "%s" created successfully.') % smart_link_condition)
|
||||
new_smart_link_condition = form.save(commit=False)
|
||||
new_smart_link_condition.smart_link = smart_link
|
||||
new_smart_link_condition.save()
|
||||
messages.success(request, _(u'Smart link condition: "%s" created successfully.') % new_smart_link_condition)
|
||||
return HttpResponseRedirect(reverse('smart_link_condition_list', args=[smart_link.pk]))
|
||||
else:
|
||||
form = SmartLinkConditionForm(initial={'document_group': smart_link})
|
||||
form = SmartLinkConditionForm(initial={'smart_link': smart_link})
|
||||
|
||||
return render_to_response('generic_form.html', {
|
||||
'form': form,
|
||||
@@ -227,7 +229,7 @@ def smart_link_condition_create(request, smart_link_pk):
|
||||
def smart_link_condition_edit(request, smart_link_condition_pk):
|
||||
check_permissions(request.user, [PERMISSION_SMART_LINK_CREATE, PERMISSION_SMART_LINK_EDIT])
|
||||
|
||||
smart_link_condition = get_object_or_404(DocumentGroupItem, pk=smart_link_condition_pk)
|
||||
smart_link_condition = get_object_or_404(SmartLinkCondition, pk=smart_link_condition_pk)
|
||||
|
||||
next = request.POST.get('next', request.GET.get('next', request.META.get('HTTP_REFERER', '/')))
|
||||
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', '/')))
|
||||
@@ -236,9 +238,9 @@ def smart_link_condition_edit(request, smart_link_condition_pk):
|
||||
form = SmartLinkConditionForm(request.POST, instance=smart_link_condition)
|
||||
if form.is_valid():
|
||||
new_smart_link_condition = form.save(commit=False)
|
||||
new_smart_link_condition.document_group = smart_link_condition.document_group
|
||||
new_smart_link_condition.smart_link = smart_link_condition.smart_link
|
||||
new_smart_link_condition.save()
|
||||
messages.success(request, _(u'Smart link condition: "%s" edited successfully.') % smart_link_condition)
|
||||
messages.success(request, _(u'Smart link condition: "%s" edited successfully.') % new_smart_link_condition)
|
||||
return HttpResponseRedirect(next)
|
||||
else:
|
||||
form = SmartLinkConditionForm(instance=smart_link_condition)
|
||||
@@ -249,7 +251,7 @@ def smart_link_condition_edit(request, smart_link_condition_pk):
|
||||
'next': next,
|
||||
'previous': previous,
|
||||
'condition': smart_link_condition,
|
||||
'smart_link': smart_link_condition.document_group,
|
||||
'smart_link': smart_link_condition.smart_link,
|
||||
'navigation_object_list': [
|
||||
{'object': 'smart_link', 'name': _(u'smart link')},
|
||||
{'object': 'condition', 'name': _(u'condition')}
|
||||
@@ -261,7 +263,7 @@ def smart_link_condition_edit(request, smart_link_condition_pk):
|
||||
def smart_link_condition_delete(request, smart_link_condition_pk):
|
||||
check_permissions(request.user, [PERMISSION_SMART_LINK_CREATE, PERMISSION_SMART_LINK_EDIT])
|
||||
|
||||
smart_link_condition = get_object_or_404(DocumentGroupItem, pk=smart_link_condition_pk)
|
||||
smart_link_condition = get_object_or_404(SmartLinkCondition, pk=smart_link_condition_pk)
|
||||
|
||||
next = request.POST.get('next', request.GET.get('next', request.META.get('HTTP_REFERER', '/')))
|
||||
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', '/')))
|
||||
@@ -280,7 +282,7 @@ def smart_link_condition_delete(request, smart_link_condition_pk):
|
||||
return render_to_response('generic_confirm.html', {
|
||||
'delete_view': True,
|
||||
'condition': smart_link_condition,
|
||||
'smart_link': smart_link_condition.document_group,
|
||||
'smart_link': smart_link_condition.smart_link,
|
||||
'navigation_object_list': [
|
||||
{'object': 'smart_link', 'name': _(u'smart link')},
|
||||
{'object': 'condition', 'name': _(u'condition')}
|
||||
@@ -153,7 +153,7 @@ INSTALLED_APPS = (
|
||||
'document_comments',
|
||||
'user_management',
|
||||
'documents',
|
||||
'grouping',
|
||||
'linking',
|
||||
'mptt',
|
||||
'document_indexing',
|
||||
'ocr',
|
||||
|
||||
2
urls.py
2
urls.py
@@ -21,7 +21,7 @@ urlpatterns = patterns('',
|
||||
(r'^user_management/', include('user_management.urls')),
|
||||
(r'^settings/', include('smart_settings.urls')),
|
||||
(r'^metadata/', include('metadata.urls')),
|
||||
(r'^grouping/', include('grouping.urls')),
|
||||
(r'^linking/', include('linking.urls')),
|
||||
(r'^document_indexing/', include('document_indexing.urls')),
|
||||
(r'^history/', include('history.urls')),
|
||||
(r'^converter/', include('converter.urls')),
|
||||
|
||||
Reference in New Issue
Block a user