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.db import models | |
# Assuming this model. | |
class Example(models.Model): | |
image = models.ImageField(upload_to="somewhere/special") | |
# You want to set this field to point to an existing image (in a script, or a view, etc.). | |
example = Example.objects.get(id=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
import datetime | |
from typing import Optional | |
from redis_om import ( | |
EmbeddedJsonModel, | |
JsonModel, | |
Field, | |
Migrator, | |
) | |
from redis_om import get_redis_connection |
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
import datetime | |
from typing import Optional | |
from pydantic import EmailStr | |
from redis_om import ( | |
Field, | |
HashModel, | |
Migrator | |
) |
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
import datetime | |
from typing import Optional | |
from pydantic import EmailStr, ValidationError | |
from redis_om import HashModel | |
class Customer(HashModel): | |
first_name: str |
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
import datetime | |
from typing import Optional | |
from pydantic import EmailStr | |
from redis_om import HashModel | |
class Customer(HashModel): | |
first_name: str |
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
Moved to: https://github.com/abrookins/kant |
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
Moved to: https://github.com/abrookins/kant |
This file has been truncated, but you can view the full file.
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
<scheme name="Kant" version="142" parent_scheme="Default"> | |
<option name="FONT_SCALE" value="1.0" /> | |
<metaInfo> | |
<property name="created">2020-08-11T14:43:37</property> | |
<property name="ide">Python</property> | |
<property name="ideVersion">2020.2.0.0</property> | |
<property name="modified">2020-08-11T14:43:46</property> | |
<property name="originalScheme">Kant</property> | |
</metaInfo> |
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
SiteStatsSchema = marshmallow_dataclass.class_schema(SiteStats) |
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
In [13]: SiteStatsSchema().load({"meter_reading_count": "hey"}) | |
[…] | |
ValidationError: {'meter_reading_count': ['Not a valid integer.'], 'min_wh_generated': ['Missing data for required field.'], 'last_reporting_time': ['Missing data for required field.'], 'max_wh_generated': ['Missing data for required field.'], 'max_capacity': ['Missing data for required field.']} |
NewerOlder