Skip to content

Commit

Permalink
#550 Merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
duker33 committed Sep 7, 2018
1 parent bf3146b commit dd55ab6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion shopelectro/models.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
from typing import Optional
import random
import string
from itertools import chain, groupby
from operator import attrgetter
import typing
from uuid import uuid4

from django.conf import settings
from django.db import models
from django.urls import reverse
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
from mptt.querysets import TreeQuerySet
from unidecode import unidecode

from catalog.models import (
AbstractCategory,
Expand All @@ -19,6 +25,13 @@
from pages.models import CustomPage, ModelPage, Page, SyncPageMixin, PageManager


def randomize_slug(slug: str) -> str:
slug_hash = ''.join(
random.choices(string.ascii_lowercase, k=settings.SLUG_HASH_SIZE)
)
return f'{slug}_{slug_hash}'


class SECategoryQuerySet(TreeQuerySet):
def get_categories_tree_with_pictures(self) -> 'SECategoryQuerySet':
categories_with_pictures = (
Expand Down

0 comments on commit dd55ab6

Please sign in to comment.