-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
162 Move tag stuff from SE site to catalog module #163
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One moment with a test class
catalog/models.py
Outdated
default=0, blank=True, db_index=True, verbose_name=_('position'), | ||
) | ||
|
||
slug = models.SlugField(default='') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add unique constraint to it. It will help to ensure consistency of db
catalog/models.py
Outdated
unidecode(self.name.replace('.', '-').replace('+', '-')) | ||
) | ||
doubled_tag_qs = self.__class__.objects.filter(slug=self.slug) | ||
if doubled_tag_qs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doubled_tag_qs.exists()
may be better for this
catalog/models.py
Outdated
)) | ||
|
||
|
||
def serialize_tags( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems Tag.objects.serialize_to_url(...)
looks better and maybe more convenient, so let's create todo for it
tests/catalog/models.py
Outdated
@@ -38,3 +41,27 @@ def get_absolute_url(self): | |||
@property | |||
def image(self): | |||
return 'no-image-right-now' | |||
|
|||
|
|||
class TagTest(TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module serves to implement mock models, but not for tests, so let's remove this class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@artemiy312 , i meant TagModel module from SE.
We'll move it from SE to this place in with pdd issue defined below.
https://github.com/fidals/shopelectro/blob/master/shopelectro/tests/tests_models.py#L30
I'll rename it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One moment with a test class
catalog/models.py
Outdated
)) | ||
|
||
|
||
# @todo #162:15m Move serialize_tags TagQuerySet's method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move serialize_tags to ...
#162