Example #1
0
def feed_list(request):
    tags = Tag.objects.all()
    return render_to_response('feeds/list.html', {'tags': tags},
                              context_instance=RequestContext(request))
Example #2
0
 def form_invalid(self, form):
     html = loader.render_to_string(self.template_name, 
                                    dictionary=self.get_context_data(form=form), 
                                    context_instance=RequestContext(self.request))
     json = simplejson.dumps({'success': False, 'data': html})
     return HttpResponse(json)
Example #3
0
def profile_saved(request):

    form = account.forms.LoginUsernameForm

    return render_to_response('home.html', {'login_form': form, },
                              context_instance=RequestContext(request))
Example #4
0
def changePassword(request):
	if request.method == "POST":
		old_password = request.POST.get('old_password', None)
		new_password1 = request.POST.get('new_password1', None)
		new_password2 = request.POST.get('new_password2', None)
		if new_password1 != new_password2:
			messages.error(request,"The new passwords donot match")
			return HttpResponseRedirect('')
		user = Person.objects.get(user=request.user).user
		if user.check_password(old_password):
			user.set_password(new_password1)
			user.save()
			messages.success(request, "Password Changed Successfully.")
		else:
			messages.error(request, "Please enter your password correctly")
		return HttpResponseRedirect('')
	else:
		return render_to_response("person/changePassword.html",{'image':False},context_instance=RequestContext(request))
Example #5
0
def profile(request):
	person = request.user.person

	return render_to_response("person/profile.html",{'person': person},context_instance=RequestContext(request))
Example #6
0
def add(request, form_class=DirectoryForm, template_name="directories/add.html"):
    can_add_active = has_perm(request.user,'directories.add_directory')
    
    if not any([request.user.profile.is_superuser,
               can_add_active,
               get_setting('module', 'directories', 'usercanadd'),
               (request.user.profile.is_member and get_setting('module', 'directories', 'directoriesrequiresmembership'))
               ]):
        raise Http403

    pricings = DirectoryPricing.objects.filter(status=True)
    if not pricings and has_perm(request.user, 'directories.add_directorypricing'):
        messages.add_message(request, messages.WARNING, 'You need to add a %s Pricing before you can add %s.' % (get_setting('module', 'directories', 'label_plural'),get_setting('module', 'directories', 'label')))
        return HttpResponseRedirect(reverse('directory_pricing.add'))     

    require_payment = get_setting('module', 'directories', 'directoriesrequirespayment')
    
    form = form_class(request.POST or None, request.FILES or None, user=request.user)
    
    if not require_payment:
        del form.fields['payment_method']
        del form.fields['list_type']

    if request.method == "POST":
        if require_payment:
            is_free = is_free_listing(request.user,
                               request.POST.get('pricing', 0),
                               request.POST.get('list_type'))
            if is_free:
                del form.fields['payment_method']

        if form.is_valid():
            directory = form.save(commit=False)
            pricing = form.cleaned_data['pricing']

            if require_payment and is_free:
                directory.payment_method = 'paid - cc'
            if directory.payment_method:
                directory.payment_method = directory.payment_method.lower()
            if not directory.requested_duration:
                directory.requested_duration = 30
            if not directory.list_type:
                directory.list_type = 'regular'
            
            if not directory.slug:
                directory.slug = '%s-%s' % (slugify(directory.headline), Directory.objects.count())
            
            if not can_add_active:
                directory.status = True
                directory.status_detail = 'pending'
            else:
                directory.activation_dt = datetime.now()
                # set the expiration date
                directory.expiration_dt = directory.activation_dt + timedelta(days=directory.requested_duration)

            # We set the logo to None temporarily because we need
            # the PK when we save to get the filepath of the file
            logo = directory.logo
            directory.logo = None

            directory = update_perms_and_save(request, form, directory)

            # directory now has a pk, so we can reassign the logo
            # and resave
            directory.logo = logo

            if directory.logo:
                directory.logo.file.seek(0)

                directory.save(log=False)

                if settings.USE_S3_STORAGE:
                    resize_s3_image(directory.logo.name)
                else:
                    try:
                        logo = Image.open(directory.logo.path)
                        logo.thumbnail((200,200),Image.ANTIALIAS)
                        logo.save(directory.logo.path)
                    except:
                        pass                
                        
            # create invoice
            directory_set_inv_payment(request.user, directory, pricing)

            messages.add_message(request, messages.SUCCESS, 'Successfully added %s' % directory)
            
            # send notification to administrators
            # get admin notice recipients
            recipients = get_notice_recipients('module', 'directories', 'directoryrecipients')
            if recipients:
                if notification:
                    extra_context = {
                        'object': directory,
                        'request': request,
                    }
                    notification.send_emails(recipients,'directory_added', extra_context)
                    
            if directory.payment_method.lower() in ['credit card', 'cc']:
                if directory.invoice and directory.invoice.balance > 0:
                    return HttpResponseRedirect(reverse('payment.pay_online', args=[directory.invoice.id, directory.invoice.guid])) 
            if can_add_active:  
                return HttpResponseRedirect(reverse('directory', args=[directory.slug])) 
            else:
                return HttpResponseRedirect(reverse('directory.thank_you'))             

    return render_to_response(template_name,
                              {'form': form,
                               'require_payment': require_payment},
        context_instance=RequestContext(request))
Example #7
0
def thank_you(request, template_name="directories/thank-you.html"):
    return render_to_response(template_name, {}, context_instance=RequestContext(request))
Example #8
0
def web(request):
  template = loader.get_template('clientes/indexWeb.html')
  return HttpResponse(template.render(RequestContext(request)))
Example #9
0
def pin_detail(request, pinId):
    context = getPinContext(request, pinId)
    return render_to_string('pins/templatetags/pin_detail.html',
        context,
        context_instance=RequestContext(request))
Example #10
0
def _carers(request, db=None, ctx={}):
    t = loader.get_template('carers.html')
    ctx['carers'] = Member.carers()
    return HttpResponse(t.render(RequestContext(request, ctx)))
Example #11
0
def login_form(request, ctx):
    ctx['authenticationform'] = forms.AuthenticationForm()
    t = loader.get_template('login.html')
    return HttpResponse(t.render(RequestContext(request, ctx)))
Example #12
0
def console(request):
    """
    Our web console, lets you see recent messages as well as send out new ones for
    processing.
    """
    form = SendForm()
    reply_form = ReplyForm()
    search_form = SearchForm()
    queryset = Message.objects.all()

    if request.method == 'POST' and 'this_is_the_login_form' not in request.POST:
        if request.POST['action'] == 'test':
            form = SendForm(request.POST)
            if form.is_valid():
                backend = "console"
                message = get_router().handle_incoming(
                    backend, form.cleaned_data['sender'],
                    form.cleaned_data['text'])
            reply_form = ReplyForm()

        elif request.POST['action'] == 'reply':
            reply_form = ReplyForm(request.POST)
            if reply_form.is_valid():
                if Connection.objects.filter(
                        identity=reply_form.cleaned_data['recipient']).count():
                    text = reply_form.cleaned_data['message']
                    conn = Connection.objects.filter(
                        identity=reply_form.cleaned_data['recipient'])[0]
                    outgoing = OutgoingMessage(conn, text)
                    get_router().handle_outgoing(outgoing)
                else:
                    reply_form.errors.setdefault('short_description',
                                                 forms.ErrorList())
                    reply_form.errors['recipient'].append(
                        "This number isn't in the system")

        elif request.POST['action'] == 'search':
            # split on spaces
            search_form = SearchForm(request.POST)
            if search_form.is_valid():
                terms = search_form.cleaned_data['search'].split()

                if terms:
                    term = terms[0]
                    query = (Q(text__icontains=term)
                             | Q(in_response_to__text__icontains=term)
                             | Q(connection__identity__icontains=term))
                    for term in terms[1:]:
                        query &= (Q(text__icontains=term)
                                  | Q(in_response_to__text__icontains=term)
                                  | Q(connection__identity__icontains=term))
                    queryset = queryset.filter(query)

    paginator = Paginator(queryset.order_by('-id'), 20)
    page = request.GET.get('page')
    try:
        messages = paginator.page(page)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        messages = paginator.page(paginator.num_pages)
    except:
        # None or not an integer, default to first page
        messages = paginator.page(1)

    return render_to_response(
        "router/index.html", {
            "messages_table": MessageTable(queryset, request=request),
            "form": form,
            "reply_form": reply_form,
            "search_form": search_form,
            "messages": messages
        },
        context_instance=RequestContext(request))
