-
Notifications
You must be signed in to change notification settings - Fork 1
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/attachment filename generator #836
Merged
Merged
Changes from all commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
e6798c8
feat: Import code from old branch to avoid merge
miggol db4e2e0
wip: Working on attachments in new branch
miggol 6edcf59
Merge remote-tracking branch 'origin/major/4' into feature/attachments-4
miggol 0662e3d
fix: Mishmash of migrations
miggol 83c899a
wip: Various fixes for attachments
miggol 8bd9e1e
feat: Attachment renderable templates & updates
miggol e87b9ba
feat: Change var name and minor changes
miggol 5232642
feat: Verbose name for Attachment.upload
miggol 1833621
feat: Attachment views
miggol c1039b2
feat: Attachment form template
miggol 4767f4c
wip: Minor changes
miggol 2e9474e
feat: Add author field to Attachment
miggol c88c247
feat: Classmethod to initialize kind from an attachment
miggol d58ff27
feat: Provide manager object to children
miggol 3454a92
feat: Download view for attachments
miggol f04a8dc
feat: Break out BaseAttachFormView to make attachment edit view
miggol cc6c496
fix: Move classes around to prevent circular imports
miggol 7254db5
wip: Remove attachments manager for now
miggol e74ed5d
Merge remote-tracking branch 'origin/major/4' into feature/attachments-4
miggol 66c8f79
feat: Initialize stepper outside of context-getting
miggol dcbe8b4
wip: Start managing attachments by Checkers
miggol be1de99
feat: Make sure slots know what they're attaching to
miggol aa0176b
fix: Minor fixes and comment updates
miggol 987d916
cleanup: Remove old code and simplify object getting
miggol 97db730
feat: Just fill in study slots by hand for now
miggol c8198d8
feat: Detach functionality for Attachments
miggol d2f4fdf
feat: Get Attachment subclasses without kind
miggol 9c64aa4
feat: Make slots less dependent on kinds
miggol 9131b70
feat: Detach view and links, editing flag for AttachFormView
miggol 2682a7c
feat: Extra/optional attachments with DMP example
miggol 54c71a6
feat: New desiredness flags
miggol 4212ced
feat: New add_slot method
miggol 3141555
feat: Template enhancements and cleanup
miggol d82222c
style: Black
miggol 19ca5e1
style: djlint
miggol ec17850
add cdh_files/ to .gitignore
EdoStorm96 3b62436
Merge branch 'major/4' into feature/attachments-4
EdoStorm96 563154b
fix: create and implement attachment filename generator
EdoStorm96 3f76485
Merge branch 'major/4' into feature/attachment_filename_generator
EdoStorm96 f489256
feat: proper implementation of filename generator
EdoStorm96 a8edd10
fix: bug in Study.research_settings_contains_schools
EdoStorm96 f11758f
Merge branch 'major/4' into feature/attachment_filename_generator
miggol 24b9194
Merge remote-tracking branch 'origin/major/4' into feature/attachment…
miggol dd68a5f
fix: Remove FnGen from model
miggol 36b8d72
feat: Auto retrieve Kind from attachment if none provided
miggol c58e0bb
feat: Classmethod to get a slot from a proposal
miggol b76cdb4
wip: Get filename from slot instead of kind
miggol e065c2e
feat: Rename and finalize generate_filename() function
miggol 1b89cc9
feat: Point methods in right direction
miggol 135b4a7
style
miggol c75fe13
feat: Custom fn_part for kinds
miggol 352fc48
feat: Add order variable for Slots and FnGen
miggol 4b87f00
fix: Turn get_fn_part into classmethod
miggol 9858dfa
fix: Kind derivation for empty slot matching
miggol ab40cdb
fix: Delete anachronistic migration
miggol 14e2783
feat: Functions to enumerate slots
miggol 72b751f
feat: Template changes to display normalized filename after <br />
miggol d2f3958
feat: Download filenames in PDF and DIFF are now the normalized versions
miggol 70f7421
style
miggol eef2eae
Feat/fetc filename in pdf (#837)
EdoStorm96 43c3c5a
fix: Prevent collapsing of value in PDF
miggol feb821a
fix: Hyphenate kind in fetc filename
miggol da86b91
fix: Merge accident, double return statement
miggol a11756d
fix: Actually implement stepper.filled_slots
miggol 1a1b913
fix: We can't assume all owners are represented in att_dict
miggol File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
from interventions.forms import InterventionForm | ||
|
||
from proposals.utils.validate_sessions_tasks import validate_sessions_tasks | ||
from attachments.utils import AttachmentSlot | ||
from attachments.utils import AttachmentSlot, enumerate_slots | ||
from attachments.kinds import desiredness | ||
|
||
|
||
|
@@ -82,7 +82,15 @@ def attachment_slots( | |
success = empty_slot.match_and_set(exclude=exclude) | ||
if success: | ||
extra_slots.append(empty_slot) | ||
return self._attachment_slots + extra_slots | ||
all_slots = self._attachment_slots + extra_slots | ||
enumerate_slots(all_slots) | ||
return all_slots | ||
|
||
@property | ||
def filled_slots( | ||
self, | ||
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 you meant to use this in AttachmentsList.get_container(), but forgot. Please use it or get rid of it. 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. Oh yeah I forgot to implement it lol |
||
): | ||
return [slot for slot in self.attachment_slots if slot.attachment] | ||
|
||
def get_context_data(self): | ||
context = super().get_context_data() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 am not really too familiar with classmethods ... But if I am reading this right, the kind will never have a fn_part attribute, since this method does not set the attribute. So the first if statement is redundant? Or does this happen automagically?
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.
So the point is that we can give kinds a custom filename part without changing the
db_name
, which would be bad. I did this because I presume some filenames would get very long, and also are in English instead of Dutch. But in the end didn't decide on any custom names.It's a classmethod because regular methods only work if the class is initialized i.e. has a
self
. However, we tend to use kinds as bare classes, just containing info. That's why it's a classmethod and as such it receives an uninitializedcls
instead of aself
, which is enough to get the attribute.Note that
cls
andself
are just conventions, they don't have to be called that way as long as they're the first argument.