Pinned Loading
-
Image-Classifier-DSND
Image-Classifier-DSND PublicThis project is basically a Python application that can train an image classifier on a dataset, then predict new images using the trained model. After developing the code for an image classifier bu…
HTML 1
-
indexes_sample.py
indexes_sample.py 1# create indexes using Field.db_index value
2class Product(models.Model):
3name = models.CharField(max_length=128, db_index=True)
4upc = models.CharField(max_length=32, unique=True)
5category = models.ForeignKey(
-
caching_querysets.py
caching_querysets.py 1# instantiates a queryset and cache is empty.
2product = Product.objects.get(id=5)
34# Category object is retrieved from the database at this point
5# and the results are saved in queryset's cache.
-
async_to_sync_sample.py
async_to_sync_sample.py 1from asgiref.sync import async_to_sync
23sync_function = async_to_sync(async_function)
45@async_to_sync
-
prefetch_related.py
prefetch_related.py 1>>> Product.objects.count()
2220
34# 220 queries - __str__ is called for each product
5Product.objects.all()
-
aggregating_annotations.py
aggregating_annotations.py 1from django.db.models import Avg, Count
23# first annotates each product with number of attributes,
4# and then aggregates the average number of authors using the annotated attribute
5
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.