-
-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
446 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
from agnocomplete.core import AgnocompleteModel | ||
from agnocomplete.register import register | ||
from django.conf import settings | ||
from django.contrib.auth import get_user_model | ||
|
||
|
||
from agnocomplete.register import register | ||
from agnocomplete.core import AgnocompleteModel | ||
|
||
|
||
@register | ||
class AutocompleteUser(AgnocompleteModel): | ||
model = get_user_model() | ||
fields = settings.USER_AUTOCOMPLETE_FIELDS | ||
|
||
def item(self, current_item): | ||
data = super().item(current_item) | ||
data['url'] = current_item.get_url() | ||
data["url"] = current_item.get_url() | ||
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,35 @@ | ||
from pathlib import Path | ||
|
||
from django.core.management.base import BaseCommand | ||
from django.conf import settings | ||
from django.core.management.base import BaseCommand | ||
from django.template.loader import render_to_string | ||
from django.utils.translation import to_locale | ||
|
||
ROOT = Path(settings.PROJECT_DIR) / 'static/umap/locale/' | ||
ROOT = Path(settings.PROJECT_DIR) / "static/umap/locale/" | ||
|
||
|
||
class Command(BaseCommand): | ||
|
||
def handle(self, *args, **options): | ||
self.verbosity = options['verbosity'] | ||
self.verbosity = options["verbosity"] | ||
for code, name in settings.LANGUAGES: | ||
code = to_locale(code) | ||
if self.verbosity > 0: | ||
print("Processing", name) | ||
path = ROOT / '{code}.json'.format(code=code) | ||
path = ROOT / "{code}.json".format(code=code) | ||
if not path.exists(): | ||
print(path, 'does not exist.', 'Skipping') | ||
print(path, "does not exist.", "Skipping") | ||
else: | ||
with path.open(encoding="utf-8") as f: | ||
if self.verbosity > 1: | ||
print("Found file", path) | ||
self.render(code, f.read()) | ||
|
||
def render(self, code, json): | ||
path = ROOT / '{code}.js'.format(code=code) | ||
path = ROOT / "{code}.js".format(code=code) | ||
with path.open("w", encoding="utf-8") as f: | ||
content = render_to_string('umap/locale.js', { | ||
"locale": json, | ||
"locale_code": code | ||
}) | ||
content = render_to_string( | ||
"umap/locale.js", {"locale": json, "locale_code": code} | ||
) | ||
if self.verbosity > 1: | ||
print("Exporting to", path) | ||
f.write(content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.