# Telepath-adding the missing link between Django and rich client apps | Matt Westcott

Source: https://djangotv.com/videos/djangocon-europe/2021/djangocon2021-telepath-adding-the-missing-link-between-django-and-rich-client-apps-matt-westcott/
Date: 2021-07-25
Speakers: Matt Westcott, Speaker 2, Speaker 3, Speaker 4, Speaker 5, Speaker 6, Speaker 7, Speaker 8

## Summary

Django’s traditional server-rendered forms and HTML-level JavaScript work well for simple interactions, but they become unwieldy when rich client-side interfaces need access to structured application data. Matt Westcott presents Telepath, a mechanism that transports Python objects and their definitions to JavaScript, giving the browser data-level APIs for Django forms and custom widgets rather than forcing it to manipulate opaque HTML fragments. In Wagtail, this makes it possible to duplicate StreamField blocks, update previews, and work with complex widgets while retaining Django’s forms and ecosystem; more broadly, Telepath is intended to complement rather than replace React or Vue when close integration with Django is important.

## Transcript

### [00:08] The Django–Frontend Divide

**Matt Westcott:** [00:08] Hi, I'm Matt Westcott. I'm the tech lead of Wagtail, the leading Django-based content management system, and you might have seen me around on GitHub as Gasman. I'm going to start this talk off with a hot take. Django is lagging behind in its ability to deliver the rich client-side user experiences that people expect today. That might seem like an unfair charge to level at a back-end framework, so maybe I should justify that In the early days of Django, the kind of client-side code that would be in use on a website would have been something like this. So showing or hiding the state drop down depending on whether the client country is set to United States or not.

[00:54] Or just d postcode lookups, autocompletion, these sorts of enhancements that don't fundamentally change the principle that the server is doing all the hard work. None of the client-side code really needs to know much about what sort of data it's dealing with. These interactions can be written as very simple rules at the HTML level If the element with ID country has a value equal to United States, show the element with ID state. And none of this code cares what a country or a state actually is, that's a servers business. This is just HTML elements. And we have libraries like jQuery, which are really good at that, manipulating web pages at the level of HTML.

[01:41] And while Django is a server-side framework that generally leaves the details of front-end code up to you, there are traces of this thinking in Django's design. So in particular form sets have this empty form property which gives you the HTML for an empty form with a placeholder for the prefix with the intent that you can use this for dynamically inserting new forms like I'm doing here. And you do that, you render that You render that that form in a scripts tag. This is one way of doing it where we've set the type to something made up.

[02:27] This is a trick for just stashing strings in the document and keeping them as plain strings because the browser will just skip over any con content types it doesn't recognize. So this is just a string that we can grab from our JavaScript code and whenever we click that button we'll create a new list element, write the HTML into it with this prefix filled in. and then update the form count in the hidden inputs. And again this is just naive HTML manipulation, none of the JavaScript code knows what data this is representing. There is no array of voucher code objects anywhere. But if we sort of think of a more complicated example

[03:13] like a Facebook style messaging system. When a message comes in, then sure there's an HTML element that pops up in the corner of the screen, but maybe it also adds little sort of red badge to the menu bar, updates the title element and in your sort of contact list it will sort of flash the what the contact red and sort of put a little snippets of the message underneath that person. And in the traditional Django slash jQuery mindset where the server side logic reigns supreme and the client is a passive window onto that server side state, you could treat this as just a set of HTML manipulations to perform.

[03:58] where let's say a message has come in from user ID 12345 so let's find the element with ID user1235 345, flash it red, find the span with class name message snippet inside it and update that with the message text. Yes, in principle you can do everything that way, just as anything you can do in a Django site, you could equally do with PHP and raw SQL queries. But clearly it's much more expressive and easier to code when the environment you're working in has a concept of the data model. This is a message, it has a timestamp, a sender, that sender is a person who has a message history. And We add that new message to the message history

[04:45] and any view side components that represent that person and that message can then update themselves to reflect that change. And this is the selling point of frameworks like React and Vue. It gives the front end code access to that data model. We're no longer just working with HTML fragments. And plenty of Django developers have seen the value of working with React and View and so on. And now it's quite common to build your project's front end in one of those frameworks, talking to a JSON API most likely built in Django REST framework when we need to get data from the server

