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 import forms | |
| from comments.models import Comment | |
| class CommentForm(forms.ModelForm): | |
| class Meta: | |
| model = Comment | |
| fields = ('__all__') |
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
| class Species(models.Model): | |
| class Meta: | |
| verbose_name = 'Вид' | |
| verbose_name_plural = 'Вид' | |
| species = models | |
| class Genus(models.Model): | |
| class Meta: |
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
| function add_tag(type) { | |
| var data = { | |
| 'button_id': type | |
| }; | |
| console.log(type) | |
| $.ajax({ | |
| url: window.location.href, | |
| data: data, | |
| dataType: 'json', |
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
| '''пересохраняем все файлы в xlsx''' | |
| for i in get_price: | |
| split, file_extension = os.path.splitext(i) | |
| import pyexcel as p | |
| '''пересохраняем xls в xlsx''' | |
| p.save_book_as(file_name=os.path.normpath(base_dir_price + i), | |
| dest_file_name=os.path.normpath(convert_base_dir_price + f'{split}.xlsx')) |
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
| <h2>{{ user.get_full_name }}</h2> | |
| <ul> | |
| <li>Имя пользователя: {{ user.username }}</li> | |
| <li>Местоположение: {{ user.profile.location }}</li> | |
| <li>Дата рождения: {{ user.profile.birth_date }}</li> | |
| </ul> |
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.contrib.auth.models import User | |
| from allauth.account.models import EmailAccount | |
| from allauth.exceptions import ImmediateHttpResponse | |
| from allauth.socialaccount.adapter import DefaultSocialAccountAdapter | |
| class MyAdapter(DefaultSocialAccountAdapter): | |
| def pre_social_login(self, request, sociallogin): | |
| # This isn't tested, but should work |
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 threading | |
| import time | |
| main_queue = queue.Queue() | |
| thread_number = 10 | |
| thread_list = [] | |
| def thread_func(name): | |
| while True: | |
| time.sleep(0.5) |
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 status_page(request): | |
| if request.method == 'POST': | |
| -Магия- | |
| email = request.POST.get('email') | |
| # сумма которая списана с отправителя | |
| withdraw_amount = request.POST.get('withdraw_amount') | |
| a = f'{notification_type}&{operation_id}&{amount}&{currency}&{datetime}&{sender}&{codepro}&{notification_secret}&{label}' | |
| sha1_hash2 = sha1(f'{a}'.encode('UTF8')).hexdigest() |
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
| class BalanceConsumer(AsyncWebsocketConsumer): | |
| async def connect(self): | |
| self.user = self.scope['user'] | |
| if self.user.is_authenticated: | |
| # text_data = json.dumps({ | |
| # 'message': '99999999' | |
| # }) | |
| self.user_name = str(self.user.username) | |
| await self.channel_layer.group_add( |
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
| logging.basicConfig(level=logging.DEBUG) | |
| logger = init_logger(__name__, testing_mode=True) | |
| logger.debug('Testing mode = True') | |
| import logging | |
| import colorlog | |
| def init_logger(dunder_name, testing_mode) -> logging.Logger: |
OlderNewer