-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/add intro boxes #394
Conversation
|
||
class BookForm(forms.ModelForm): | ||
introduction_text = forms.CharField( |
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 code repetition here: could you have created a mixin?
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.
Not a request, just throwing it out there
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.
I hadn't thought of that - I would like to go through and streamline things at some point actually (there's a fair bit of repetition spread around). Would it be worth opening an issue for? There's one for beautifying the db but that's not quite the same
src/rard/research/views/work.py
Outdated
self.create_intro_if_does_not_exist() | ||
return super().dispatch(request, *args, **kwargs) | ||
|
||
def get_success_url(self, *args, **kwargs): |
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 is almost identical to the get_success_url function in the parent WorkUpdateView class. Is this necessary?
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.
as it turns out, we don't 👍
src/rard/research/views/work.py
Outdated
self.create_intro_if_does_not_exist() | ||
return super().dispatch(request, *args, **kwargs) | ||
|
||
def get_success_url(self, *args, **kwargs): |
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.
And, as above, do you need to override this method?
src/rard/research/views/work.py
Outdated
"change_work": True, | ||
"change_book": True, | ||
"has_object_lock": True, | ||
"instance": self.get_object(), |
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.
What are these for? The only one I can see being used in the template is has_object_lock and usually that's worked out in the template as
{% with request.user|has_lock:object as has_object_lock %}
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.
since the book update redirects to a new page (there's no book detail page) it loses some of the context (like editing permissions)
it's possible that this is no longer the case - I can try removing parts and seeing if it can be slimmed down
added comment to explain why we save A/W/B re TOF
Summary:
Have added introduction boxes to works and books. This involved changes to the templates, forms, models and views (and migration). Related to #376
Models
Views
Forms
Templates
text_object_preview.html
partial, same situation for the rich text editors for adding/updating the introduction contentTests
TextObjectField
instances associated with the work/book introduction are created/deleted with the work/book (models)