This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@admin.register(Order) | |
class OrderAdmin(admin.ModelAdmin): | |
list_display = [ | |
'name', | |
'status', | |
'add_product_action', | |
'add_mattress_action' | |
] | |
list_display_links = ['name', 'status'] | |
readonly_fields = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
from django.http.response import HttpResponse | |
from django.utils.decorators import available_attrs | |
from rest_framework_extensions.settings import extensions_api_settings | |
from django.utils import six | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qs = request.META.get('QUERY_STRING', '') | |
querystring = qs.split('&') | |
filtered_querystring = filter(lambda p: not p.split('=')[0].startswith('utm_'), querystring) | |
qs = '&'.join(filtered_querystring) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from io import BytesIO | |
import os | |
from django.conf import settings | |
from django.contrib.staticfiles import finders | |
from django.http import HttpResponse | |
from django.template.loader import render_to_string | |
from django.utils import dateformat | |
from django.utils.timezone import now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import operator | |
from django.apps import apps | |
from django.conf import settings | |
from django.db.models import Q | |
TERMS = re.compile(r'"([^"]+)"|(\S+)').findall | |
NORM_SPACE = re.compile(r'\s{2,}').sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SESSION_EXPIRE_AT_BROWSER_CLOSE = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.signals import user_logged_in | |
from django.dispatch import receiver | |
from django.contrib.gis.geoip2 import GeoIP2 | |
from django.conf import settings | |
import geoip2 | |
from apps.mailer.tasks import send_template_email | |
from .models import LoginStatistics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include /../mixins/index.pug | |
form.py-3(method="post", enctype="multipart/form-data") | |
+tag csrf_token | |
+if('form.non_field_errors()') | |
.alert.alert-danger: +exp form.non_field_errors().as_text() | |
+for('hidden_field in form.hidden_fields()') | |
+exp hidden_field |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
from django.conf import settings | |
from django.core.management.base import BaseCommand | |
from django.core.mail import send_mass_mail | |
from django.contrib.auth.models import User | |
from django.db.models import Count | |
class Command(BaseCommand): | |
help = 'Sends an e-mail reminder to users registered more \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.urlresolvers import reverse | |
from django.shortcuts import get_object_or_404, redirect | |
from .models import Course | |
class SubdomainCourseMiddleware(object): | |
""" | |
Provides subdomains for courses | |
""" | |
def process_request(self, request): |