-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#72 refactoring [unicode] use a single unicode version in lgr-django
- Loading branch information
1 parent
d7a92be
commit c0b3c81
Showing
28 changed files
with
44 additions
and
292 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
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
15 changes: 0 additions & 15 deletions
15
src/lgr_advanced/lgr_editor/tests/test_meta_data_unicode_version.py
This file was deleted.
Oops, something went wrong.
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
Empty file.
This file was deleted.
Oops, something went wrong.
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
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
Empty file.
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,44 +0,0 @@ | ||
import unittest | ||
|
||
from lgr_models.models.unicode import UnicodeVersion | ||
from lgr_models.tests.test_unicode_version import TestUnicodeVersion | ||
|
||
|
||
class TestUnicodeVersions(TestUnicodeVersion): | ||
|
||
@unittest.skip('Disabled for now') | ||
def test_unicode_tab(self): | ||
self.login_admin() | ||
|
||
response = self.client.get('/m/unicode-versions') | ||
self.assertContains(response, f'<td>{self.a_version_supported}</td>', status_code=200) | ||
# check that all unicode versions are unactivated by default, and that the hidden input is the reverse: True: | ||
self.assertContains(response, '<input type="hidden" name="activated" value="True">') | ||
|
||
@unittest.skip('Disabled for now') | ||
def test_unicode_edit(self): | ||
self.login_admin() | ||
|
||
self.assertEqual(self.a_unicode_version.activated, False) | ||
self.client.post(f'/m/unicode-versions/{self.a_unicode_version.pk}/update', {'activated': True}) | ||
new_unicode_version = UnicodeVersion.objects.get(version=self.a_version_supported) | ||
self.assertEqual(new_unicode_version.activated, True) | ||
self.assertListEqual([new_unicode_version], list(UnicodeVersion.get_activated())) | ||
|
||
@unittest.skip('Disabled for now') | ||
def test_unicode_create(self): | ||
self.login_admin() | ||
|
||
initial_versions = list(UnicodeVersion.objects.all().values_list('version', flat=True)) | ||
|
||
new_version = '9.9.9-test' | ||
self.assertIn('10.0.0', initial_versions) | ||
self.assertNotIn(new_version, initial_versions) | ||
|
||
response = self.client.post('/m/unicode-versions/create', {'version': new_version}, follow=True) | ||
self.assertEqual(response.status_code, 200) | ||
new_versions = list(UnicodeVersion.objects.all().values_list('version', flat=True)) | ||
self.assertIn(new_version, new_versions) | ||
|
||
new_version = UnicodeVersion.objects.get(version=new_version) | ||
self.assertEqual(new_version.activated, False) | ||
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,36 +0,0 @@ | ||
from django.db.models import Value, IntegerField | ||
from django.db.models.functions import Replace, Cast | ||
from django.urls import reverse_lazy | ||
from django.views.generic import UpdateView, CreateView | ||
|
||
from lgr_manage.forms import UnicodeVersionUpdateForm, UnicodeVersionCreateForm | ||
from lgr_manage.views.common import BaseAdminMixin, BaseListAdminView | ||
from lgr_models.models.unicode import UnicodeVersion | ||
|
||
|
||
class LgrUnicodeVersionsListView(BaseListAdminView): | ||
template_name = 'lgr_manage/unicode_versions.html' | ||
# 10.0.0, 14.0.0, 9.0.0 -> 1400, 1000, 900 (to properly sort versions) | ||
queryset = UnicodeVersion.all().order_by( | ||
Cast(Replace('version', Value('.'), Value('')), output_field=IntegerField()) | ||
).reverse() | ||
model = UnicodeVersion | ||
|
||
def get_context_data(self, **kwargs): | ||
context = super().get_context_data(**kwargs) | ||
context['form'] = UnicodeVersionCreateForm() | ||
return context | ||
|
||
|
||
class LgrUnicodeVersionUpdateView(BaseAdminMixin, UpdateView): | ||
template_name = 'lgr_manage/unicode_versions.html' | ||
form_class = UnicodeVersionUpdateForm | ||
model = UnicodeVersion | ||
success_url = reverse_lazy('lgr_admin_unicode_versions') | ||
|
||
|
||
class LgrUnicodeVersionCreateView(BaseAdminMixin, CreateView): | ||
template_name = 'lgr_manage/unicode_versions.html' | ||
form_class = UnicodeVersionCreateForm | ||
model = UnicodeVersion | ||
success_url = reverse_lazy('lgr_admin_unicode_versions') | ||
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.