### [05:31] Wagtail’s Dynamic Forms

**Matt Westcott:** [05:31] But that way you end up leaving behind a huge part of the Django ecosystem like templating and forms. It's two different worlds. It's the first question that a developer starting a new project has to ask. Am I going to build this as a traditional Django website with views, templates, forms and so on? Or am I going to build it as a React app? Now on Wagtail we didn't even have the luxury of making that choice. Those of you who've used Wagtail before will hopefully be familiar with Streamfield which allows you to insert and arrange of mixed content blocks of various types

[06:18] and the developer can specify which kinds of blocks and fields are available here And while there are sort of quite a few wagetail-specific conventions you need to follow, this is ultimately a Django form. These are Django form widgets, and when the form is submitted it's it will all be handled by the Django forms framework and this is important to us as Wagtail developers we want Wagtail to be the best Python Django CMS and that means embracing the Django ecosystem. If a developer wants to customize how this works or there is a third party colour picker or date picker or autocomplete input that they want to use, they should be able to use their Django knowledge to do that.

[07:07] And if instead we end up saying, sure, yes, you can do that, you just need to rewrite it all as a React component, then we've kind of failed at that goal. We might be the world's best React CMS, but that's not what a Django dev wants to hear. So what we've ended up with is basically the same mechanism as these dynamic form sets but turned up to 11. It's if the page you're editing here has a gallery of ten image objects on it then you will have then when we load this page it will have to render 10 copies of this subform. And if you want to add another one then there 'll be

[07:54] An empty form stashed away in one of these th these fake script tags sort of somewhere on the documents and it will sort of duplicate and clone that one just as we saw before. And it's the same for any other block type. And these blocks might themselves have dynamic elements in them too So there's a lot of complexity going on in here and we're really at the upper limit of what we can reasonably do with pure HTML manipulation. And it would really be a whole lot easier if we could say, okay, to the client side, this is the data for 10 images.

### [08:44] The Form Widget Contract

**Matt Westcott:** [08:44] Here's the structure of a form for editing those images. So give me 10 instances of that form all populated. But we can't do that when we're only working at this sort of opaque HTML level where the client-side code doesn't have an insight into that actual data And you might be wondering, well, what is the barrier to getting at the data directly? Why do we have to work with these HTML fragments? Well, as I said, we're committed to working with Django Form widgets. That's a choice we've made as developers of Wagtail and the ability to interface with form widgets from client-side code has never been part of the contract that Django

[09:33] laid down Form widgets care about two things. Firstly, given some data on the Python side, they can render some blob of HTML that represents that data in a form field. And secondly, if you stick that blob of HTML in a form and submit it, that widget knows how to make sense of that submission and get data back out of it. That's all happening on the Python side and what happens in between those points is entirely private to that widget. But come on, you might say, we know HTML, we know what an input element looks like. How hard can it really be to get data in and out of them from JavaScript code? Well let's take a look at some of them, starting with plain text inputs. So this is what it looks like

[10:20] That's the HTML for it. So how do we get the value out of that? Well, okay, this is not a trick question. It's document. getElement. artbyID title So yeah, just hackering with the value property and to put data into it, value equals goodbye world. So that's pretty easy. So moving on, how about a choice field using radio buttons? So here's the HTML for that, and okay, now it's not quite as simple as just saying dot value because there are a bunch of different it inputs and only one of them the one with the checked attribute on it is the one that we're actually interested in

[11:05] so It's sort of a slightly different bit of code, still nothing not no nothing catastrophically complex, but It's it's just annoyingly different. You just need to look for the right element with that attribute or to writing back to it may make sure you're matching it by ID and then setting checked. So yeah, just not difficult, just different. Now let's take one of our sort of fancy image choosers and this is yeah as we've seen here this is something specific to Wagtail and it's And oh and yes there's lots of custom JavaScript going on here, but it's still ultimately a form

[11:53] widget. It follows the contract of form widgets as specified by Django being able to get data in and out of it from Python. And so the HTML for that, well we've got hidden input, so at least we know what to do with that, we can get the ID out. But If we're actually populating this field with data, if we're rendering this field this form entirely client-side, we can't just fill in the ID and call it done. We've also got this that to set the URL for this thumbnail image and populate the URL for the edit this image. And if all you've got is the ID to go on, you just don't have the data to do that. So you're kind of stuck.

