-
Notifications
You must be signed in to change notification settings - Fork 171
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
feat: add vertical models in tagging app #4544
Conversation
c044fe0
to
f4ae8ee
Compare
dc3b42b
to
2631aed
Compare
2293acd
to
e1a1f9b
Compare
f92312f
to
10d00e4
Compare
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.
Some tests appear to be testing django code more than our code e.g cascading behavior, uniqueness constraints. I do not think such tests add much value but it is OK if you feel otherwise.
34abf7c
to
cd0469c
Compare
self.coursevertical_admin.save_model(request, self.coursevertical, None, False) | ||
|
||
def test_save_model_as_allowed_group_user(self): | ||
"""Verify that user in allowed group can save course vertical.""" | ||
self.regular_user.groups.add(self.allowed_group) | ||
request = MockRequest(self.regular_user) | ||
self.coursevertical_admin.save_model(request, self.coursevertical, None, False) |
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.
same assertion comments.
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.
However, it's only for checking permissions, as it will raise a permission issue in case of a non-allowed user group. I'm now adding some assertions by changing a field
cd0469c
to
b32e3d0
Compare
Vertical, on_delete=models.CASCADE, null=True, blank=True, related_name="%(class)s_verticals" | ||
) | ||
sub_vertical = models.ForeignKey( | ||
SubVertical, on_delete=models.CASCADE, null=True, blank=True, related_name="%(class)s_sub_verticals" | ||
) |
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.
Why do we do this %(class)? The migrations do not translate this to anything.
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.
%(class) will pick the class name from child class
https://docs.djangoproject.com/en/dev/topics/db/models/#be-careful-with-related-name-and-related-query-name
if not self.vertical: | ||
self.vertical = self.sub_vertical.vertical # Auto-assign vertical if it's not set |
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.
missing coverage
28bffa6
to
ab65db2
Compare
PROD-4280
This PR adds the model related to vertical tagging.