djangosnippets.org: Latest snippets posted by bl4th3rsk1t3https://djangosnippets.org/users/bl4th3rsk1t3/2010-03-25T02:14:13.741665-05:00bl4th3rsk1t3Generate Model Data. Lots of Options.
2010-03-25T02:14:13.741665-05:00bl4th3rsk1t3https://djangosnippets.org/snippets/1969/<p>Generate model data with this django management command!
</p>
<p>Data is generated based off of the model field types. And will also correctly generate foreign key's to other randomly generated records for join tables. And generate images with random colors and random words in the image - for image fields.
</p>
<p>You …</p>
Freely redistributableoptparse dic action
2009-07-06T02:55:02.682951-05:00bl4th3rsk1t3https://djangosnippets.org/snippets/1617/<p>An optparse action that let's you accept any parameters from the commandline. It stores them in another dictionary, inside the final options.</p>
Freely redistributablepartial tag
2009-06-01T18:31:07.886555-05:00bl4th3rsk1t3https://djangosnippets.org/snippets/1544/<p>This is another partial tag, taken from a previous partial tag.</p>
<p>The previous one assumed template locations by hardcoding in "partials/%s", etc. I took all that out, and made it work. And I took out the not needed third parameter for passing in your own data</p>
<p>So now you call …</p>
Freely redistributablesplit_contents2 for template tags
2009-06-01T18:25:28.114676-05:00bl4th3rsk1t3https://djangosnippets.org/snippets/1543/<p>Is an updated way of splitting contents for a token, it does the split, but fixes the list..</p>
<p>EX:</p>
<p>From a tag call like this: {% partial "partials/template.html" %}</p>
<p>usually you get: ['partial','"partials/template.html"']</p>
<p>notice the " double quotes</p>
<p>fixes it with: ['partial','partials/template.html']</p>
<p>takes out the " quotes</p>
Freely redistributableUpdated table tag
2009-06-01T18:06:46.602741-05:00bl4th3rsk1t3https://djangosnippets.org/snippets/1542/<p>This table tag helps with render tables, which can be fairly complex.</p>
<p>I updated the previous table tag (296).</p>
<p>I added support for oddrow,evenrow,lastcellinrow,oddcol,evencol. And made a few minor adjustments to syntax formatting, and some non needed if conditionals</p>
<p>These are all of the supported variables available in the context …</p>
Freely redistributablepavement file for deploying django projects
2009-05-23T23:43:56.158662-05:00bl4th3rsk1t3https://djangosnippets.org/snippets/1522/<p>This is the pavement file I use to deploy a django site. It's in early stages. Right now it copies everything up to the desired server over scp. But I think I'll change it to rsync in the future.</p>
<p>It requires pavement, and pexpect.</p>
<p>The pavement file takes slight instruction …</p>
Freely redistributableRender to email
2009-05-03T17:10:36.024958-05:00bl4th3rsk1t3https://djangosnippets.org/snippets/1480/<p>Renders a view to an email. You need to set all of the required settings for email support.</p>
Freely redistributableQuantize decimal template filter
2009-04-27T20:46:26.783527-05:00bl4th3rsk1t3https://djangosnippets.org/snippets/1468/<p>Takes a float number (23.456) and uses the decimal.quantize to round it to a fixed exponent. This allows you to specify the exponent precision, along with the rounding method. And is perfect for monetary formatting taking into account precision.</p>
Freely redistributable