kfdm,
@kfdm@social.tsun.co avatar

Working with #django and #vuejs I'm using custom tokens so that VueJS and Django tokens don't conflict, but I also have a need to escape to ensure users can't get my VueJS delimiters anywhere.
Is there a place I can hook in to add my own, additional escape code 🤔, or am I doomed to have to add {{value|myescape}} everywhere a value is used 😢

bmispelon,
@bmispelon@mastodon.social avatar

@kfdm it might not be what you're after, but if you can control the value that gets passed to the context, you should be able to implement a custom html() method and Django should honor that when outputting the value in the template.

kfdm,
@kfdm@social.tsun.co avatar

@bmispelon Thanks! Might not be, but gives me something to check. My challenge is that if I have user submittable data (like a ModelForm) and somewhere In a template I use {{ instance.some_field }}, even a failed model submission populates a copy of instance.some_field with the value that can sometimes result in a VueJS directive being placed in unexpected places. (Hard to explain in a post so I might write up a blog post as part of my research)

bmispelon,
@bmispelon@mastodon.social avatar

@kfdm If you do write up something please let me know, it sounds like an intriguing problem (for one thing, I would not expect a modelform with failed validation to change anything on its instance, but I might very much be wrong)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • django
  • GTA5RPClips
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • thenastyranch
  • ngwrru68w68
  • Youngstown
  • everett
  • slotface
  • rosin
  • ethstaker
  • Durango
  • kavyap
  • cubers
  • provamag3
  • modclub
  • mdbf
  • khanakhh
  • vwfavf
  • osvaldo12
  • cisconetworking
  • tester
  • Leos
  • tacticalgear
  • anitta
  • normalnudes
  • megavids
  • JUstTest
  • All magazines