##// END OF EJS Templates
Remove file after the attachment was removed
Remove file after the attachment was removed

File last commit:

r1701:99ec870f default
r1784:3a4fbe6e default
Show More
alias.py
32 lines | 1.1 KiB | text/x-python | PythonLexer
from django.db import transaction
from django.shortcuts import render, redirect
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_protect
from boards.abstracts.settingsmanager import get_settings_manager, \
SETTING_USERNAME, SETTING_LAST_NOTIFICATION_ID, SETTING_IMAGE_VIEWER
from boards.middlewares import SESSION_TIMEZONE
from boards.views.base import BaseBoardView, CONTEXT_FORM
from boards.forms import SettingsForm, PlainErrorList
from boards import settings
from boards.models import Attachment
CONTEXT_IMAGE_ALIASES = 'image_aliases'
TEMPLATE = 'boards/aliases.html'
class AliasesView(BaseBoardView):
@method_decorator(csrf_protect)
def get(self, request, category):
params = dict()
settings_manager = get_settings_manager(request)
selected_theme = settings_manager.get_theme()
params[CONTEXT_IMAGE_ALIASES] = Attachment.objects.exclude(alias='')\
.exclude(alias=None).filter(alias__startswith=(category + '/'))
return render(request, TEMPLATE, params)