def language_detail(request, language_code = None, template_name = 'lanpro/language/detail.html'): """ Display the language details """ # Initialize the context context = RequestContext(request) # Get the language context['language'] = get_object_or_404(Language, code = language_code) # The absolute url to add a new language context['url_add'] = Language.objects.get_absolute_add_url() if request.POST: # Posting data if 'catalog_upload_form' in request.POST: # Uploading a catalog file context.update(process_catalog_upload_form(request)) # Render the response return render_to_response(template_name, context)
def language_list(request, filter = None, template_name = 'lanpro/language/list.html'): """ Prepare a list of all languages """ # Initialize the context context = RequestContext(request) # The absolute url to add a new language context['url_add'] = Language.objects.get_absolute_add_url() # Check the request if request.POST: # Posting data if 'catalog_upload_form' in request.POST: # Uploading a catalog file context.update(process_catalog_upload_form(request)) # Check permissions if request.user.has_perm('lanpro.change_language'): if filter == 'all': context['languages_list'] = Language.objects.select_related() elif filter == 'active': context['languages_list'] = Language.objects.select_related().active() # Render the response return render_to_response(template_name, context)