fsufitch | i get it | 00:00 |
---|---|---|
fsufitch | woo! works | 00:01 |
fsufitch | aelkner: ping | 00:01 |
aelkner | fsufitch, yes? | 00:06 |
fsufitch | done with the test-only add view | 00:06 |
fsufitch | want me to commit/push? | 00:06 |
aelkner | can you email the diff first? | 00:07 |
fsufitch | ok | 00:08 |
fsufitch | sent | 00:09 |
aelkner | looking... | 00:09 |
aelkner | ok, here's something that i think you should change | 00:12 |
aelkner | justas made me stop using python: in page templates | 00:13 |
aelkner | so the trick is, you create a view method that returns a dictionary | 00:13 |
aelkner | so the tal:repeat"course view/courses" | 00:14 |
aelkner | tal:content="course/title" | 00:14 |
fsufitch | ah | 00:15 |
fsufitch | okay | 00:15 |
aelkner | so the view class method, courses does the loop though context | 00:15 |
fsufitch | you mean returns a list | 00:15 |
aelkner | and returns a dictionary, easily used in the template | 00:15 |
aelkner | sorry | 00:15 |
aelkner | list of dictionaries | 00:15 |
aelkner | so you see the design patern, right? | 00:16 |
fsufitch | er... | 00:16 |
fsufitch | no, i don't... do you have an example? | 00:16 |
aelkner | looking... | 00:17 |
fsufitch | a list of dictionaries that contain the object infos? | 00:17 |
fsufitch | so, [ {'title': 'mytitle1'}, {'title':'mytitle2'}, etc]? | 00:18 |
aelkner | schooltool/intervention/browser/intervention.py | 00:18 |
aelkner | class SectionInterventionsView | 00:18 |
aelkner | messageLinks, goalLinks, etc. return lists of dictonaries | 00:19 |
aelkner | fsufitch, yes to your question | 00:19 |
fsufitch | i see | 00:19 |
fsufitch | i get it now | 00:19 |
aelkner | templates like to be driven by lists of dictioaries | 00:19 |
aelkner | anyway, that's a good pattern to pick up | 00:20 |
fsufitch | okay :) | 00:20 |
aelkner | btw, to save you time waiting on me, please email me the diff each time before pinging | 00:20 |
fsufitch | ok | 00:21 |
*** replaceafill has quit IRC | 00:27 | |
*** menesis has quit IRC | 00:35 | |
fsufitch | aelkner: ping | 00:45 |
aelkner | looking... | 00:47 |
fsufitch | :) | 00:48 |
aelkner | nice | 00:48 |
aelkner | that's a substantial looking diff, i'd commit and push | 00:49 |
fsufitch | ok | 00:49 |
aelkner | so i'd say the next thing to do is adding to proposed_courses | 00:50 |
fsufitch | a view to do that? | 00:51 |
aelkner | that will be a lot trickier, so you'll need to do some reasearch | 00:51 |
aelkner | yes | 00:51 |
aelkner | you'll need a z3c.formlib view for that | 00:51 |
aelkner | so, and example would be helpful | 00:51 |
aelkner | looking... | 00:52 |
fsufitch | oh no, z3c.forms! | 00:52 |
aelkner | :) | 00:54 |
aelkner | ok, for starters, check out schooltool/schoolyear/browser/schoolyear.py | 00:58 |
aelkner | SchoolYearAddView and SchoolYearEditView both use a form adapter, which may not be necessary | 00:59 |
aelkner | but it might, so it won't hurt you to look at it | 00:59 |
aelkner | the idea with using the adapter is that the field.Fields statement needs to know what fields to render in the view | 01:00 |
aelkner | and the interface for the context itself may have too many or too few fields | 01:00 |
fsufitch | i see | 01:01 |
aelkner | you know what, i can't even figure out upon quick inspection what that adapter is doing in this case | 01:02 |
fsufitch | so i define a form class, and make up its schema | 01:02 |
fsufitch | haha | 01:03 |
fsufitch | it looks like it's just providing access to the SchoolYear's attributes in... an add form? | 01:03 |
fsufitch | that doesn't make much sense | 01:03 |
aelkner | i agree | 01:04 |
aelkner | i have a better example | 01:04 |
aelkner | schooltool/gradebook/browser/report_card.py | 01:05 |
aelkner | ReportActivityAddView actually uses the interface of the context | 01:05 |
aelkner | a much simpler example | 01:05 |
aelkner | and it even has special code for creating the object which gives you an example of that | 01:06 |
fsufitch | cool | 01:07 |
aelkner | it also uses the standard form macro for it's page template | 01:08 |
aelkner | that means you don't have to make any decisions about form html | 01:09 |
fsufitch | yup | 01:09 |
fsufitch | thanks! | 01:09 |
aelkner | your view is guaranteed to look like the rest of the schooltool forms which is important | 01:09 |
fsufitch | yup | 01:09 |
aelkner | we will be doing a re-design of schooltool's look and feel, so that will come in handy | 01:09 |
*** replaceafill has joined #schooltool | 01:10 | |
aelkner | so you realize that some of your fields are going to be using dictionaries in the future | 01:10 |
aelkner | i don't want you do worry about that for now, but i wanted you to see it coming | 01:10 |
aelkner | for now, freeform text is good enough | 01:11 |
fsufitch | okay | 01:11 |
fsufitch | makes sense | 01:11 |
aelkner | fields like division, cluster and pathway, for instance | 01:11 |
aelkner | those will be objects in themselves | 01:11 |
aelkner | so after you have created views for those, we can think about making dictionaries | 01:12 |
aelkner | for providing drop-downs in the form that you are working on now | 01:12 |
fsufitch | okay | 01:13 |
aelkner | but getting your first z3c form working in the short term will be satisfying | 01:13 |
fsufitch | :) | 01:13 |
fsufitch | but, right now i have to go grab some dinner | 01:14 |
fsufitch | my stomach is currently digesting my programming focus instead of food | 01:14 |
aelkner | so i think you have a good pattern with that example | 01:14 |
aelkner | ok, when will you be available again | 01:14 |
fsufitch | hmm, in an hour, i'd say | 01:16 |
fsufitch | so, i'll see you then, then | 01:18 |
aelkner | ok | 01:19 |
*** replaceafill has quit IRC | 01:26 | |
*** fsufitch has quit IRC | 01:52 | |
*** menesis has joined #schooltool | 02:06 | |
*** menesis has quit IRC | 02:13 | |
*** fsufitch has joined #schooltool | 02:21 | |
fsufitch | aelkner: oing, im back | 02:21 |
fsufitch | *ping | 02:22 |
aelkner | ping, pong, the witch is dead | 02:22 |
fsufitch | :) | 02:22 |
aelkner | so, although you won't be able to commit anything by the time you are done | 02:22 |
aelkner | i'd like to see your diff shortly before you decide to shut down so that i can give you some feedback | 02:23 |
fsufitch | okay | 02:24 |
fsufitch | :) | 02:24 |
aelkner | i mean, basically, you cold create view the view classes, the template, and the registration | 02:25 |
aelkner | even if they don't really work | 02:25 |
*** th1a has quit IRC | 04:30 | |
*** fsufitch has quit IRC | 04:52 | |
*** menesis has joined #schooltool | 09:48 | |
*** menesis has quit IRC | 16:02 | |
*** menesis has joined #schooltool | 16:03 | |
*** aelkner has quit IRC | 18:26 | |
*** aelkner has joined #schooltool | 18:37 |
Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!