Example #13
0
def translate(request, project, subproject, lang):
    '''
    Generic entry point for translating, suggesting and searching.
    '''
    translation = get_translation(request, project, subproject, lang)

    # Check locks
    project_locked, user_locked, own_lock = translation.is_locked(
        request, True
    )
    locked = project_locked or user_locked

    # Search results
    search_result = search(translation, request)

    # Handle redirects
    if isinstance(search_result, HttpResponse):
        return search_result

    # Get numer of results
    num_results = len(search_result['ids'])

    # Search offset
    try:
        offset = int(request.GET.get('offset', search_result.get('offset', 0)))
    except ValueError:
        offset = 0

    # Check boundaries
    if offset < 0 or offset >= num_results:
        messages.info(request, _('You have reached end of translating.'))
        # Delete search
        del request.session['search_%s' % search_result['search_id']]
        # Redirect to translation
        return redirect(translation)

    # Some URLs we will most likely use
    base_unit_url = '%s?sid=%s&offset=' % (
        translation.get_translate_url(),
        search_result['search_id'],
    )
    this_unit_url = base_unit_url + str(offset)
    next_unit_url = base_unit_url + str(offset + 1)

    response = None

    # Any form submitted?
    if request.method == 'POST' and not project_locked:

        # Handle accepting/deleting suggestions
        if ('accept' not in request.POST
                and 'delete' not in request.POST
                and 'upvote' not in request.POST
                and 'downvote' not in request.POST):
            response = handle_translate(
                translation, request, user_locked,
                this_unit_url, next_unit_url
            )
        elif not locked:
            response = handle_suggestions(
                translation, request, this_unit_url
            )

    # Handle translation merging
    elif 'merge' in request.GET and not locked:
        response = handle_merge(
            translation, request, next_unit_url
        )

    # Handle reverting
    elif 'revert' in request.GET and not locked:
        response = handle_revert(
            translation, request, this_unit_url
        )

    # Pass possible redirect further
    if response is not None:
        return response

    # Grab actual unit
    try:
        unit = translation.unit_set.get(pk=search_result['ids'][offset])
    except Unit.DoesNotExist:
        # Can happen when using SID for other translation
        messages.error(request, _('Invalid search string!'))
        return redirect(translation)

    # Show secondary languages for logged in users
    if request.user.is_authenticated():
        secondary = request.user.profile.get_secondary_units(unit)
    else:
        secondary = None

    # Spam protection
    antispam = AntispamForm()

    # Prepare form
    form = TranslationForm(translation, unit)

    return render_to_response(
        'translate.html',
        RequestContext(
            request,
            {
                'this_unit_url': this_unit_url,
                'first_unit_url': base_unit_url + '0',
                'last_unit_url': base_unit_url + str(num_results - 1),
                'next_unit_url': next_unit_url,
                'prev_unit_url': base_unit_url + str(offset - 1),
                'object': translation,
                'unit': unit,
                'total': translation.unit_set.all().count(),
                'search_id': search_result['search_id'],
                'search_query': search_result['query'],
                'offset': offset,
                'filter_name': search_result['name'],
                'filter_count': num_results,
                'filter_pos': offset + 1,
                'form': form,
                'antispam': antispam,
                'comment_form': CommentForm(),
                'search_form': SearchForm(),
                'update_lock': own_lock,
                'secondary': secondary,
                'locked': locked,
                'user_locked': user_locked,
                'project_locked': project_locked,
            },
        )
    )
Example #14
0
def thanks(request):
    return render_to_response('thanks.html',
                              context_instance=RequestContext(request))
Example #15
0
def cityinit(request):
    trie.initialize()
    return render_to_response('index.html',{},context_instance = RequestContext(request))