[12:39] You're you're and your n if your client-side code doesn't have specific knowledge of what's going on in this particular component, then it won't have a hope of doing the right thing. And I won't even start on how things like rich text work. That's just you'd well you just don't want to know, not today anyway. So what we need and what Django doesn't give us here is a standardized API, a standardized JavaScript API. for getting at the at the data contained in form

### [13:25] Introducing Telepath

**Matt Westcott:** [13:25] fields, one that works regardless of whether they're bog standard HTML inputs or fancy JavaScript component That knowledge exists on the Python side, in the form object, and in the form widget classes. What we'd really like to do is take those definitions and zap them over to the client side. In short, what we need is telepath. So telepath isn't a large-scale framework in the way that something like React is. It does one thing, transporting object data from Python to JavaScript. If you're familiar with the pickle functionality from the Python standard library where you can take an

[14:12] arbitrary Python object, serialize it, and then write it to Disc or whatever you want and then at some later point read it back, unpack it and get back the Python object again. Then this is The same as that, but when you're unpickling on the client side and getting back JavaScript objects. or if you prefer it's a more generalized version of JSON that you can teach about new object types So the demo of that, so let's say so we've got Django form here, the sort of thing that we might use in Wagtail for placing an image on a page.

[14:59] In fact, let me just grab the definition of that. So You can see we're using one of our Wagtail specific admin image choosers there, but besides that, this is just an a completely typical Django form So we can fill this in. Let's use this picture of some cakes just to make you all hungry. And let's fill the that caption in and the new s new th thing that that telepath gives us the interesting bit is now that we can grab this form state as a

[15:44] JSON-like structure And this is entirely client-side. There's no round trip to the server to obtain this data. And it obtain it includes data like the this preview thumbnail URL which is not contained in a form field. You couldn't do that by digging around with some naive code that just looks at input form fields and this gives us everything that we need to work with this form on the client at the actual data level. So if we just change this caption And maybe we want that right aligned, then we can push that data back to the form

[16:29] and then it will do the right kind of manipulations to the form. to update that and if we change say this image let's just Set all that to just null and then set that across. Then it also knows the right sort of updates to do to our custom image widget, including sort of setting this back to the placeholder image. And this works because we've taken our Django form definition And we've got telepath to build a corresponding JavaScript object with the API that we need. And if we open up developer tools We can actually just see what playing around with that object looks like.

[17:17] I've given it the name just form We can say form. widgets and if we get the caption object get its state and then set its state to something else. And then so we we've got a full JavaScript API to sort of do sort of the an any kind of data level manipulations we want. And within Wagtail this opens up a whole lot of functionality that we just couldn't do before, such as duplicating blocks. Let's

[18:02] Just make an edit there and then duplicate that. It will read the data from one form and push it back to another. And we can just render those dynamically. And we can also, if I Change that we can collapse this block and we get this sort of little preview snippet of what's in here and it's possible for us to do that because we have access to the data within the form, so we can dynamically generate that. So digging into a bit more on how this on how this demo works, so on the Python side We have our form instance that we build as normal

### [18:49] Telepath in Wagtail

**Matt Westcott:** [18:49] and then we ask Telepath to generate this packed version of it This condenses the definition of the form object into a JSON serializable representation, which we which we then include. On the template, I'll show you that in a moment. And this is done through this JSContext object. And the idea here is that whatever objects we send to the pack method When we come to unpack them at the other end on the client side, there will be some JavaScript implementation for that object in a. js file somewhere which then needs to be included on the template and telepath keeps track of where those implementations can be found

[19:39] and makes them available through a media object if you've used of Django's the form media this is just one of those and So what we get out af after we've after we've turned that into JavaScript objects is this client side form object which offers you the nice data access API that I just showed you and so if I If I add say a credit field, well before I add this, let's show you

[20:26] what's going on the in the in the source code. So you can see that this the definition of the form object is this sort of custom dialects of JavaScript of JSON and we've stashed that into one of our fake script tags. Yeah you don't need to understand this format but you can see it has these references to types that we've defined elsewhere, image chooser, radio select. And if you scroll up we can see these media definitions those have been output on there so the these contain those the definitions of these types here

