This file contains hidden or 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 soulteary/prebuilt-nginx-modules:ngx-1.21.1-redis-0.3.9 as builder | |
FROM nginx:1.21.1-perl | |
RUN rm /etc/nginx/conf.d/default.conf | |
COPY ./Dockerfiles/settings/nginx/nginx.conf /etc/nginx/nginx.conf | |
COPY ./Dockerfiles/settings/nginx/medicine.conf /etc/nginx/conf.d/medicine.conf | |
COPY ./Dockerfiles/ssl-certs/ /etc/nginx/ssl-certs/ |
This file contains hidden or 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
import re,base64, quopri | |
def encoded_words_to_text(encoded_words): | |
encoded_word_regex = r'=\?{1}(.+)\?{1}([B|Q])\?{1}(.+)\?{1}=' | |
charset, encoding, encoded_text = re.match(encoded_word_regex, encoded_words).groups() | |
if encoding is 'B': | |
byte_string = base64.b64decode(encoded_text) | |
elif encoding is 'Q': | |
byte_string = quopri.decodestring(encoded_text) |
This file contains hidden or 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
import os | |
import pathlib | |
import shutil | |
path = pathlib.Path(instance.input_file.path) | |
new_input_path = os.path.join(path.parents[1], str(instance.id)) | |
new_input_filepath = os.path.join(new_input_path, path.name) | |
shutil.move(str(path.parent), new_input_path) | |
input_file = str(pathlib.Path(new_input_filepath).relative_to(settings.MEDIA_ROOT)) |
This file contains hidden or 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
$('#id_title').val(data['title']); | |
$('#id_page_meta-0-title').val(data['meta_title']); | |
$('#id_page_meta-0-description').val(data['meta_description']); | |
$('#id_page_meta-0-keywords').val(data['meta_keywords']); | |
CKEDITOR.instances['id_body'].setData(data['text']); |
This file contains hidden or 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
# Generated by Django 2.2.6 on 2019-12-30 05:10 | |
from django.db import migrations | |
def migrate_code(apps, schema_editor): | |
ContentType = apps.get_model('contenttypes', 'ContentType') | |
Permission = apps.get_model('auth', 'Permission') | |
ModelClass = apps.get_model('app', 'Model') | |
ctype = ContentType.objects.get_for_model(ModelClass) |
This file contains hidden or 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 jinja2 import Environment, TemplateError, TemplateSyntaxError, UndefinedError | |
jinja_env = Environment() | |
template = """ | |
{{ ticket.period }} | |
""" | |
ticket = TicketSerializer(Ticket.objects.get(id=1268075)).data | |
pprint(ticket) | |
code = jinja_env.from_string(template) | |
print(code.render({ |
This file contains hidden or 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.dispatch import receiver | |
from django.db.models.signals import post_save | |
from .models import ModelName | |
__all__ = [ | |
'model_name_post_create' | |
] | |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
# Generated by Django 1.9.13 on 2019-08-18 11:25 | |
from __future__ import unicode_literals | |
from django.db import migrations | |
def migrate_code(apps, schema_editor): | |
PatientInsurance = apps.get_model('patient', 'PatientInsurance') | |
NSI_05 = apps.get_model('directory', 'NSI_05') |
This file contains hidden or 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
import os | |
import environ | |
import datetime | |
import django as django_module | |
from django.conf.locale.ru import formats as ru_formats | |
ru_formats.DATE_FORMAT = 'd.m.Y' | |
ru_formats.DATETIME_FORMAT = 'd.m.Y G:i' |
This file contains hidden or 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 migrate_code(apps, schema_editor): | |
Model = apps.get_model('App', 'ModelName') | |
def reverse_code(apps, schema_editor): | |
return | |
class Migration(migrations.Migration): |
NewerOlder