Closed wipascal closed 2 years ago
Okay, looks good to me. One thing more that just jumped to my mind: We should add a method on
DocumentTemplate
which accepts a Model instance and returns the correct URL. I suggest we usebread.utils.links.ModelHref
to allow for a lazy object (but not for the template object itself, that should in most cases be concrete I think).
Hmm I don't understand what you mean. Could you sketch how you would want to use such a method?
Hmm I don't understand what you mean. Could you sketch how you would want to use such a method?
Something like (names are just very long to make intent clear):
# assuming e.g. inside bread.views.ReadView or similar
employment_contract_template = DocumentTemplate.objects.get(name="Employment Contract")
return hg.DIV(
hg.A("Download Employment Contract", href=employment_contract_template.url_for_filled_out_with(hg.C("object")))
)
Does that make sense? I expect that is how we use if most often.
Ah, I think the new black version (now out of beta for the first time btw) has some changes.
This is mainly to find out if I am going in the right direction.
Todo's for future PRs:
Maybe (?):
@saemideluxe What do you think?