Example #16
0
def activate(request,
             backend,
             template_name='registration/activate.html',
             success_url=None,
             extra_context=None,
             **kwargs):
    """
    Activate a user's account.

    The actual activation of the account will be delegated to the
    backend specified by the ``backend`` keyword argument (see below);
    the backend's ``activate()`` method will be called, passing any
    keyword arguments captured from the URL, and will be assumed to
    return a ``User`` if activation was successful, or a value which
    evaluates to ``False`` in boolean context if not.

    Upon successful activation, the backend's
    ``post_activation_redirect()`` method will be called, passing the
    ``HttpRequest`` and the activated ``User`` to determine the URL to
    redirect the user to. To override this, pass the argument
    ``success_url`` (see below).

    On unsuccessful activation, will render the template
    ``registration/activate.html`` to display an error message; to
    override thise, pass the argument ``template_name`` (see below).

    **Arguments**

    ``backend``
        The dotted Python import path to the backend class to
        use. Required.

    ``extra_context``
        A dictionary of variables to add to the template context. Any
        callable object in this dictionary will be called to produce
        the end result which appears in the context. Optional.

    ``success_url``
        The name of a URL pattern to redirect to on successful
        acivation. This is optional; if not specified, this will be
        obtained by calling the backend's
        ``post_activation_redirect()`` method.

    ``template_name``
        A custom template to use. This is optional; if not specified,
        this will default to ``registration/activate.html``.

    ``\*\*kwargs``
        Any keyword arguments captured from the URL, such as an
        activation key, which will be passed to the backend's
        ``activate()`` method.

    **Context:**

    The context will be populated from the keyword arguments captured
    in the URL, and any extra variables supplied in the
    ``extra_context`` argument (see above).

    **Template:**

    registration/activate.html or ``template_name`` keyword argument.

    """
    backend = get_backend(backend)
    account = backend.activate(request, **kwargs)

    if account:
        if success_url is None:
            to, args, kwargs = backend.post_activation_redirect(
                request, account)
            return redirect(to, *args, **kwargs)
        else:
            return redirect(success_url)

    if extra_context is None:
        extra_context = {}
    context = RequestContext(request)
    for key, value in extra_context.items():
        context[key] = callable(value) and value() or value

    return render_to_response(template_name, kwargs, context_instance=context)
Example #17
0
 def _setup_required(self, request):
     if settings.EMBEDDED:
         return HttpResponseServerError('Site is not set up.', content_type='text/plain')
     return SimpleTemplateResponse('setup_wizard/setup_required.html',
         context=RequestContext(request), status=403)
Example #18
0
def register(request,
             backend,
             success_url=None,
             form_class=None,
             disallowed_url='registration_disallowed',
             template_name='registration/registration_form.html',
             extra_context=None):
    """
    Allow a new user to register an account.

    The actual registration of the account will be delegated to the
    backend specified by the ``backend`` keyword argument (see below);
    it will be used as follows:

    1. The backend's ``registration_allowed()`` method will be called,
       passing the ``HttpRequest``, to determine whether registration
       of an account is to be allowed; if not, a redirect is issued to
       the view corresponding to the named URL pattern
       ``registration_disallowed``. To override this, see the list of
       optional arguments for this view (below).

    2. The form to use for account registration will be obtained by
       calling the backend's ``get_form_class()`` method, passing the
       ``HttpRequest``. To override this, see the list of optional
       arguments for this view (below).

    3. If valid, the form's ``cleaned_data`` will be passed (as
       keyword arguments, and along with the ``HttpRequest``) to the
       backend's ``register()`` method, which should return the new
       ``User`` object.

    4. Upon successful registration, the backend's
       ``post_registration_redirect()`` method will be called, passing
       the ``HttpRequest`` and the new ``User``, to determine the URL
       to redirect the user to. To override this, see the list of
       optional arguments for this view (below).

    **Required arguments**

    None.

    **Optional arguments**

    ``backend``
        The dotted Python import path to the backend class to use.

    ``disallowed_url``
        URL to redirect to if registration is not permitted for the
        current ``HttpRequest``. Must be a value which can legally be
        passed to ``django.shortcuts.redirect``. If not supplied, this
        will be whatever URL corresponds to the named URL pattern
        ``registration_disallowed``.

    ``form_class``
        The form class to use for registration. If not supplied, this
        will be retrieved from the registration backend.

    ``extra_context``
        A dictionary of variables to add to the template context. Any
        callable object in this dictionary will be called to produce
        the end result which appears in the context.

    ``success_url``
        URL to redirect to after successful registration. Must be a
        value which can legally be passed to
        ``django.shortcuts.redirect``. If not supplied, this will be
        retrieved from the registration backend.

    ``template_name``
        A custom template to use. If not supplied, this will default
        to ``registration/registration_form.html``.

    **Context:**

    ``form``
        The registration form.

    Any extra variables supplied in the ``extra_context`` argument
    (see above).

    **Template:**

    registration/registration_form.html or ``template_name`` keyword
    argument.

    """
    backend = get_backend(backend)
    if not backend.registration_allowed(request):
        return redirect(disallowed_url)
    if form_class is None:
        form_class = backend.get_form_class(request)

    if request.method == 'POST':
        form = form_class(data=request.POST, files=request.FILES)
        if form.is_valid():
            new_user = backend.register(request, **form.cleaned_data)
            if success_url is None:
                to, args, kwargs = backend.post_registration_redirect(
                    request, new_user)
                return redirect(to, *args, **kwargs)
            else:
                return redirect(success_url)
    else:
        form = form_class()

    if extra_context is None:
        extra_context = {}
    context = RequestContext(request)
    for key, value in extra_context.items():
        context[key] = callable(value) and value() or value

    return render_to_response(template_name, {'form': form},
                              context_instance=context)
