-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
WIP: For logged #272
base: master
Are you sure you want to change the base?
WIP: For logged #272
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,9 @@ def visible(self): | |
|
||
def opened(self): | ||
return self.filter(is_closed=False) | ||
|
||
def for_non_logged_users(self): | ||
return self.filter(is_for_logged=False) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it may be better to change the We would otherwise be adding this new filter everywhere where visible is used. Also, since we are breaking the visible API, then the test should fail in all the places where this filtering is required (i.e: the user profile comes to mind). |
||
|
||
def global_(self): | ||
return self.filter(category__is_global=True) | ||
|
@@ -66,6 +69,7 @@ def get_public_or_404(self, pk, user): | |
else: | ||
return get_object_or_404( | ||
self.visible() | ||
.for_non_logged_users() | ||
.select_related('category__parent'), | ||
pk=pk) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ class Topic(models.Model): | |
is_globally_pinned = models.BooleanField(_("globally pinned"), default=False) | ||
is_closed = models.BooleanField(_("closed"), default=False) | ||
is_removed = models.BooleanField(default=False) | ||
is_for_logged = models.BooleanField(_("is for logged"), default=False) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May be a better name would be Don't forget to run the makemigrations command and commit the new migration file. |
||
|
||
view_count = models.PositiveIntegerField(_("views count"), default=0) | ||
comment_count = models.PositiveIntegerField(_("comment count"), default=0) | ||
|
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.
"logged users" -> "logged-in users"