Database backup with admin command
Detect type of database (MySQL, PostgreSQL or SQLite) and make backup. In this moment ONLY WORK in GNU/Linux, NOT WIN.
- database
- admin-actions
- backup
- MySQL
- admin-command
- SQLite
- PostgreSQL
Detect type of database (MySQL, PostgreSQL or SQLite) and make backup. In this moment ONLY WORK in GNU/Linux, NOT WIN.
This is an Authorization class for [Tastypie](http://django-tastypie.readthedocs.org/en/latest/authentication_authorization.html) v0.9.11 (v0.9.12 changes how Authorization works). DjangoAuthorization checks specific permissions — `add_model`, `change_model`, `delete_model`, etc. If you don't need that level of permissions checking, this might be useful. It just makes sure the User is logged in. It's equivalent to the `login_required` decorator.
Add a dummy text for your tests Copy/Paste script into management app **content/management/commands/importcontent.py** **Usage:** python manage.py importcontent 40
Add a dummy contact for your tests Copy/Paste script into management app **content/management/commands/importcontact.py** **Usage:** python manage.py importcontact
The faster you fail the faster you reach success. This management command runs tests within the django environment, but without a test database, hence the word "UNSAFE". It only runs unittests for a single application, which are not subclasses of django.test.TestCase. Django's TestCases are not supported because they attempt to purge the database. Turn this flaw into a feature by segregating testcases into those that either need or don't need the test database. This tool may not be useful in all cases, but in certain cases you can have more rapid testing iterations. I use it for certain utility applications. **Setup:** Place in <app_name>/management/commands/unsafe_test.py **Run:** $./manage.py unsafe_test <app_name>
You need jQuery and Bootstrap 2 and bootstrap-dropdown.js. Apart from that, this should be a perfect drop-in replacement for the normal select widget. A jQuery event callback maintains a hidden input field from the user's selection. Upon loading the page, the hidden input field is set. The SelectWidgetBootstrap also contains a <noscript> tag containing the normal forms.Select widget. Example usage: class MyForm(forms.Form): group = forms.ModelChoiceField(models.Group.objects.all(), widget=SelectWidgetBootstrap(), empty_label=_(u'(no group selected)'))
This is a function to take a Q object and construct a function which returns a boolean. This lets you use the exact same filter syntax that Django's managers use and apply it inside list comprehensions, or to non-persistent objects, or to objects of different types with the same attribute names.
This is a script to automatically set up a django project It takes only one argument for the project name This works for Django 1.4 It will create the following directory structure: /project /server (app name) /media: /html /css /js /img
Convert dict to ul
for models.ForeignKey
class ImageInline(TabularInline): formfield_overrides = { models.ImageField: { 'widget': ImageWidget }, }
added commands: altersql - shows sql code with alter queries alterdb - apply alter queries. parameters: --showsql - show queries --app=APPLICATION - alter only selected application [you need clone this repo](https://bitbucket.org/certator/django_snippets)
These are my working settings for a postgress database on heroku, after they removed automatic inyection of the values.
You can customize the format. Also you can display variable values that support __str__ or another object-to-string method.
Middleware for logging view execution time
3109 snippets posted so far.