src/p4l/views.py
changeset 92 57633a3acc4f
parent 78 1d45a564a398
child 93 c675183a9325
equal deleted inserted replaced
91:3120bf6cd1e8 92:57633a3acc4f
     4 
     4 
     5 @author: tc
     5 @author: tc
     6 '''
     6 '''
     7 
     7 
     8 from django.conf import settings
     8 from django.conf import settings
     9 from django.views.generic import ListView, DetailView
     9 from django.views.generic import ListView, DetailView, View
       
    10 from django.shortcuts import redirect, get_object_or_404
    10 from p4l.forms import RecordFilterForm
    11 from p4l.forms import RecordFilterForm
    11 from p4l.models import Record
    12 from p4l.models import Record
    12 from p4l.utils import get_labels_for_uris
    13 from p4l.utils import get_labels_for_uris
    13 import json
    14 import json
    14 import logging
    15 import logging
   181         
   182         
   182         # Languages list used in drop down list
   183         # Languages list used in drop down list
   183         context['languages_list'] = json.dumps(settings.LANGUAGES_LIST)
   184         context['languages_list'] = json.dumps(settings.LANGUAGES_LIST)
   184                 
   185                 
   185         return context
   186         return context
       
   187 
       
   188 
       
   189 class RecordDeleteView(View):
       
   190     def get(self, request, slug, **kwargs):
       
   191         rec = get_object_or_404(Record, identifier=slug)
       
   192         rec.delete()
       
   193         return redirect('p4l_home')
   186         
   194         
   187