A flatpage is a simple object with a URL, title and content. Use it for one-off, special-case pages, such as “About” or “Privacy Policy” pages, that you want to store in a database but for which you don’t want to develop a custom Django application. A flatpage can use a custom template or a default, systemwide flatpage template. It can be associated with one, or multiple, sites. This version is a fork of django.contrib.flatpages package made it multilingual.
Project description
# django-multilingual-flatpages
A flatpage is a simple object with a URL, title and content. Use it for one-off, special-case pages, such as “About” or “Privacy Policy” pages, that you want to store in a database but for which you don’t want to develop a custom Django application.
A flatpage can use a custom template or a default, systemwide flatpage template. It can be associated with one, or multiple, sites.
This version is a fork of django.contrib.flatpages package made it multilingual.
## Installation
You will need to uninstall flatpages, and remove all traces of it from the **INSTALLED_APPS**
and **MIDDLEWARES** settings.
To install the multilingual flatpages app, follow these steps:
1. Install this package:
```
$ pip install multilingual_flatpages
```
2. Install the sites framework by adding 'django.contrib.sites' to your **INSTALLED_APPS** setting, if it’s not already in there.
3. Also make sure you’ve correctly set **SITE_ID** to the ID of the site the settings file represents. This will usually be **1** (i.e. **SITE_ID = 1**, but if you’re using the sites framework to manage multiple sites, it could be the ID of a different site.
4. Add **'multilingual_flatpages'** and **'hvad'** to your **INSTALLED_APPS** setting.
5. Add **multilingual_flatpages.middleware.FlatpageFallbackMiddleware'** in your **MIDDLEWARES** list.
6. Add an entry in your URLconf. For example:
```python
from multilingual_flatpages import views as multilingual_flatpages_views
...
urlpatterns = [
url(r'^(?P<flatpage_slug>.*)$', multilingual_flatpages_views.flatpage, name='multilingual_flatpages'),
]
```
7. Run the command **manage.py migrate**.
## Getting a URL of FlatPage object in your templates
The flatpages app provides a template tag that allows you to get the absolute url depending on your current language.
Like all custom template tags, you’ll need to load its custom tag library before you can use it. After loading the library, you can retrieve all current flatpages URL via the get_flatpage_url tag:
```python
{% load flatpages %}
{% get_flatpage_url 'flatpage-name' %}
```
You can also use the *get_flatpages* template tag to get all the FlatPages:
```html
{% load flatpages %}
{% get_flatpages as flatpages %}
<ul>
{% for page in flatpages %}
<li><a href="{{ page.get_absolute_url }}">{{ page.title }}</a></li>
{% endfor %}
</ul>
```
# Change Log
All notable changes to this project will be documented in this file.
0.6 (2017-01-20)
aaaaaaaaaaaaaaaa
- fix manifest [Mikel Larreategi <mlarreategi@codesyntax.com>]
- delete MO files from git [Mikel Larreategi <mlarreategi@codesyntax.com>]
0.5 (2017-01-20)
aaaaaaaaaaaaaaaa
- Update the item in urls.py [Mikel Larreategi <mlarreategi@codesyntax.com>]
- Merge pull request #3 from codesyntax/fixes [Urtzi Odriozola <uodriozola@codesyntax.com>]
- [Urtzi Odriozola <uodriozola@codesyntax.com>]
- Fixes: get_flatpages templatetag, middleware, default template [Urtzi Odriozola <uodriozola@codesyntax.com>]
- provide a default template for multilingual flatpages [Mikel Larreategi <mlarreategi@codesyntax.com>]
- document how to use the get_flatpages templatetag [Mikel Larreategi <mlarreategi@codesyntax.com>]
- fix the get_flatpages templatetag [Mikel Larreategi <mlarreategi@codesyntax.com>]
- document how to enable the Fallback middleware [Mikel Larreategi <mlarreategi@codesyntax.com>]
- Merge pull request #2 from codesyntax/hvad [Urtzi Odriozola <uodriozola@codesyntax.com>]
- [Urtzi Odriozola <uodriozola@codesyntax.com>]
- add hvad installation to README [Urtzi Odriozola <uodriozola@codesyntax.com>]
- add hvad installation to README [Mikel Larreategi <mlarreategi@codesyntax.com>]
- Merge pull request #1 from codesyntax/docs [Urtzi Odriozola <uodriozola@codesyntax.com>]
- [Urtzi Odriozola <uodriozola@codesyntax.com>]
- Docs improved [Urtzi Odriozola <uodriozola@codesyntax.com>]
- document how to import the view [Mikel Larreategi <mlarreategi@codesyntax.com>]
- improve readme [Mikel Larreategi <mlarreategi@codesyntax.com>]
- add README and CHANGELOG as long_description to show on PYPI [Mikel Larreategi <mlarreategi@codesyntax.com>]
0.4 (2016-11-29)
aaaaaaaaaaaaaaaa
- Nothing changed yet.
0.3 (2016-11-29)
aaaaaaaaaaaaaaaa
- Nothing changed yet.
0.2 (2016-11-29)
aaaaaaaaaaaaaaaa
- Preparing release 0.1 [Urtzi Odriozola <uodriozola@codesyntax.com>]
0.1 (2016-11-29)
aaaaaaaaaaaaaaaa
- Nothing changed yet.
0.1 (2016-11-29)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.1] - 2016-11-29
### Added
- hvad translation system
- tinymce 4.0.0 editor to the content field
### Changed
- Renamed url field to slug
- Flatpage models, admin, forms to fit hvad translations in: title, content, slug
A flatpage is a simple object with a URL, title and content. Use it for one-off, special-case pages, such as “About” or “Privacy Policy” pages, that you want to store in a database but for which you don’t want to develop a custom Django application.
A flatpage can use a custom template or a default, systemwide flatpage template. It can be associated with one, or multiple, sites.
This version is a fork of django.contrib.flatpages package made it multilingual.
## Installation
You will need to uninstall flatpages, and remove all traces of it from the **INSTALLED_APPS**
and **MIDDLEWARES** settings.
To install the multilingual flatpages app, follow these steps:
1. Install this package:
```
$ pip install multilingual_flatpages
```
2. Install the sites framework by adding 'django.contrib.sites' to your **INSTALLED_APPS** setting, if it’s not already in there.
3. Also make sure you’ve correctly set **SITE_ID** to the ID of the site the settings file represents. This will usually be **1** (i.e. **SITE_ID = 1**, but if you’re using the sites framework to manage multiple sites, it could be the ID of a different site.
4. Add **'multilingual_flatpages'** and **'hvad'** to your **INSTALLED_APPS** setting.
5. Add **multilingual_flatpages.middleware.FlatpageFallbackMiddleware'** in your **MIDDLEWARES** list.
6. Add an entry in your URLconf. For example:
```python
from multilingual_flatpages import views as multilingual_flatpages_views
...
urlpatterns = [
url(r'^(?P<flatpage_slug>.*)$', multilingual_flatpages_views.flatpage, name='multilingual_flatpages'),
]
```
7. Run the command **manage.py migrate**.
## Getting a URL of FlatPage object in your templates
The flatpages app provides a template tag that allows you to get the absolute url depending on your current language.
Like all custom template tags, you’ll need to load its custom tag library before you can use it. After loading the library, you can retrieve all current flatpages URL via the get_flatpage_url tag:
```python
{% load flatpages %}
{% get_flatpage_url 'flatpage-name' %}
```
You can also use the *get_flatpages* template tag to get all the FlatPages:
```html
{% load flatpages %}
{% get_flatpages as flatpages %}
<ul>
{% for page in flatpages %}
<li><a href="{{ page.get_absolute_url }}">{{ page.title }}</a></li>
{% endfor %}
</ul>
```
# Change Log
All notable changes to this project will be documented in this file.
0.6 (2017-01-20)
aaaaaaaaaaaaaaaa
- fix manifest [Mikel Larreategi <mlarreategi@codesyntax.com>]
- delete MO files from git [Mikel Larreategi <mlarreategi@codesyntax.com>]
0.5 (2017-01-20)
aaaaaaaaaaaaaaaa
- Update the item in urls.py [Mikel Larreategi <mlarreategi@codesyntax.com>]
- Merge pull request #3 from codesyntax/fixes [Urtzi Odriozola <uodriozola@codesyntax.com>]
- [Urtzi Odriozola <uodriozola@codesyntax.com>]
- Fixes: get_flatpages templatetag, middleware, default template [Urtzi Odriozola <uodriozola@codesyntax.com>]
- provide a default template for multilingual flatpages [Mikel Larreategi <mlarreategi@codesyntax.com>]
- document how to use the get_flatpages templatetag [Mikel Larreategi <mlarreategi@codesyntax.com>]
- fix the get_flatpages templatetag [Mikel Larreategi <mlarreategi@codesyntax.com>]
- document how to enable the Fallback middleware [Mikel Larreategi <mlarreategi@codesyntax.com>]
- Merge pull request #2 from codesyntax/hvad [Urtzi Odriozola <uodriozola@codesyntax.com>]
- [Urtzi Odriozola <uodriozola@codesyntax.com>]
- add hvad installation to README [Urtzi Odriozola <uodriozola@codesyntax.com>]
- add hvad installation to README [Mikel Larreategi <mlarreategi@codesyntax.com>]
- Merge pull request #1 from codesyntax/docs [Urtzi Odriozola <uodriozola@codesyntax.com>]
- [Urtzi Odriozola <uodriozola@codesyntax.com>]
- Docs improved [Urtzi Odriozola <uodriozola@codesyntax.com>]
- document how to import the view [Mikel Larreategi <mlarreategi@codesyntax.com>]
- improve readme [Mikel Larreategi <mlarreategi@codesyntax.com>]
- add README and CHANGELOG as long_description to show on PYPI [Mikel Larreategi <mlarreategi@codesyntax.com>]
0.4 (2016-11-29)
aaaaaaaaaaaaaaaa
- Nothing changed yet.
0.3 (2016-11-29)
aaaaaaaaaaaaaaaa
- Nothing changed yet.
0.2 (2016-11-29)
aaaaaaaaaaaaaaaa
- Preparing release 0.1 [Urtzi Odriozola <uodriozola@codesyntax.com>]
0.1 (2016-11-29)
aaaaaaaaaaaaaaaa
- Nothing changed yet.
0.1 (2016-11-29)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.1] - 2016-11-29
### Added
- hvad translation system
- tinymce 4.0.0 editor to the content field
### Changed
- Renamed url field to slug
- Flatpage models, admin, forms to fit hvad translations in: title, content, slug
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
multilingual_flatpages-0.6.tar.gz
(52.8 kB
view hashes)
Close
Hashes for multilingual_flatpages-0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a989a1035d97d1e1196b20257e89e355570e5802276e008e2d43914903c22f6 |
|
MD5 | 42d40a39e6cf014864a7324344dc476f |
|
BLAKE2b-256 | f4b74a60c046d434153efe33743a65281067d0097116c7bebc2943fa6d6040ee |