Example #19
0
def pricing_search(request, template_name="directories/pricing-search.html"):
    directory_pricing = DirectoryPricing.objects.filter(status=True).order_by('duration')
    EventLog.objects.log()

    return render_to_response(template_name, {'directory_pricings':directory_pricing}, 
        context_instance=RequestContext(request))
Example #20
0
def home(request):
    registered_users = User.objects.all()

    return render_to_response('chat_app/home.html', 
        {'user': request.user, 'registered_users': registered_users}, context_instance=RequestContext(request))
Example #21
0
def renew(request, id, form_class=DirectoryRenewForm, template_name="directories/renew.html"):
    can_add_active = has_perm(request.user,'directories.add_directory')
    require_approval = get_setting('module', 'directories', 'renewalrequiresapproval')
    directory = get_object_or_404(Directory, pk=id)
    
    if not has_perm(request.user,'directories.change_directory', directory) or not request.user == directory.creator:
        raise Http403
    
    # pop payment fields if not required
    require_payment = get_setting('module', 'directories', 'directoriesrequirespayment')
    form = form_class(request.POST or None, request.FILES or None, instance=directory, user=request.user)
    if not require_payment:
        del form.fields['payment_method']
        del form.fields['list_type']
    
    if request.method == "POST":
        if form.is_valid():           
            directory = form.save(commit=False)
            pricing = form.cleaned_data['pricing']
            
            if directory.payment_method: 
                directory.payment_method = directory.payment_method.lower()
            if not directory.requested_duration:
                directory.requested_duration = 30
            if not directory.list_type:
                directory.list_type = 'regular'
            
            if not directory.slug:
                directory.slug = '%s-%s' % (slugify(directory.headline), Directory.objects.count())
            
            if not can_add_active and require_approval:
                directory.status = True
                directory.status_detail = 'pending'
            else:
                directory.activation_dt = datetime.now()
                # set the expiration date
                directory.expiration_dt = directory.activation_dt + timedelta(days=directory.requested_duration)
                # mark renewal as not sent for new exp date
                directory.renewal_notice_sent = False
            # update all permissions and save the model
            directory = update_perms_and_save(request, form, directory)             
                        
            # create invoice
            directory_set_inv_payment(request.user, directory, pricing)

            messages.add_message(request, messages.SUCCESS, 'Successfully renewed %s' % directory)
            
            # send notification to administrators
            # get admin notice recipients
            recipients = get_notice_recipients('module', 'directories', 'directoryrecipients')
            if recipients:
                if notification:
                    extra_context = {
                        'object': directory,
                        'request': request,
                    }
                    notification.send_emails(recipients,'directory_renewed', extra_context)
                    
            if directory.payment_method.lower() in ['credit card', 'cc']:
                if directory.invoice and directory.invoice.balance > 0:
                    return HttpResponseRedirect(reverse('payments.views.pay_online', args=[directory.invoice.id, directory.invoice.guid])) 
            if can_add_active:  
                return HttpResponseRedirect(reverse('directory', args=[directory.slug])) 
            else:
                return HttpResponseRedirect(reverse('directory.thank_you'))  
        
    
    return render_to_response(template_name, {'directory':directory, 'form':form}, 
        context_instance=RequestContext(request))
Example #22
0
def index(request):
    events_list = Event.objects.all()
    collections = GalleryCollection.objects.all()
    rahmaninov.apps.gallery.views.update_collections(collections)
    return render_to_response('index.html', RequestContext(request, locals()))