[21:12] so Then we re read the read that definition and then get telepath to unpack it and at this point it's got all of the JavaScript definitions it needs. So if we add another char field to our form just changing vanilla jar Django code again and if I refresh that oops should have waited for it to reload There we go. And now you can see that we've got this credit as part of the definition and it's got this custom definition of this widget object.

[21:59] So now these JavaScript implementations, they don't come out of nowhere. This isn't some kind of magic Python to JavaScript converter for your business logic. And behind the curtain, these JavaScript implementations of the Django form and widget objects are things that I've created as part of the Telepath ecosystem. Calling it an ecosystem at this point might be a bit grandiose given how new Telepath is, but The point is form widgets are only one possible application of this. It's perhaps the most obviously useful application when we're talking about Django functionality that we'd like to interface with JavaScript.

### [22:50] Custom Python and JavaScript Objects

**Matt Westcott:** [22:50] But telepath can be used anywhere that you have a server-side data representation in Python objects that you want to share with front-end code. So to finish, I'll give you a fairly silly example that sort of demonstrates the possibility end-to-end. So Here we have some bouncing emoji and if I bring up the code for that it's this one. You can see that each emoji is a Python object with a name and a size property and we're defining our

[23:37] list of emojis in python code We're sending that to packing that up with telepath to send that to the template as before. On the template we're writing out that that that packed JSON definition and then we're unpacking that well gra grabbing that from the script tag unpacking that in telepath and calling animate on each one. And the JavaScript code for that, let's just Enlarge just a bit so you can see the whole thing. Is a JavaScript class that is called emoji.

[24:23] It has two properties, name and size, that get passed to the constructor. and an animate method and we're taking this so the one piece of glue to make telepath work with this. We're registering this class with telepath under the name sprites. emoji. And that is and if we go back to the Python code, you'll see that we've got this telepath pack method which defines everything it needs to know about how to turn a Python emoji object into a JavaScript one. So firstly, whenever we

[25:10] whenever this pack method encounters an emoji object, we know we'll have to insert our emoji. js as part of the JavaScript media definition. So we'll add that one in there. And then We are going to use the class that we've registered as sprites. emoji and pass it the name and size properties from the from the from the Java's the Python objects and from there telepath will take care of encoding that into the data structure that it packs up to center the front end And as far as the

[25:55] transporting from Python to JavaScript is concerned, that's all there is to it. So if we want to add a new kind of sprite to this display, let's say we want to add a text banner. So we can say banner. Hello DjangoCon and let's make that purple and obviously this is a new kind of Python object that we need to define And same as before, but this time we'll give it text and colour properties

[26:47] Well, let's move on to the JavaScript implementation of a banner, and I'm just going to steal most of this from Oops, most of this from the emoji implementation. So this is now class banner. It will take text and color Inner text will be text, font size we will hard code to 40px We'll set our colour to whatever we passed and everything else can remain the same, I think.

[27:33] So We've now got our banner object which will sort of render our text element and give us the ability to animate it. And now We'll register that with telepath under the name Sprites. banner And then back in our Python code we'll define a telepath pack method Which this time we need to bring in banner. js, sprites. banner is the class that is the class name that we registered that we will pull in

[28:21] that that that we'll use for to instantiate this banner object and that is going to be past these two parameters t size and color And finally we have to use this telepath. register decorator, which tells telepath that this is now one of the object types that it should support. So now if I save that, wait a moment for it to reload everything. And now, hopefully no, still reloading.

### [29:06] Project Outlook

**Matt Westcott:** [29:06] And there we go, we've got our hello Django Convana. So that's a Python object that we just invented. like two minutes ago popping up in the browser as an object on the JavaScript side in its own right and While this is a silly example, hopefully you can see the potential of sharing the business objects from your Django application with front-end code. And in Wagtail's case, these business objects are forms, and this has solved a huge tricky problem for us. And maybe you have something similar in your project or something entirely different

[29:51] where telepath as a mechanism for sharing logic can offer you a new kind of solution So you can find Telepath on PyPI, it's called Telepath, and the documentation and GitHub project will be all linked from there. So, thank you very much.

### [30:33] Questions

**Speaker 2:** [30:33] Hi Matt.

**Matt Westcott:** [30:34] Maybe you have something similar to the project or something in time with the website.

**Speaker 2:** [30:39] Just one question. Why do you need the Deft Decorator on the back-end side and on the pione

