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.conf import settings | |
| from django.utils.translation import activate | |
| from django.views.generic.base import View | |
| from rest_framework.generics import GenericAPIView | |
| from rest_framework.response import Response | |
| class TranslatableMixin(View): | |
| def language_code(self): | |
| language = self.request.data.get('language', None) |
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.conf import settings | |
| from rest_framework import serializers | |
| class TranslatableField(serializers.Serializer): | |
| code = serializers.CharField() | |
| translation = serializers.CharField(allow_null=True, allow_blank=True) | |
| def update_data_with_translations(validated_data, field): |
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.conf import settings | |
| from rest_framework import serializers | |
| from models import Movie | |
| from translations_utils import TranslatableField, retrieve_data_with_translations, update_data_with_translations | |
| class MovieCreateUpdateSerializer(serializers.Serializer): | |
| id = serializers.IntegerField(required=False) | |
| name = TranslatableField(many=True) |
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 pdfkit | |
| import os | |
| import base64 | |
| from django.core.files import File | |
| from django.template.loader import render_to_string | |
| class Exporter: | |
| def params(self): |
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
| {% load static %} | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"/> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> | |
| </head> | |
| <body> | |
| <table> | |
| <tr> |
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 pdfkit | |
| import os | |
| from django.core.files import File | |
| from django.template.loader import render_to_string | |
| class Exporter: | |
| def params(self): | |
| return {} |
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 pdfkit | |
| import os | |
| from django.core.files import File | |
| from django.template.loader import render_to_string | |
| class Exporter: | |
| def params(self): | |
| return {} |
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 import login | |
| from django.http import JsonResponse | |
| from rest_framework.views import APIView | |
| from users.token_manager.password_reset import PasswordResetService | |
| from users.serializers import UserSerializer | |
| class RegisterView(APIView): | |
| def post(self, request): |
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.conf import settings | |
| from mailing.mailers import RegisterMailer | |
| from users.models.tokens import ConfirmationToken | |
| from users.token_manager.base import TokenManager | |
| class EmailConfirmationService(TokenManager): | |
| def _token_class(self): |
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.conf import settings | |
| from mailing.mailers import PasswordResetMailer | |
| from users.models.tokens import PasswordToken | |
| from users.token_manager.base import TokenManager | |
| class PasswordResetService(TokenManager): | |
| def __init__(self, email, password, key=None): |
NewerOlder