Skip to content

Instantly share code, notes, and snippets.

Object { x: 0.0015832980861887336, y: -0.24456632137298584, z: -0.5248637795448303 }
@neuman
neuman / carteblanche_snippets.py
Last active August 29, 2015 14:18
CarteBlanche Codementor Snippets
from django.contrib.auth import authenticate, login, logout
class UserLogoutView(TemplateView):
template_name = 'whatever'
def get(self, request, **kwargs):
#if the user has no payment methods, redirect to the view where one can be created
logout(self.request)
return HttpResponseRedirect(reverse(viewname='location_list', current_app='core'))
$( document ).ready(function() {
var map = new GMaps({
el: '#map',
lat: -12.043333,
lng: -77.028333
});
var locations = $(".location-data");
locations.each( function( key, value ) {
map.addMarker({
TEMPLATE_CONTEXT_PROCESSORS = ("django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"django.core.context_processors.request"
)
<section id="services">
<div class="container">
<div class="row ">
<div class="col-lg-6 text-center">
<div class="my_signin_block">
<h2 class="section-heading"><a href="{{ location.get_absolute_url }}">Sign In</a></h2>
<h3 class="section-subheading text-muted">Welcome back!</h3>
{% sitegate_signin_form %}
</div>
</div>
@sitegate_view(widget_attrs={'class': 'form-control', 'placeholder': lambda f: f.label}, template='form_bootstrap3') # This also prevents logged in users from accessing our sign in/sign up page.
def entrance(request):
return render(request, 'base/entrance.html', {'title': 'Sign in & Sign up'}
<div class="row">
<div class="col-md-4">
<p><b>WIFI: </b>{% if location.wifi %}{{ location.get_wifi_display }}{% else %}----{% endif %}</p>
<p><b>Seating: </b>{% if location.seating %}{{ location.get_seating_display }}{% else %}----{% endif %}</p>
<p><b>Outlets: </b>{% if location.outlets %}{{ location.get_outlets_display }}{% else %}----{% endif %}</p>
<p><b>Bathrooms: </b>{% if location.bathroom %}{{ location.get_bathrooms_display }}{% else %}----{% endif %}</p>
</div>
<div class="col-md-4">
<form action="/search/" class="navbar-form navbar-right" method="get">
<div class="form-group">
<input type="text" placeholder="Search" class="form-control" name="query" autocomplete="off">
</div>
</form>
{% extends "base/theme.html" %}
{% load addattr %}
{% block maincontent %}
<div class="header-buffer">
</div>
<section id="services">
<div class="container">
<div class="row">
{% if form %}
<div class="col-md-12">
<div class="row">
<div class="col-md-8">
<h2>{{ review.user.get_full_name }} <a class="subheading"> | {{ review.created_at | date }}</a></h2>
</div>
<div class="col-md-4 text-right">
<h2>{% include 'base/rating.html' with rating=location.get_average_rating %}</h2>
</div>
</div>
<p>{{ review.description }}</p>