Snippet List
Generate model data with this django management command!
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.
You can supply quite a few parameters that control how the data is generated. And you can control it per field, per model. Or you can supply your own callable function which you can return your own random data.
**SEE THE DOCS / EXAMPLE IN THE CODE SNIPPET FOR AVAILABLE OPTIONS, AND HOW TO CONTROL GENERATED DATA PARAMETERS**
You can generate data that looks like real content, without having to write fixtures and such. Just generate it!
It can generate data for these types of fields:
EmailField
SlugField
BooleanField
DateField
DateTimeField
TimeField
IntegerField
DecimalField
TextField
CharField
IPAddressField
URLField
SmallIntegerField
PositiveSmallIntegerField
PositiveIntegerField
ImageField
There are also a few callables included that you can use to generate this kind of data:
zip, extended zip, hashkey and uuid
It's also worth noting that I keep this project up to date on my own git repository. There are a few fonts you'll need if you want to generate imaages, included in my git repo.
http://gitweb.codeendeavor.com/?p=dilla.git;a=summary
- model
- random
- data
- management
- command
- lipsum
This is another partial tag, taken from a previous partial tag.
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
So now you call like this:
{% partial "partials/mypartial.html" %}
It passes the template context var into the partial, so anything you do in the main template, will work in the partial
Just make sure you've got all the right imports.
Is an updated way of splitting contents for a token, it does the split, but fixes the list..
EX:
From a tag call like this: {% partial "partials/template.html" %}
usually you get: ['partial','"partials/template.html"']
notice the " double quotes
fixes it with: ['partial','partials/template.html']
takes out the " quotes
This table tag helps with render tables, which can be fairly complex.
I updated the previous table tag (296).
I added support for oddrow,evenrow,lastcellinrow,oddcol,evencol. And made a few minor adjustments to syntax formatting, and some non needed if conditionals
These are all of the supported variables available in the context
{{table.counter0}}
{{table.counter}}
{{table.rowcounter0}}
{{table.rowcounter}}
{{table.startrow}}
{{table.endrow}}
{{table.oddrow}}
{{table.evenrow}}
{{table.firstrow}}
{{table.lastrow}}
{{table.firstcell}}
{{table.lastcell}}
{{table.lastcellinrow}}
{{table.evencol}}
{{table.oddcol}}
{{table.parenttable}}
- template
- tag
- python
- table
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.
It requires pavement, and pexpect.
The pavement file takes slight instruction from your settings.py file. For server information, and "lib_apps" to copy into the lib directory.
An example of a settings file that I use with this pavement file:
http://gitweb.codeendeavor.com/?p=django_empty.git;a=blob_plain;f=settings.py;h=23bda7d2a1eb2a52ca0859004ecccd206dade4ec;hb=5d672178dab282caeed5ff0de7ed807c72e44f74
Specifically, check out the bottom for two vars: "LIB_APPS" and "DEPLOYMENTS"
A good example of my empty django project is here:
http://gitweb.codeendeavor.com/?p=django_empty.git;a=tree;h=5d672178dab282caeed5ff0de7ed807c72e44f74;hb=5d672178dab282caeed5ff0de7ed807c72e44f74
I think the one thing that's missing is a way to re-spawn fcgi processes. Which I'll hopefully get around to adding sometime soon.
Also, I need to do a little work at making sure source control files don't get pushed through scp.
- django
- python
- deploy
- paver
- pavement
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.
bl4th3rsk1t3 has posted 8 snippets.