[The problem](http://stackoverflow.com/questions/671369/django-specifying-a-base-template-by-directory): {% extends "./../base.html" %} won't work with extends.
It causes a lot of inconvenience, if you have an extensive hierarchy of django templates.
This library allows relative paths in argument of 'extends' and 'include' template tags. Relative path must start from "./"
Just write in your templates as follows:
```
{% load relative_path %}
{% extends "./base.html" %}
```
this will extend template "base.html", located in the same folder, where your template placed
```
{% load relative_path %}
{% extends "./../../base.html" %}
```
extend template "base.html", located at two levels higher
same things works with 'include' tag.
```
{% load relative_path %}
{% include "./base.html" %}
```
include base.html, located near of your template.
**Warning!**
The rule 'extends tag must be first tag into template' is disabled by this library.
Write your template with caution.
**Compatibility**
Code was tested with Django versions from 1.4 to 1.9
Installation.
-------------
Installation is differs for Django version 1.9 and previous versions, because 1.9 brings many changes into template's mechanizm.
**Django 1.9**
Plug reference to library code in 'TEMPLATES' key of settings.py or django.settings.configure()
```
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(ROOT_PROJECT, 'tpl').replace('\\', '/')],
'OPTIONS': {
'loaders': [
'dotted_path_to_relative_path_file.FileSystem19',
'dotted_path_to_relative_path_file.AppDirectories19',
],
'libraries': {
'relative_path': 'dotted_path_to_relative_path_file',
},
},
}]
```
**Django 1.4/1.8**
Put 'relative_path.py' file to the 'templatetags' folders of your app. (app must be included into INSTALLED_APPS tuple)
In settings.py or django.settings.configure(), replace standard django template loaders by loaders from this library
```
TEMPLATE_LOADERS = (
'dotted_path_to_relative_path_file.FileSystem',
'dotted_path_to_relative_path_file.AppDirectories',
)
```
This RSS using `Rss201rev2Feed` from Django. And we found it from source code of blog.pythonanywhere.com: https://github.com/pythonanywhere/jab/blob/master/jab/feeds.py
Demo: http://django.id/blog/feed/
Some times if third party application is not translated competelly, developer have to extract and save all of **i18n** strings of third party application to current project, somewhere in root project directory (and configure additional `LOCALE_DIRS` entry) or in any project's applications (usually named "main" or same as project).
And after, create **po** file by makemessages, completely translate it and compile it to **mo** file.
This script allows you to extract all messages (`msgid`) from all **po** files and save it in **python** file in **django** format — `_("Some i18n message")`, and also compile complex **po** file, contained all **msgids** with related **msgstrs** of third party application.
Full example:
You have third party app, which is translated to russian, but not completely and names **blog**. It contains two locale dirs and have, for example, the following structure:
blog
..locale
....ru
......LC_MESSAGES
........django.mo
........django.po
..contrib
....comments
......locale
........ru
..........LC_MESSAGES
............django.mo
............django.po
......__init__.py
......models.py
..__init__.py
..models.py
..urls.py
..views.py
Each po file may contains any set of strings, which may be duplicated accross the application and any other po files, anyway result **po** file will be contain only unique **msgids** and **msgstrs**.
This application installed by pip into virtualenv lib directory and of cource you do not want change code here.
To translate this application in your project it is possible to copy all (unstanslated) strings to you project as `ugettext` entries (usually `_("Some i18n string")`), make **po** file, translate it and compile **mo** file.
So, after call this script (for example, let it be named `pomessages.py`), you will get two files, **django.py** which contains all i18n strings and **django.po** which contains all **msgids** (i18n strings) with related translations.
`pomessages.py path/to/third-party-app/root locale [project-name:default is empty] [filename:default=django]`
In this case:
`pomessages.py path/to/blog ru blog django`
After script will be finished, in blog directory will be added two files, **django.po** and **django.mo**.
**django.py** content:
...
# blog:admin (source:ru) directory translations
# ----------------------------------------------
_("Category") # blog:models.py:10, blog:views.py:15
_("Article") # blog:models.py:20
# blog:category/admin (source:ru) directory translations
# -------------------------------------------------------
_("Add Category") # blog:category/admin/templates/admin/create.html:10
_("Edit Category") # blog:category/admin/templates/admin/change.html:20
...
**django.mo** content:
...
#
msgid ""
msgstr ""
"Project-Id-Version: Blog\n"
"POT-Creation-Date: 2016-02-08 12:00+0000\n"
"PO-Revision-Date: 2016-02-08 18:00+0000\n"
#: path/to/file.py:10
msgid "Category"
msgstr "Категория"
#: path/to/file.py:20
msgid "Article"
msgstr ""
...
After you just need to place **py** file anywhere in your project and place **po** file to the following locale directory (or merge with existing **po** file if it exists), run:
`django-admin makemessages -lru` to fix **po file** (remake it), translate missing entries and run:
`django-admin compilemessages`, reload project and you will have translated third party application.
This snippet allows you to use a new field type, RoundedDecimalField, that will automatically round any value affected to it according to the max_digits and decimal_places attributes. You will no longer receive validation errors if you use a float or a decimal with too many decimal digits.
It is a haystack custom whoosh backend which provides analyzer customisation (required `get_analyzer` method definition). That means it is possible to define any complex analyzers (see [whoosh](https://bitbucket.org/mchaput/whoosh/wiki/Home) docs and source).
Sample code shows how to use it, builtin `LanguageAnalyzer` instance configured for working with russian language used as custom analyzer.
Base idea taken from this snippet: [https://djangosnippets.org/snippets/3025/](https://djangosnippets.org/snippets/3025/)
## Watch Star Trek Beyond Online Free Putlocker
WATCH “Star Trek Beyond online full free HD HQ on watchmoviesonlinefree.ws Star Trek Beyond On-line BRRIP 2016 on watch movie streaming full Star Trek Beyond (2016) Full Movie Online | Watch Hd Movies [Leaked] Watch Star Trek Beyond [2016] Online Free Watch Star Trek Beyond (2016) full movie online free streaming Watch Star Trek Beyond Full Movie Online (2016) Free 720p~BluRay! Star Trek Beyond (2016) Online Full Movie HD (star) WATCH Star Trek Beyond Online full movie putlocker
watch star trek beyond online : Jeff Bezos, Amazon founder, has always declared fan of Star Trek and now claims to have achieved his greatest dream, make a small cameo in the latest installment of the saga. The employer has shared a video on your account Vine, where it appears characterized as one of the aliens of science fiction franchise.
The video, six seconds long, the technology mogul also shared in your Twitter profile shows unrecognizable wearing a prosthesis on his face. The image is accompanied by the message: "List of fulfilled desire. Cast, crew and Justin Lin was amazing #StarTrekBeyond @trailingjohnson "
The filmmaker Justin Lin, director of the latest installment Star Trek film, also shared an image of Bezos characterized in the set. "One of the best things that lead Trek is to have passionate people at your side as @JeffBezos. This is what we see with Lydia Wilson ", tweeted. In the snapshot is the founder of Amazon, 52, dressed in the classic uniform of the characters in the film.
Some of the actors remember Bezos's visit to the set recording as something curious. Chris Pine, who plays Captain Kirk says he did not know who it was "very important but it was safe." "I was there with his nine bodyguards and three limousines. It was very intense "says Pine, 35.
Bezos, who is a great lover of science fiction series, was told that when I was little I used to play Star Trek with friends. "When I was in fourth grade we played all the time to embody the characters of Star Trek," he said. The Star Tre tape: Beyond opens in Spain on 19 August.
Save the snippet as actions.py within your core app, and then add an action on any model you want in it's ModelAdmin definition.
Example usage:
`from actions import export_as_csv_action`
`class YourModelAdmin(admin.ModelAdmin):`
` list_display = ('field', 'get_field2')`
` actions = [export_to_csv(filename='your-model')]`
` def get_field2(self, obj):`
` return obj.field2`
I had a difficult time understanding how to delete an item from a table within a template, using a modelform. I couldn't find a good example, so I wanted to post the code that ultimately worked.
Fixed minimal version, works with Django 1.7+, tested on Django 1.9.
Add the following to your settings:
AUTHENTICATION_BACKENDS = [
'project.backends.UserModelEmailBackend', # Login w/ email
'django.contrib.auth.backends.ModelBackend', # Login w/ username
]
An example for using bootstrap theme for django-endless-pagination or django-el-pagination as asked on [http://stackoverflow.com/questions/30149152/how-to-set-bootstrap-theme-for-django-endless-pagination](http://stackoverflow.com/questions/30149152/how-to-set-bootstrap-theme-for-django-endless-pagination)
I used django-el-pagination to make it work on Django 1.9 and Bootstrap v4.0.0-alpha2, but same method should work on django-endless-pagination. For Bootstrap 3, you may consider removing extraneous classes in <li> and <a>.
An example for using bootstrap theme for django-el-pagination as asked on http://stackoverflow.com/questions/30149152/how-to-set-bootstrap-theme-for-django-endless-pagination
I used django-el-pagination to make it work on Django 1.9, but same method should work on django-endless-pagination as well.
**Use Case**: Specify the DB to run tests against. For example, use a legacy DB (un-managed), or a read-only DB where it is un-important to test creation, but important to test connection, trigger functions, and that models match schema.
**Usage**: in DATABASES setting, add:
'TEST' :{
'USEDB': 'your_test_DB_name_here',
}
and setting:
`TEST_RUNNER = 'your_app.test_runner.UseDBTestRunner' `
Advantages over --keepdb:
1. DB specific setting for multi-DB setup (e.g., default can use normal test DB, while legacy can use a pre-existing table).
2. Can specify any DB table, including the one used by the app (for non-destructive tests, or dev DB)
3. Allows testing against DB where creation or copying is prohibitive.
django-substitution-user is a project that makes it possible to substitute user, if you logged in as superuser
https://github.com/torchingloom/django-substitution-user