@djangoproject · Post #570 · 08.02.2018 г., 19:28
https://blog.cloudboost.io/react-redux-webpack-3-django-nov-2017-53a09d09cf75 #React + #Redux + Webpack 3 + #Django (Nov 2017)
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #397 · 12 ное.
Использование Pydantic сегодня стало нормой, и это правильно. Но иногда на ревью вижу, что используют его не всегда корректно. Например, метод BaseModel.model_dump() по умолчанию не преобразует стандартные типы, такие как datetime, UUID или Decimal, в простой сериализуемый для JSON вид. Тогда пишут кастмоный сериализатор для этих типов чтобы функция json.dump() не падала с ошибкой. import uuid from datetime import datetime from decimal import Decimal from uuid import UUID from pydantic import BaseModel class MyModel(BaseModel): id: UUID date: datetime value: Decimal obj = MyModel( id=uuid.uuid4(), date=datetime.now(), value='1.23' ) print(obj.model_dump()) # не подходит для json.dump # { # 'id': UUID('4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1'), # 'date': datetime.datetime(2025, 12, 12, 12, 12, 12, 111111), # 'value': Decimal('1.23') # } # добавляем свой кастомный сериализатор json.dumps(obj.model_dump(), cls=MySerializer) # { # 'id': '4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1', # 'date': '2025-12-12T12:12:12.111111', # 'value': '1.23' # } В данном случае класс MySerializer обрабатывает datetime, UUID и Decimal. Например так: class MySerializer(json.JSONEncoder): def default(self, o): if isinstance(o, Decimal): return str(o) elif isinstance(o, datetime): return o.isoformat() elif isinstance(o, UUID): return str(o) return super().default(o) Специально для тех, кто всё еще так делает - в этом нет необходимости! Pydantic может это сделать сам, просто нужно добавить параметр mode="json". json.dumps(obj.model_dump(mode="json")) # { # 'id': '4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1', # 'date': '2012-12-12T12:12:12.111111', # 'value': '1.23' # } #pydantic#libs
Пребарај: #redux
@djangoproject · Post #570 · 08.02.2018 г., 19:28
https://blog.cloudboost.io/react-redux-webpack-3-django-nov-2017-53a09d09cf75 #React + #Redux + Webpack 3 + #Django (Nov 2017)
@djangoproject · Post #567 · 01.02.2018 г., 10:59
https://hackernoon.com/shape-your-redux-store-like-your-database-98faa4754fd5 Using the #Redux Store Like a Database #React #Django
@thedevs · Post #1179 · 21.07.2018 г., 19:00
What Is Redux: a designer’s guide. #article#tutorial#redux#design#js @thedevs https://kutt.it/DNkfgP
@thedevs · Post #1234 · 30.09.2018 г., 09:53
Immutability in React and Redux: the complete guide. #article#tutorial#js#react#redux @thedevs https://kutt.it/DKHpWD
@thedevs · Post #1163 · 04.07.2018 г., 18:34
Understanding Redux: the world’s easiest guide to beginning Redux. #article#tutorial#react#redux#js @thedevs https://kutt.it/N81D6p
@githubtrending · Post #15034 · 07.08.2025 г., 11:30
#javascript#antd#music#music_player#nodejs#react#react_router#redux#webapp#webpack Copper Bell is a free website app focused on listening to music. It offers many songs and has a simple, clean design that makes it easy to find and play your favorite music. You can search for songs, make playlists, read scrolling lyrics, save songs, and create your own song lists. It does not have live broadcasts, social features, or ads, so there are no distractions and you get a pure music experience. You can use it on any modern web browser without installing anything. It works on many devices, including tablets. This way, you can enjoy music, manage your songs, and discover new tunes easily anytime and anywhere. https://github.com/enzeberg/tonzhon-music