SEMrush
djangosnippets.org

Please wait for loading...




    SEMrush

      (823):

    /
     1  ~ 2014 sep 27django templates random uuiddjangosnippets : uuid template tagA simple template tag that generates a random UUID and stores it in a ... from django . template import Library, Node, TemplateSyntaxError from ...
     1  ~ 2014 sep 05django expose soapDjango snippets: SOAP web service with soaplib 0.9+The popular soaplib snippet works only with older soaplib (0.8, ... Convert django model into soaplib model, to expose webservices by ...
     2  ~ 2014 sep 18django refererDjango snippets: Get the referer view of a requestMETA.get('HTTP_REFERER') if not referer : return default # remove the protocol and split the url at the slashes referer = re.sub('^https?:\/\/', '' ...
     2  ~ 2014 sep 11django alaphabet paginationDjango snippets: Pagination /Filtering AlphabeticallyNamePaginator works like Django's Paginator. You pass in a list of objects and how many you want per letter range ("page"). Then, it will ...
     2  +1 2014 aug 16filefield allowed extensionsDjango snippets: FileField with file extension whitelistFileField ): """ Same as forms. FileField , but you can specify a file extension whitelist. >>> from ... ValidationError: [u'Not allowed filetype!
     3  ~ 2014 sep 28sorl thubnail filenamedjangosnippets: Custom filename example with sorl - thumbnailusage :- put it in python path and refer to it from settings.py. THUMBNAIL_BACKEND = 'full.import.path.to.SEOThumbnailBackend'. Took me a ...
     3  ~ 2014 sep 19django url reverse lazyDjango snippets: lazy url reverse ()Since the decorators of your views are evaluated during parsing urls .py you have an 'chicken - egg' problem. The method reverse () can't be ...
     3  +7 2014 sep 15maxmind dmaDjango snippets: MaxMind (R) GeoIP Lite CSV ImportMaxMind (R) GeoIP Lite CSV Import ... cty, postal, lat, lon, dma , area in table: pnt = Point(float(lon), float(lat)) # The points for the countries are in ...
     3  +1 2014 jul 24dump object django templateDjango snippets: jsonify template filterjsonify template filter ... from django .core.serializers import serialize from ... object ) return simplejson. dumps ( object ) register.filter('jsonify', ...
     3  +1 2014 jul 23decorator url resolversDjango snippets: Decorator to modify reverse() to render SSL urlsIn your site's __init__.py """ from django.core import urlresolvers from django.conf import settings def reverse_decorator(func): def inner(*args, ...
     4  ~ 2014 sep 27django form previewdjangosnippets : Complex Form PreviewProblem. The FormPreview class provided by contrib.formtools helps automate a common workflow. You display a form , then force a preview , ...
     4  -2 2014 sep 22django currency filterDjango snippets: Currency filter{ foo| currency }}. would print. $49,277. If your locale is the U.S. You can use this filter in your templates as described in the Django  ...
     4  +19 2014 aug 10login is requiredDjango snippets: Login Required Middlewarefrom django.http import HttpResponseRedirect from django.conf import settings from re import compile EXEMPT_URLS = [compile(settings.
     4  +2 2014 jul 20django hidden fieldDjango snippets: "Dynamic" form with a hidden fieldfrom django import forms hiddenValues = forms. Form () value0 = 17 hiddenValues. fields ['value0'] = forms.CharField(initial=value0 ...
     5  -1 2014 oct 02uuidfield in django modelsdjangosnippets : uuid model fieldfrom django .db import models import uuid class UUIDField ( models .CharField) : def __init__(self, *args, **kwargs): kwargs['max_length'] ...
     5  +4 2014 sep 26jquery post csrfdjangosnippets: Jquery ajax csrf framework for DjangoFramework to extend the jquery ajax() function to construct post requests that contain a csrf token. The example view used with the framework ...
     5  +3 2014 sep 19jscal2Django snippets: DateTimeWidget using JSCal2DateTimeWidget using JSCal2 . Duplicate of this snippet, but for latest 1.5 version of DHTML Calendar. Also here is fixed problem of previous ...
     5  +2 2014 sep 11django model to dictDjango snippets: Custom model field to store dict object in databaseYou can assign any dict to model field that can be dumped/serialized with Django json encoder/decoder. Data is saved as TextField in ...
     5  -1 2014 sep 11use sendmail in djangoDjango snippets: email backend which use sendmail subprocessemail backend which use sendmail subprocess ... """ sendmail email backend class.""" import threading from django .conf import settings from ...
     5  +2 2014 aug 20lost django passwordDjango snippets: reset django passwordreset django password ... Reset lost django password without the use of sql. Author: hugogee; Posted: August 24, 2011; Language: Python; Version: Not ...
     5  -2 2014 aug 19ajax translator moduleDjango snippets: Python Google Translate AJAX moduleFancyURLopener): version = "py-gtranslate/1.0" base_uri = "nslate (phrase, ...
     6  ~ 2014 sep 24django inline disable adddjangosnippets : Dynamically add inlinesThese functions use JQuery to dynamically add new entries for stacked
     6  -1 2014 sep 23jquery width django formdjangosnippets : TinyMCE Widgetfrom django import forms from django .conf import settings from
     6  +28 2014 sep 07django querysetDjango snippets: Memory efficient Django Queryset IteratorSince Django normally loads all objects into it's memory when iterating over a queryset (even with .iterator, although in that case it's not Django  ...
     6  +2 2014 aug 21django html emailDjango snippets: Send templated email with text | html | optional filesdef send_templated_email(subject, email_template_name, email_context, recipients, sender=None,bcc=None, fail_silently=True, files=None): ...
     7  -2 2014 sep 28django batchdjangosnippets: Batch querysetsMost of the time when I need to iterate over Whatever.objects.all() in a shell script, my machine promptly reminds me that sometimes even 4GB ...
     7  ~ 2014 sep 28django validate inlinesdjangosnippets : Unique field inline formsetThis method will return an inline formset class that validates values across the given field are unique among all forms. For instance:
     7  +11 2014 sep 19django template includeDjango snippets: "Partial Templates " - an alternative to " include "You can pass data to the partial, and use it as you would in a regular template . It is different from Django's {% include %} , because it allows you ...
     7  -1 2014 sep 10django email validationDjango snippets: simple email validation functionsimple email validation function ... when creating a custom MultiEmailField:
     7  -1 2014 sep 06django ajax form postDjango snippets: save form in ajax with jquery in djangosave form in ajax with jquery in django ... Code how to save ajax .in a form ... POST ) if my_form.is_valid(): new = my_form.save(commit=True) ...
     7  +18 2014 aug 29jquery random slideshowDjango snippets: Slideshow ( Random Image Display) - Using Jquery#This code fetches the file name stored in the database send to the simple json format #Images are displayed in random way in a 5 place ...
     7  +12 2014 aug 16django template filtersfrom django .core.serializers import serialize from django .db.models.query import QuerySet from django .utils import simplejson from ...
     7  +9 2014 aug 12django template filter
     7  -1 2014 jul 23django model choice fieldDjango snippets: ModelChoiceField with optiongroupsfrom django .forms.models import ModelChoiceIterator, ModelChoiceField class GroupedModelChoiceField( ModelChoiceField ): def ...
     7  +94 2014 jul 20print all errorsDjango snippets: List all Form Errorsif form. errors %} <div id="form- error "> <p>The operation could not be ... 9 months ago; Show all form errors by timbroder 2 years, 1 month ago ...
     7  +4 2014 jul 16expired domains jannisDjango snippets: easy set cookie expired timeeasy set cookie expired time ... value, max_age=max_age, expires= expires , domain =settings. ... Backend code by James Bennett, Charles Leifer, Jannis Leidel and other contributors, design by Jeff Croft. Hosted by Heroku.
     8  +5 2014 aug 09google chart chdsDjango snippets: generateChart() for creating a Google Chart API generateChart() for creating a Google Chart API pie chart from ... Chart type: pie var chs = '460x200'; // Image dimensions var chd = []; // Chart ...
     8  +2 2014 jul 26logo dinero mailDjango snippets: Generate a dineromail form in pythonGenerate a dineromail form in python ... #your logo dineromail_dict[' payment_method_available'] = 'mx_oxxo;mx_7eleven' #see the pdf above ...
     9  +3 2014 oct 03facebook canvas post getBypass CSRF check for Facebook canvas apps using POST for Bypass CSRF check for Facebook canvas apps using POST for canvas ... REQUEST. get ('signed_request', None) signed_request ...
     9  ~ 2014 sep 29wymeditor replacing urls hrefDjango snippets: Integrate Wymeditor with filebrowser pluginIn order to integrate Wymeditor with the Django filebrowser, put the code in a file, set the
     9  +4 2014 sep 28django integralDjango snippets: Currency Field Admin IntegrationThe BooleanField and DecimalField elif blocks are only included in this snippet to give context in the admin_list.py. Insert the CurrencyField ...
     9  +3 2014 sep 27django admin filter dropdowndjangosnippets : admin filters as select boxesdjangosnippets · Add a snippet · All ... admin filters as select boxes. Author: gzy .... to keep the drop down box neatly centred in the filter div. #.
     9  ~ 2014 sep 26wymeditor replacing urls src<script type="text/javascript" src ="/media/ wymeditor /plugins/jquery. wymeditor .
     9  +10 2014 sep 24django group bydjangosnippets : Custom SQL via subqueryManager): def top_rated(self): subquery = """(SELECT app_rating.item_id, AVG( app_rating.value) AS value FROM app_rating GROUP BY  ...
     9  +11 2014 sep 13django sphinxDjango snippets: Auto-documenting Django Models with SphinxIn my sphinx documentation I really wanted a nice clean list of the fields on my Django models. The most obvious way of doing this is to add ...
     9  -3 2014 sep 11django middlewareDjango snippets: SSL MiddlewareSSL Middleware . This middleware answers the problem of redirecting to (and from) a SSL secured path by stating what paths should be ...
     9  +4 2014 aug 31django custom filterDjango snippets: Custom managers with chainable filtersCustom managers with chainable filters ... def interesting(self): return self. filter ( interesting=True) class NewsManager(models.Manager): def ...
     9  ~ 2014 aug 17last url visitedDjango snippets: Last pages the user visitedusr/bin/env python # -*- coding: UTF-8 -*- class LastVisitedMiddleware (object): """ This middleware sets the last visited url as session field""" def ...
     9  +5 2014 aug 13merchant id dineromail... payment. id i += 1 #all these fields you can check in this pdf https://mx. dineromail .com/content/IntegraciĆ³n-MX.pdf dineromail_dict[' merchant '] ...
     10  +6 2014 sep 23reportlab htmldjangosnippets: Basic PDF view mixin and utils using reportlab .Working project example: https://github.com/elena/django-pdfmixin-example Credit: For the case scenario to convert HTML pages to PDFs see ...
     10  -2 2014 sep 18django multiple uploadsDjango snippets: multiple image upload with formset example... formset imageupload imageupload-example; Score: 2 (after 2 ratings). Download · Raw. example formset views for multiple image upload .
     10  -1 2014 sep 17django simple tagDjango snippets: a simple tag with contextThis little bit of code factors out the reusable parts and makes a tag almost as simple as simple_tag. Now you can create tags like the following:
     10  +2 2014 aug 26django lat long plotDjango snippets: Fire Eagle example: views.py from wikinear.comfrom django .http import HttpResponse, HttpResponseRedirect from
     10  ~ 2014 aug 14dinero mail logoGenerate a dineromail form in python ... dineromail dineromail_dict[' header_image'] = '
     10  -1 2014 jul 31encryped paypal formDjango snippets: Encrypted paypal buttonsEncrypted paypal buttons ... your view you need to build the encrypted code for the form notify_url = 'http://www.yourdomain.com/yournotifyurl' ...
     10  +1 2014 jul 26django comment moderationDjango snippets: Unobtrusive comment moderationModeration happens in two phases: 1. If the object the comment is being posted on has a method named ``comments_open``, it will be called; ...
     11  -1 2014 sep 24django admin readonly userdjangosnippets : Readonly admin fieldstypical admin .py file: from django .contrib import admin from foo.bar import .... if request. user .is_authenticated(): ReadOnlyAdminFields. readonly  ...
     11  -5 2014 sep 22django generic views of objectsDjango snippets: Generic views with row-level permission handlingThese generic views extend default views so that they also do ... where user has access to object if designed object attribute references him.
     11  ~ 2014 sep 18django context processorDjango snippets: Lazy context processor .Sometimes you have context variables that are needed on many pages in a site, but not all. You only want them to be evaluated when actually ...
     11  +1 2014 sep 17django url reverseDjango snippets: Get admin url for a model__class__) return urlresolvers. reverse ("admin:%s_%s_change" ... Application- independent permalink to admin url for an object by dchandek 6 ...
     11  -2 2014 sep 16django comment formDjango snippets: Simple Contact FormSimple contact form , using a javascript form checker which you can use any ... models.py ############# from django import newforms as forms from django . newforms.widgets import * from django .core.mail .... Comments .
     11  -8 2014 sep 12traceback djangoDjango snippets: ReportBug() (exception emails - ala django debug It uses the base function for the traceback used by the Debug mode on Django . This is a first revision, so the emails have no decent styling, but ...
     11  ~ 2014 jul 31django ticket systemDjango snippets: Mini issue trackerINSTALLED_APPS if not app.startswith(' django .')] class Ticket (models.Model): """ Trouble tickets """ title = models.CharField(maxlength=100) ...
     12  +1 2014 oct 03django file uploadsdjangosnippets : Easy file upload handlerThis function emulates the file upload behaviour of django's admin, but can be used in any view. It takes a list of POST keys that represent ...
     12  +8 2014 oct 01wymeditor replacing urlswymeditor_filebrowser = function(wym, wdw) { // the URL to the Django ... FCKEditor replace all vLargeTextField in admin by aronchi 5 years, ...
     12  +1 2014 sep 26wymeditor replaces src img<script type="text/javascript" src ="/media/ wymeditor /plugins/jquery. wymeditor
     12  +2 2014 sep 05django whooseDjango snippets: Haystack whoosh backend for stemming non It's haystack whoosh backend code which involves stemming for specific language in time of indexing. 2 lines was changed comparing to ...
     12  -4 2014 jul 25django urls redirectDjango snippets: URL redirects middlewareimport re from django .http import HttpResponsePermanentRedirect from django . conf import settings class UrlRedirectMiddleware : """ This ...
     13  ~ 2014 sep 22django whooshdjangosnippets: Haystack whoosh backend for stemming non
     13  -4 2014 sep 18django admin usersinformation about users and groups in user admin - Django snippetsNice example on customization of contributed django admin apps. It adds the following to the user list interface: fields for is_superuser and ...
     13  ~ 2014 jul 28sql pretty printDjango snippets: Pretty print SQL of query sets1 2 3 4 5 6. import sqlparse def print_sql(qs): q = qs.query. as_sql () statement = q[ 0] % q[1] print sqlparse .format(statement, reindent=True, ...
     14  ~ 2014 sep 22django grouped byDjango snippets: Group results by a range of values in admin sidebarAdds filtering by ranges of values in the admin filter sidebar. This allows rows in numerical fields to be grouped together (in this case, group by  ...
     14  +20 2014 sep 18memcache control keyDjango snippets: Safer cache key generationIf any cache keys you generate include user (staff or public) supplied ... Replaces invalid memcache control characters with an underscore.
     14  -1 2014 sep 13django adminDjango snippets: Advanced Search in django adminThis is an example on how to create a custom advanced search (like the google advanced search page) in the admin app instead of the basic ...
     14  +2 2014 sep 06django get session idDjango snippets: User from session keydef user_from_session_key(session_key): from django .conf import settings ... This blog post outlined how to get the user from the session key: ...
     14  -3 2014 sep 05django context processorsLazy context processor . ... This solution uses the fact that the Django template language will detect and # call any callables when they are ...
     14  +7 2014 aug 13django model inheritanceDjango snippets: Model inheritance with content type and Model inheritance with content type and inheritance -aware manager ... import ContentType from django .db. models .query import QuerySet ...
     14  +5 2014 jul 30django login formDjango snippets: Simple login script from a nub#models.py class LoginForm (forms.Form): username = forms.CharField( max_length=100) password = forms.CharField(widget=forms.
     14  +87 2014 jul 24django bug reportDjango snippets: ReportBug () with tons of debug in mailDesigned and Coded by Cal Leeming for Simplicity Media Ltd # cal.leeming [at] simplicitymedialtd.co.uk ...
     15  -1 2014 sep 21snippetDjango snippets : WelcomeWelcome to Djangosnippets.org, a site for users of the Django web framework to come together and share useful " snippets " of reusable code. If you're just here ...
     15  -8 2014 sep 16jcrop how to send coordiantesDjango snippets: Jcrop FormDjango Jcrop form Author: Markus Thielen, mt@thiguten.de
     15  +4 2014 sep 11django mixinDjango snippets: LoginRequiredMixinProvides a mixin view class that requires logged-in user. 1 2 3 4 5 6 7 8 9 10. from django .contrib.auth.decorators import login_required from ...
     15  -9 2014 sep 05django form preview processDjango snippets: Complex Form PreviewComplex Form Preview .... SECRET_KEY] # ensure that we always process self. state in the same order keys = sorted(self.state.keys()) for key ...
     15  +8 2014 sep 05django jqueryDjango snippets: simple jquery examplesimple jquery example ... View: def tryit(request): """ Create a form on the fly with jquery """ if request.POST: try: #if from the new form return ...
     15  +12 2014 sep 02template tag djangoDjango snippets: Smart {% if %} template tagSmart {% if %} template tag ... A smarter {% if %} tag for django templates. ... import unittest from django import template register = template.
     15  -1 2014 aug 30django inspect dbDjango snippets: See what depends on a given modeldef get_all_models(): import types, inspect from django . db .models import loading from django . db .models import Model apps ...
     15  -1 2014 aug 11logos dinero mail
     15  +22 2014 aug 03file field in formsDjango snippets: Updated FileField / ImageField with a delete MultiValueField): widget = RemovableFileFormWidget field = forms . FileField is_image = False def __init__(self, *args, **kwargs): fields  ...
     15  +4 2014 aug 02google admin loginUse django-social-auth & Google Accounts for admin loginfrom django.conf import settings from django.contrib import admin from django. contrib.auth.views import redirect_to_login from ...
     15  +13 2014 jul 18check in templateDjango snippets: template filter to check login statusfrom django import template register = template .Library() @register.filter def check_login(request): if request.user.is_authenticated(): return True ...
    1 2 of 9 pages    




    SEMrush