**Matt Westcott:** [30:51] side too? I suppose in that particular case

**Speaker 3:** [30:55] it wouldn't really be sort of needed because yeah it would be able to figure out where the yeah based on the fact that you've got the telepath pack method what to do with it. I think where that really comes in is when you 're packing objects that you don't have direct control of in your own code so that would be things like Django four widgets which obviously we can't real easily add that to the Django code so in that case there's an alternative way of registering an adapter where it's an external class. So I think that just kind of keeps it a bit a bit more sort of consistent between those two approaches.

**Speaker 2:** [31:44] Thank you.

**Speaker 3:** [32:01] I see that Chris has just arrived so I can ha answer the question I was about to answer on Slack about so examples of this in use. In Wagtail. So I think there is yeah trying to think of the best place to look so all our the front end code in the Wagtail repo is in the well most of the front end code is in the deployant subfolder and there's a few But the well the place where we are s working with those Django form widgets is in the what is widgets. js which I've always tried

[32:47] to dig out and put the link into chat so it's So this is one thing I was hoping to have in done in time for this talk but didn't quite get around to was taking the sort code for dealing with the Django widgets and forms and putting that in its own package. At the moment that code is sort of tied into Wagtail with it, but hopefully this week I'll have chance to split that out so that that is that's usable outside of White Tail itself

[33:39] Thank you. Yeah, you're welcome.

**Speaker 4:** [33:48] Can I ask a question? Yep, sure. Yeah, that's super cool. I'm curious, like it makes a ton of sense for the Django Forms use case. I'm curious, like if you were You know, if you weren't, if you didn't have to sort of embed it in this complex Python object that you don't fully control, like how would you think about when you would want to use this versus just using something like Reactor View front end instead of like passing normal JSON and APIs back and forth.

**Speaker 3:** [34:22] I think if you've already sort of got some investment into the a s a sort of conventional Django app where the you're you're re rewriting everything in React isn't really a an option, then I think this is probably the way to I think there's a few other places that we've that yeah started to find a use of this in Wagtail. So I think we're looking at rebuilding the left hand menu in the admin interface so that each menu item is a telepath object and that That's and that that that's where it

[35:07] really helps us because we we've sort we're sort of building the definition of which menu items are shown to someone is all in Python logic. I suppose, yeah, but for a lot of things, you don't might not need something as complex as telepath that can sort of pack arbitrary objects. You could get pretty far with just objects that's just basic JSON definitions as like dictionaries. And I think where th this really helps is where you have kind of nested structures of objects that sort of don't really sort know about each other. So in the case of Wagtail in the screen field, each block can have sub-blocks

[35:54] and they can be mixed and matched in any combination So I think where you've got that sort of more the extensible the data model, I think that that's where this is where you get the most benefit from that. Next

**Speaker 4:** [36:13] next year.

**Speaker 5:** [36:37] Thank you very much, Matt. That was really interesting. I'd like to know, are you tracking the use of this outside your own wagtail torch box? community to find out do you have a sense of who's using it and what use cases it's finding out there in the Wide world.

**Speaker 3:** [37:00] I I'm not really tracking that at the moment. My impression is that there'll there's probably very little right now because it is the pretty new. I think this is probably the first time I've really sort of introduced it as a project in its own right as opposed to something that fixed a problem within Wagtail. But Yeah, I'm I'm definitely keen to see how it evolves from here. As I said, I'll I need to open up the code for working with forms and form widgets which I think is where it's going to become really useful. So yeah things is just the start

**Speaker 5:** [37:42] I assume it's going to explode with interest following this talk.

**Speaker 3:** [37:46] I hope so.

**Speaker 5:** [37:47] Thanks. Really great. Antonio, I think you were going to speak so I'll since I've already spoken.

**Speaker 6:** [38:17] Okay. I Hello Matt. I was going to ask is this more of a backwards compatibility thing? I mean you have an old style web application and you want to add some reactivity to it so it helps you do that. For new applications would you recommend going the React or the U way

**Speaker 3:** [38:42] I think yeah, it has a place for both. I think if i if you're the i if you're most confident in working w in the Jenga way then I think it probably is it or you have the requirements to integrate with the Django ecosystem more closely than you would be able to do if your front end was just React and you were just talking to Django just through REST API. So I d I think w where when wherever the it makes most sense to communicate with Django

[39:27] as a back end which might be something like the their the channel channels chat application that we just saw in the last talk then I think that that's that that would be A good fit for telecom.

**Speaker 5:** [39:55] another question if I if I may, having haven't already. There's quite an e not an ecosystem, but there's quite a set of approaches to front-end work within Python appearing now everything from Anvil and libraries that we can use in Python to generate Java script. Where do you see the overlaps? How does this fit in with other efforts to put more power in the hands of the Python developer? Yeah, that's that's it. How does it fit in that picture of these many different solutions to a similar question?

**Speaker 3:** [40:38] Yeah, that's that's a good question and I've I've noticed as the schedule for this talk was coming for a thought oh that yeah it's quite a lot of front end so I'm yeah looking forward to learning more about the what else is out there over this week. I th I think well where to the telepath comes in, I think it it's sort of solving like one specific problem relating to like transporting data a around. So I I'm hoping that the this isn't sort of necessarily that this is the one framework that you have to adopt. It should integrate nicely with an anything else as long as it's ultimately talks in to

[41:24] in the plain JavaScript objects And so hopefully it should sort of integrate well with the existing sort of frameworks, whether that's Python or JavaScript, but that's something that we'll be completely learning more about and adapting as the project grows Okay, I've got a couple of questions in the in the chat. So talking about validation So yeah, I think that that's kind of one missing part of what I've built in the form handling so far. So we've got the rendering of the forms and the form widgets and the validation happens

[42:09] on the in Django terms on the field object and we don't really have a concept of that yet. I think there there's certainly sort of a lot of validation that you that you can do the usefully on the client side and I think that would be a useful addition to what telepath provides. There's certain things that can't be done on the client side if it's like validating that a username isn't taken, for example. Although we even then that you could you could usefully subduit for the a background query to check that so I th I think so that that's not something I've looked into but I'm h hoping that's something where that telepath can

[42:54] fit fill the a need for. And how easy it is to use with web components instead of native controls. Again that's a good question. I I've not really looked into that. I think that's the next thing that we'll be d discovering as we sort of start migrating wagtails menus into to this new framework because that's I think that that there's some react involved there. So yeah we're still on the way to discovering that

**Speaker 7:** [43:37] I have a question about if you have any extra security. Like middleware where because usually serialization is serialization of objects between parts of an application is well an entry point for some vulnerabilities sometimes historically, I don't know if this specific library has extra explicit layer to handle that Or no? Just wondering?

**Speaker 3:** [44:06] No it's it's not that's not something we've r designed into it. I think the expectation is that when you're defining the mapping from Python objects to the client side, the JavaScript ones, and because you're sort of specifying which parameters are being passed on, then you will always have sort of control over which the data gets passed on and o only sort of passing on information that the client is supposed to know. And

**Speaker 8:** [44:44] I thought I'm here with Stephanie. Yeah and

**Speaker 7:** [45:00] the regular security concerns everyone should have.

**Speaker 8:** [45:03] Well let's start it right for the I'm mostly a Python user and occur I

**Speaker 3:** [45:12] see the next talk has

**Speaker 8:** [45:14] started now. So I'm

**Speaker 3:** [45:16] happy to stick around if there are

**Speaker 7:** [45:18] things that there's one next to the question

**Speaker 8:** [45:21] Django or shut. How easy would it be to use telepath to allow front end

**Speaker 3:** [45:25] editing of screen fields outside of the admin backend? So yeah, that is

**Speaker 8:** [45:30] that that's something that we're really keen to do is to

**Speaker 3:** [45:34] It's to make sure that we we've got this

**Speaker 8:** [45:38] this accessible

**Speaker 3:** [45:40] API for working with Springfield data and the Springfield interface without that being tied

**Speaker 8:** [45:46] into

**Speaker 3:** [45:47] the all of the admin zone

**Speaker 8:** [45:50] javascript. So it's

**Speaker 3:** [45:53] not something that we we've

**Speaker 8:** [45:55] worked on yet, but I think that

**Speaker 3:** [45:56] that is definitely kind of top of the list of the next bit of development is I know people have been interested in the of creating more the

**Speaker 8:** [46:05] front end user

**Speaker 3:** [46:06] facing interfaces for editing screen fields. So yeah, we really do want to want to

