2009/7/24 Russell Keith-Magee <freakboy3...@gmail.com>: > > On Thu, Jul 23, 2009 at 5:43 PM, Emily > Rodgers<emily.kate.rodg...@googlemail.com> wrote: >> >> Hi all, >> >> I am currently working on some web apps that use django for the back >> end, and extjs for the front end (using JSON to pass data between the >> two). >> >> I am getting to the point where I am going to have to start doing some >> form integration. Has anyone done this lately (with the latest version >> of extjs)? If so, how did you go about it? I have looked on the web, >> but most of the extjs / modelform examples are using either an old >> version of django or an old version of extjs, both of which have >> undergone fairly backwards incompatible changes in recent revisions. I >> just thought that I would ask here before spending lots of time trying >> to figure it out from scratch. > > I can't speak for ExtJS, but Django hasn't had any backwards > incompatible changes in almost a year - and the areas where you are > delving here (i.e., view and forms handling) have been stable for much > longer. > > So - you shouldn't have any problems (from a Django point of view) > with any tutorial that is a year old.
Yep, but a lot of the examples / how-tos I have found are from 2007 before the forms changed in django. Admittedly, extjs has changed a lot more than django (they pretty much scrapped the original design and restructured the object heirarchy for extjs 2). > I can't offer much advice than that, though. Firstly, I'm not that > familar with ExtJS; secondly, there isn't that much to explain. > * You write a Django view. > * That view serves a HTML page. > * The HTML page contains some javascript. > * The javascript makes a call on another Django view. > * The second Django view serves JSON, or some other raw data format. > * The javascript running on the first page uses that data to modify > in-situ the original page. > > And boom, you have an AJAX website. To be sure, there is some > complexity in getting your Javascript working - but that complexity is > almost 100% a function of your JS toolkit of choice. From Django's > perspective, all you ever do is serve individual pages - either HTML > for human consumption, or JSON/some other format for automated > Javascript consumption. Yep - as I said, I am fairly familiar with django, I have been using it for over a year and have built 3 or 4 fairly big apps. I have already been using django with extjs for displaying data (pretty much how you describe above), however the thing that is slightly more tricky is how best to handle forms. Extjs does its own form handling (validation / widgets etc), and it is tricky to know whether it is best to get django to do the translation into extjs like data (maybe create an as_ext() method, analogous to as_table() for rendering the form), or get extjs to understand the django form data. I also need to consider what to do about validation (it doesn't seem very dry to make extjs do the validation, but it can do 'as you type' validation which is quite nice for the user interface). Has anyone had actually done this before recently? If so, do they have any advice on which way to go? Or unforseen problems with m2m fields etc? On the extjs forums, the django examples are aimed at people who are familiar with ext js but not django and don't really offer a lot of help for the actual integration, so I was hoping that on the django-users forum, there might be someone who would be able to offer advice for someone familiar with django, but less so with extjs. I will post a how-to somewhere when I have figured out what the best way is (currently reading up / playing with extjs forms a bit more). Em --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---