Django app packaging the best snippets found on http://djangosnippets.org
Project description
Django Snippets Cream
Django app packaging the best snippets found on http://djangosnippets.org
Included Snippets
963. RequestFactory
Easily create mock request objects for use in testing.
Original Snippet - http://djangosnippets.org/snippets/963/
Example:
from snippetscream import RequestFactory request = RequestFactory().get('/')
1031. Model Inheritance With Content Type
Supplies a model class aware of its child models, allowing for child class objects to be resolved from parent objects.
Original Snippet - http://djangosnippets.org/snippets/1031/
Example:
=== example usage in interpreter === >>> from snippetscream import PolyModel >>> class TrunkModel(PolyModel): ... pass >>> class LeafModel(TrunkModel): ... pass >>> leaf_obj = LeafModel() >>> leaf_obj.save() >>> trunk_obj = TrunkModel.objects.get(id=leaf_obj.id) >>> trunk_obj ... <TrunkModel: TrunkModel object> >>> trunk_obj.as_leaf_class() ... <LeafModel: LeafModel object>
1378. Resolve URLs to View Name
Supplies a resolve_to_name function that takes in a path and resolves it to a view name or view function name (given that the path is actually defined in your urlconf).
Original Snippet - http://djangosnippets.org/snippets/1378/
Example:
=== urlconf ==== urlpatterns = patterns('' (r'/some/url', 'app.views.view'), (r'/some/other/url', 'app.views.other.view', {}, 'this_is_a_named_view'), ) === example usage in interpreter === >>> from snippetscream import resolve_to_name >>> print resolve_to_name('/some/url') 'app.views.view' >>> print resolve_to_name('/some/other/url') 'this_is_a_named_view'
Changelog
0.0.2
Included 1031 - http://djangosnippets.org/snippets/1031/
0.0.1
Initial release
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file django-snippetscream-0.0.2.tar.gz
.
File metadata
- Download URL: django-snippetscream-0.0.2.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 408d49fb67af7ccd2204707c0f4b939f2762d796a4d6e54c03f1e6c3d4fd3ec4 |
|
MD5 | eaee5c5d38ffc62fd63452936872242f |
|
BLAKE2b-256 | b0f062b16708b78b8cfbee313daa5ad9200877be769abf7e2b011a15bf50575f |
Provenance
File details
Details for the file django_snippetscream-0.0.2-py2.6.egg
.
File metadata
- Download URL: django_snippetscream-0.0.2-py2.6.egg
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e157a23e1860b214933ba99b45513d235a586c5f7021edf6099f106c052929a6 |
|
MD5 | 7a2325a4b2c57b72df584c96781a3cf8 |
|
BLAKE2b-256 | 9105a3e8fda234c8a539ed4f25b52b871cb394402397d94482fc0fbaf465861b |
Provenance
File details
Details for the file django_snippetscream-0.0.2-py2.5.egg
.
File metadata
- Download URL: django_snippetscream-0.0.2-py2.5.egg
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee005b4910352d47704b25bb9f1b724ecd4003b8de28fd79f504dd4611e59281 |
|
MD5 | 4595b23ee4c5e00a0b33088a5396ee1c |
|
BLAKE2b-256 | 739cdf815f8a32b1ca894bb87d6f29702ce183bd68bd3551f965b7b2353cef00 |