Skip to content

Instantly share code, notes, and snippets.

@aleksey-rezvov
Created December 28, 2021 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save aleksey-rezvov/6fa1d762508d405142e6ce771b195c17 to your computer and use it in GitHub Desktop.
Save aleksey-rezvov/6fa1d762508d405142e6ce771b195c17 to your computer and use it in GitHub Desktop.
from django.db import models
class Product(models.Model):
categories = models.ManyToManyField(Category,
related_name='products',
blank=True, verbose_name=u"категории")
related_products = models.ManyToManyField('Product',
blank=True,
verbose_name="связанные продукты")
sku = models.CharField(u'артикул', max_length=128, validators=[validators.check_bad_symbols], unique=True)
price = models.DecimalField(u'цена', max_digits=12, decimal_places=4)
slug = models.SlugField(u'slug', max_length=80, db_index=True, unique=True)
name = models.CharField(u'название', max_length=128)
title = models.CharField(u'заголовок страницы (<title>)', max_length=256, blank=True)
description = models.TextField(u'описание', blank=True)
def live_search(request):
q = request.GET.get("q", "")
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment