python

python
from haystack import indexes
from blog.models import Post


class PostIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.CharField(document=True, use_template=True)

Django haystack for advanced search

django python search
by Priya Sharma 2 tabs
python
import factory
from factory.django import DjangoModelFactory
from factory import Faker, SubFactory, post_generation
from blog.models import Post, Comment, Tag
from django.contrib.auth import get_user_model

Django test fixtures with factory_boy

django python testing
by Priya Sharma 1 tab
python
from django.contrib.auth import views as auth_views
from django.urls import path

app_name = 'accounts'

urlpatterns = [

Django password reset flow with email

django python authentication
by Priya Sharma 2 tabs
python
from celery import shared_task
from django.core.mail import send_mail
from django.contrib.auth import get_user_model

User = get_user_model()

Django celery task for async email sending

django python celery
by Priya Sharma 2 tabs
python
from django.conf import settings
from datetime import datetime


def site_settings(request):
    """Add site-wide settings to template context."""

Django context processors for global template variables

django python templates
by Priya Sharma 2 tabs
python
from django import forms
from .models import Event


class EventForm(forms.ModelForm):
    class Meta:

Django form validation with clean methods

django python forms
by Priya Sharma 1 tab
python
import functools
import threading
import time
from collections import OrderedDict

Custom TTL + LRU Cache Decorator for Expensive Python Computations

python caching lru
by codesnips 2 tabs