Changes between Version 8 and Version 9 of SummerOfCode2015


Ignore:
Timestamp:
Mar 13, 2015, 12:51:32 AM (10 years ago)
Author:
Russell Keith-Magee
Comment:

Added a possible project about FormSets

Legend:

Unmodified
Added
Removed
Modified
  • SummerOfCode2015

    v8 v9  
    1212 * Tim Graham (IRC: timograham, timograham@gmail.com) - Replace Form Media
    1313* Marc Tamlyn (IRC: mjtamlyn, marc.tamlyn@gmail.com) - Test framework cleanup
    14 * Russell Keith-Magee (IRC: freakboy3742, russell@keith-magee.com) - Replacing middleware, SQLAlchemy / NoSQL integration
     14* Russell Keith-Magee (IRC: freakboy3742, russell@keith-magee.com) - Replacing middleware, SQLAlchemy / NoSQL integration, Formset improvements
    1515* Curtis Maloney (​IRC: FunkyBob, curtis@tinbrain.net) - Templates, URL routes
    1616
     
    189189
    190190This would best be achieved by constructing a suite of rendering benchmark tests so any chances can be evaluated meaningfully for their trade offs.
     191
     192=== Formset improvements ===
     193* "Complexity:" Easy
     194
     195One of the big problems in web programming is making a request object available everywhere that it might be needed. Some frameworks tackle this problem by using a threadlocal. A threadlocal is essentially a global variable that allows you to access stateful information, such as the currently active request.
     196
     197Django takes a more structured approach, and encourages you to use function arguments and class attributes to pass around stateful information. This requires more discipline on the developer, but ultimately leads to more robust, less error-prone code that is easier to test.
     198
     199The counterargument to Django's approach is that passing the request around everywhere that it might be needed is difficult. Formsets are one example given in support of this - Django's formsets are a classic example where you might want to pass a request down to an internal form - but this is surprisingly difficult to do with Django's FormSet infrastructure.
     200
     201The problem isn't just about requests, either - there's a general problem in Django's FormSet and ModelFormSet objects that makes it difficult to pass in arguments to the Forms that are on them, or otherwise control the save process. This could be a request, the user that is making a particular change, or some other "ownership" related information.
     202
     203While it is *possible* to work around this problem, it *should* be a well documented, easy to use capability.
Back to Top