{"id":21662580,"url":"https://github.com/codesyntax/django-multilingual-flatpages","last_synced_at":"2025-04-11T23:51:06.782Z","repository":{"id":57443962,"uuid":"68798278","full_name":"codesyntax/django-multilingual-flatpages","owner":"codesyntax","description":"Multilingual flatpages for django","archived":false,"fork":false,"pushed_at":"2021-04-11T23:33:17.000Z","size":259,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-25T19:48:39.879Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codesyntax.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.txt","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-21T08:49:53.000Z","updated_at":"2023-07-30T05:14:41.000Z","dependencies_parsed_at":"2022-09-14T00:52:45.324Z","dependency_job_id":null,"html_url":"https://github.com/codesyntax/django-multilingual-flatpages","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesyntax%2Fdjango-multilingual-flatpages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesyntax%2Fdjango-multilingual-flatpages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesyntax%2Fdjango-multilingual-flatpages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesyntax%2Fdjango-multilingual-flatpages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codesyntax","download_url":"https://codeload.github.com/codesyntax/django-multilingual-flatpages/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248234827,"owners_count":21069668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T10:17:05.371Z","updated_at":"2025-04-11T23:51:06.757Z","avatar_url":"https://github.com/codesyntax.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"django-multilingual-flatpages\n=============================\n\n.. image:: https://secure.travis-ci.org/codesyntax/django-multilingual-flatpages.png?branch=master\n :target: http://travis-ci.org/codesyntax/django-multilingual-flatpages\n\n.. image:: https://coveralls.io/repos/github/codesyntax/django-multilingual-flatpages/badge.svg?branch=master\n :target: https://coveralls.io/github/codesyntax/django-multilingual-flatpages?branch=master\n\n.. image:: https://landscape.io/github/codesyntax/django-multilingual-flatpages/master/landscape.svg?style=flat\n  :target: https://landscape.io/github/codesyntax/django-multilingual-flatpages/master\n  :alt: Code Health\n\n\n\nA 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.\n\nA flatpage can use a custom template or a default, systemwide flatpage template. It can be associated with one, or multiple, sites.\n\nThis version is a fork of django.contrib.flatpages package made it multilingual.\n\n\nInstallation\n------------\n\nYou will need to uninstall flatpages, and remove all traces of it from the **INSTALLED_APPS**\nand **MIDDLEWARES** settings.\n\nTo install the multilingual flatpages app, follow these steps:\n\n1. Install this package::\n\n    $ pip install multilingual_flatpages\n\n2. Install the sites framework by adding 'django.contrib.sites' to your **INSTALLED_APPS** setting, if it’s not already in there.\n\n3. 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.\n\n4. Add **'multilingual_flatpages'** and **'hvad'** to your **INSTALLED_APPS** setting.\n\n5. Add **multilingual_flatpages.middleware.FlatpageFallbackMiddleware'** in your **MIDDLEWARES** list.\n\n6. Add a **TINYMCE_DEFAULT_CONFIG** config option in your settings, for example::\n\n    TINYMCE_DEFAULT_CONFIG = {\n        'language': 'en',\n        'theme': 'modern',\n        'height': 600,\n        'plugins': [\n            'advlist autolink lists link image charmap print preview anchor',\n            'searchreplace visualblocks code fullscreen',\n            'insertdatetime media table contextmenu paste',\n        ],\n        'toolbar': 'styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media | code preview',\n        'menubar': False,\n        'media_alt_source': False,\n        'media_poster': False,\n        'media_dimensions': False,\n    }\n\n7. Add an entry in your URLconf. For example::\n\n    from multilingual_flatpages import views as multilingual_flatpages_views\n    ...\n    urlpatterns = [\n        url(r'^(?P\u003cflatpage_slug\u003e.*)$', multilingual_flatpages_views.flatpage, name='multilingual_flatpages'),\n    ]\n\n\n8. Run the command **manage.py migrate**.\n\n\nGetting a URL of FlatPage object in your templates\n--------------------------------------------------\n\n\nThe flatpages app provides a template tag that allows you to get the absolute url depending on your current language.\n\nLike 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::\n\n\n    {% load flatpages %}\n\n    {% get_flatpage_url 'flatpage-name' %}\n\n\nYou can also use the *get_flatpages* template tag to get all the FlatPages::\n\n    {% load flatpages %}\n\n    {% get_flatpages as flatpages %}\n    \u003cul\u003e\n        {% for page in flatpages %}\n            \u003cli\u003e\u003ca href=\"{{ page.get_absolute_url }}\"\u003e{{ page.title }}\u003c/a\u003e\u003c/li\u003e\n        {% endfor %}\n    \u003c/ul\u003e\n\n\nGetting the URL of the translation of a FlatPage in your template\n-----------------------------------------------------------------\n\nThis is useful if you want to provide a language change link::\n\n\n    {% load flatpages %}\n    {% get_flatpages as flatpages %}\n    \u003cul\u003e\n        {% for page in flatpages %}\n            \u003cli\u003e\u003ca href=\"{% get_translation_url page 'es'%}\"\u003e{{ page.title }}\u003c/a\u003e\u003c/li\u003e\n        {% endfor %}\n    \u003c/ul\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesyntax%2Fdjango-multilingual-flatpages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodesyntax%2Fdjango-multilingual-flatpages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesyntax%2Fdjango-multilingual-flatpages/lists"}