**Speaker 8:** [46:12] to do more work on that. And I think we're sort of a lot closer there. Probably open questions in certain block types like the rich text and the

[46:24] that image choosers which are more tied in to

**Speaker 3:** [46:28] The Wagtail admin interface than

**Speaker 8:** [46:32] Others would be.

**Speaker 3:** [46:34] So but

**Speaker 8:** [46:36] obviously the thing about Spree Field is that you can choose as a developer

**Speaker 3:** [46:40] which blocks are available, so maybe that's that that's not a blocker for sort of building yeah these interfaces for making this available to the front end.

**Speaker 8:** [46:51] So

**Speaker 3:** [46:52] yeah, I think

**Speaker 8:** [46:53] that's definitely something we're keen to look into as a

**Speaker 3:** [46:57] next step on this.

**Speaker 8:** [46:59] For the moment let's just assume that we go on either R approach. So you would

**Speaker 3:** [47:04] Okay, so you use a variant version of

**Speaker 8:** [47:07] Django built in

**Speaker 3:** [47:08] the filter JSON script instead of say

**Speaker 8:** [47:12] to use Yes, I think so. I think this is that's something that I

**Speaker 3:** [47:16] only just learned about sort of in the last week or two and I sort of filed this and oh I should

**Speaker 8:** [47:21] I should use that a lot more function and Yeah, I th I think yeah that that that is get s something that's kind of low level bothered me about embedding

**Speaker 3:** [47:33] bits of JSON into script

**Speaker 8:** [47:35] tags is that you know what

**Speaker 3:** [47:37] what if it contains a closing script tag and I see it really it's count

**Speaker 8:** [47:41] accounting for that.

**Speaker 3:** [47:42] So yeah we should I should probably update my examples if I am still using script to

**Speaker 8:** [47:49] using safe to use JSON

**Speaker 3:** [47:51] script instead.

**Speaker 8:** [47:54] not to run into too many.

[47:57] in C what about the front end editing for walk tape Normally no. Is a different question

**Speaker 2:** [48:08] it's not related to teleport.

**Speaker 8:** [48:10] Maybe. Not so much. So if you don't template you need to

**Speaker 2:** [48:20] Do you think is in the in the future Wagtail will support the front-end editing or only preview?

**Speaker 8:** [48:29] a specific. On the other side. Or something like the Django CMS Django CMS waves. We might

**Speaker 2:** [48:45] I don't know. What do you think about the front end editing?

**Speaker 8:** [48:49] Now it's it's not really something we thought about in

**Speaker 3:** [48:55] as something for White Tail

**Speaker 8:** [48:58] itself it

**Speaker 3:** [48:59] it could certainly be I could see that being done as maybe

**Speaker 8:** [49:03] a third party add-on. I think

**Speaker 3:** [49:08] The thing is, yeah, Wagtail does try not to be sort of opinionated about any particular what whatever you're using on the front end where that's yeah

**Speaker 8:** [49:16] , CSS or

**Speaker 3:** [49:17] JavaScript frameworks. So it might be that

**Speaker 8:** [49:20] one the mechanism for editing on the front

**Speaker 3:** [49:25] end will be different for everyone.

**Speaker 8:** [49:27] And I think

**Speaker 3:** [49:30] Doing that within a third party package

**Speaker 8:** [49:34] makes it easier for that

**Speaker 3:** [49:36] to be sort of more opinionated about one way of building the front end.

**Speaker 8:** [49:41] So I think yeah,

**Speaker 3:** [49:43] certainly something I could see happening in the wider white

**Speaker 8:** [49:46] tail ecosystem. Okay, thank you. Okay, now we'll look shortly over multiple scenarios on how to use the Django ORM. We will compare them to the SQL that Django creates in the background. So yeah, th thanks everyone for your interest and yeah

**Speaker 3:** [50:18] and yeah, you can find me on Slack and

**Speaker 8:** [50:21] and yeah, and I'll be around for the rest of the week.

**Speaker 3:** [50:23] So yeah.

**Speaker 8:** [50:25] Thanks for all your questions. Yeah,

**Speaker 3:** [50:26] great talking to you.

**Speaker 8:** [50:28] has a discount of 10 and then I can work with this customer, change his discount, delete him again.
