Login / Register

Share Snipplr

Welcome To Snipplr

Everyone's Recent Django Snippets

« Prev 1 2
Commands to dump and load a database in django
0 93 posted 7 years ago by erichlotto
It's imposible to read de "_id" field en django templates ( {{element._id}} === error) So, to read it, you must do a templatetag. Now you hace the templatetag, you can use it like this: {{element|pk}}
0 180 posted 7 years ago by viroide
Just an error log from TelecinePlay. Please.. don't share error logs in public..
0 113 posted 8 years ago by novazoo
There are so many ways to serve templates within views.py that sometimes it's hard to get a handle on which is ideal for a project. This snippet does not attempt to explain every possible way to serve a template, simply a few I've found helpful orga...
0 147 posted 8 years ago by chrisaiv
While django provides the django_admin.py cleanup script, if sessions get out of control sometimes you have to go lower level to get everything cleaned up. If the problem gets out of hand and you hit the resource limits of the machine, it is very dif...
0 164 posted 8 years ago by magicrebirth
Hate absolute Paths? Me too, I always end up forgetting to change things around when I go into production mode. Thankfully, there's a nice, clean way to have Python do all the hard work.
0 115 posted 8 years ago by chrisaiv
Not only is it really really fast; it's also order preserving and supports an optional transform function
0 137 posted 9 years ago by magicrebirth
Instead of directly edit your TEMPLATE\_CONTEXT\_PROCESSORS, import it in your app's settings.py and just append what you need. (credits: denysonique and all #django channel community)
0 94 posted 9 years ago by caruso_g
0 109 posted 9 years ago by Affix
Simula in Django i campi created e updated aggiornati automaticamente alla creazione e alla modifica del record (Versione 2 senza funzione save ridefinita)
0 113 posted 9 years ago by munkypot
<a href="http://www.bestgooglekeywordtool.com">google keyword tool</a>
0 115 posted 10 years ago by uraq
example: a method on a model that outputs a list of tuples with (attribute_name.verbose, attribute_value)
0 114 posted 10 years ago by magicrebirth
First: create a file under djangoapp/templatetags where you define your tags [e.g.: myadmin_tags.py]: Second: create the html snippets that get loaded in those tags [e.g., personfactoid_info.html]: Third: in mytemplates/admin/ modify change_for...
1 112 posted 10 years ago by magicrebirth
This function takes anything which can be dumped into JSON and returns an HTTP response of it, with the right Content-type header.
2 107 posted 10 years ago by magicrebirth
« Prev 1 2