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
def nace_childs(data, parent=''): | |
return list(filter(lambda x: x['Parent'] == parent, data)) | |
def nace_code_tree(data, parent='', max_level=4): | |
nodes = nace_childs(data, parent) | |
for node in nodes: | |
if node['Level'] < max_level: | |
childs = nace_code_tree(data, node['Code'], max_level) | |
else: |
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
[ | |
{ | |
"Level": 1, | |
"Code": "A", | |
"Parent": "", | |
"Description": "PRODUCTS OF AGRICULTURE, FORESTRY AND FISHING" | |
}, | |
{ | |
"Level": 2, | |
"Code": "1", |
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
class A4ordLoginView(TemplateView, BaseFormView): | |
template_name = 'accounts/a4ord_login.html' | |
success_url = '/' | |
forms = {'A4ordLoginForm': A4ordLoginForm, 'A4ordPasswordForm': A4ordPasswordForm} | |
form_class = A4ordLoginForm | |
prev_form_class = form_class | |
form = None | |
def post(self, request, **kwargs): | |
self.form_class = self.forms[self.request.POST['form']] |
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
class A4ordConfirmForm(CrispyForm): | |
code = forms.IntegerField(label=l_(u'Код'), required=True) | |
next_stage = None | |
form = forms.CharField() | |
def __init__(self, *args, **kwargs): | |
super(A4ordConfirmForm, self).__init__(*args, **kwargs) | |
self.session = get_current_session() | |
def get_layout(self, *args, **kwargs): |
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
from django.contrib.auth.models import AbstractUser, UserManager | |
from django.db import models | |
from django.utils.translation import gettext_lazy as _ | |
class UserStatus(models.IntegerChoices): | |
MODERATOR = 0, _("Модератор") | |
JOBSEEKER = 1, _("Соискатель") | |
EMPLOYER = 2, _("Работодатель") |
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
from django.conf import settings | |
from django.db import migrations, transaction | |
def forwards_func(apps, schema_editor): | |
if settings.DEBUG: | |
# Only in DEBUG mode! | |
try: | |
Account = apps.get_model("accounts", "Account") | |
UserStatus = apps.get_model("accounts", "UserStatus") |
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
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') |
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
table = [(593, 586, 487, '800400'), (594, 593, 487, '800800'), (595, 594, 487, '060000'), (596, 593, 487, '800800'), (592, 591, 487, '060000'), (578, 575, 487, '800800'), (581, 580, 487, '800800'), (570, 488, 487, '010100'), (627, 487, 487, '040000'), (571, 570, 487, '050000'), (572, 570, 487, '050000'), (573, 570, 487, '050000'), (574, 570, 487, '050000'), (575, 570, 487, '800400'), (576, 575, 487, '800800'), (580, 570, 487, '800400'), (579, 578, 487, '060000'), (591, 588, 487, '800800'), (582, 581, 487, '060000'), (583, 580, 487, '800800'), (584, 583, 487, '060000'), (585, 487, 487, '110101'), (586, 585, 487, '010100'), (587, 586, 487, '050000'), (588, 586, 487, '800400'), (589, 588, 487, '800800'), (590, 589, 487, '060000'), (577, 576, 487, '060000'), (569, 565, 487, '050000'), (617, 615, 487, '050000'), (618, 615, 487, '050000'), (619, 487, 487, '040000'), (620, 487, 487, '040000'), (621, 620, 487, '800500'), (622, 621, 487, '800800'), (625, 624, 487, '060000'), (624, 621, 487, '800800'), (614, 611, 487, |