Example #23
0
def info(request):
	if request.method == "POST":
		return HttpResponseRedirect("/person/home/")
	else:
		return render_to_response("person/person_info.html",{'image':image,'degrees':degrees,'branches':branches,'jobs':jobs,'industries':industries,'languages':languages,'poli':poli,'hobbies':hobbies},context_instance=RequestContext(request))
Example #24
0
def mainMobile(request):

     return render_to_response('mainMobile.html',{},context_instance = RequestContext(request))
Example #25
0
def loginRequest(request):
	errors = []
	success = []
	if request.user.is_authenticated():	
		return HttpResponseRedirect('/person/home/')
	if request.method=="POST":
		username=request.POST.get('username', None)
		password=request.POST.get('password', None)
		user=authenticate(username=username,password=password)
		if user is not None and user.is_active:
			login(request,user)
			if not request.POST.get('remember_me', None):
				request.session.set_expiry(0)		
			return HttpResponseRedirect("/person/home/")		
		messages.error(request, "Please enter valid details. Login Failed.")
	return render_to_response("person/login.html",{'errors':errors,'success':success},context_instance=RequestContext(request))
Example #26
0
def planningMobile(request):

     return render_to_response('planningMobile.html',{},context_instance = RequestContext(request))
Example #27
0
def calendar(request):
    context = {}
    return render_to_response('calendar.html', context,\
            context_instance=RequestContext(request))
Example #28
0
def traininit(request):

     startup.loadtraindata()
     return render_to_response('index.html',{},context_instance = RequestContext(request))
Example #29
0
def manage_featured_inline(
    request, as_string=False, template_name="manage/marketing/featured_inline.html"):
    """
    """
    featured = FeaturedProduct.objects.all()
    featured_ids = [f.product.id for f in featured]

    r = request.REQUEST
    s = request.session

    # If we get the parameter ``keep-filters`` or ``page`` we take the
    # filters out of the request resp. session. The request takes precedence.
    # The page parameter is given if the user clicks on the next/previous page
    # links. The ``keep-filters`` parameters is given is the users adds/removes
    # products. In this way we keeps the current filters when we needed to. If
    # the whole page is reloaded there is no ``keep-filters`` or ``page`` and
    # all filters are reset as they should.

    if r.get("keep-filters") or r.get("page"):
        page = r.get("page", s.get("featured_products_page", 1))
        filter_ = r.get("filter", s.get("filter"))
        category_filter = r.get("featured_category_filter",
                          s.get("featured_category_filter"))
    else:
        page = r.get("page", 1)
        filter_ = r.get("filter")
        category_filter = r.get("featured_category_filter")

    # The current filters are saved in any case for later use.
    s["featured_products_page"] = page
    s["filter"] = filter_
    s["featured_category_filter"] = category_filter

    try:
        s["featured-amount"] = int(r.get("featured-amount", s.get("featured-amount")))
    except TypeError:
        s["featured-amount"] = 25

    filters = Q()
    if filter_:
        filters &= Q(name__icontains=filter_)
        filters |= Q(sku__icontains=filter_)
        filters |= (Q(sub_type=VARIANT) & Q(active_sku=False) & Q(parent__sku__icontains=filter_))
        filters |= (Q(sub_type=VARIANT) & Q(active_name=False) & Q(parent__name__icontains=filter_))

    if category_filter:
        if category_filter == "None":
            filters &= Q(categories=None)
        elif category_filter == "All":
            pass
        else:
            # First we collect all sub categories and using the `in` operator
            category = lfs_get_object_or_404(Category, pk=category_filter)
            categories = [category]
            categories.extend(category.get_all_children())
            filters &= Q(categories__in=categories)

    products = Product.objects.filter(filters).exclude(pk__in=featured_ids)
    paginator = Paginator(products, s["featured-amount"])

    total = products.count()
    try:
        page = paginator.page(page)
    except EmptyPage:
        page = 0

    result = render_to_string(template_name, RequestContext(request, {
        "featured": featured,
        "total": total,
        "page": page,
        "paginator": paginator,
        "filter": filter_
    }))

    if as_string:
        return result
    else:
        return HttpResponse(
            simplejson.dumps({
                "html": [["#featured-inline", result]],
            }), mimetype='application/json')
Example #30
0
def resource_details(request, resource_id, slug=""):
    resource = get_object_or_404(Resource, pk=resource_id)
    return render_to_response('details.html', {'resource': resource},
                              context_instance=RequestContext(request))