Hello all,
I'm building an interactive plotting routine. I have a question on how
to manage data objects.
I have a View (CBV inherited from DetailView and FormView) that uses
information in the URL to parse out a few variables. From those
variables I make a file system call to create a dictionary. This
dictionary is critical to the remainder of my 'workflow', and it takes
some seconds for the file system call to complete.
Once the dictionary is created, I use it to prepopulate fields in the
form. I'm okay up to here, but my question is one of 'design choice'.
At this point, I am storing the dictionary in the session for later
access. Once the form is posted I use the dictionary again (pulling it
from the session). Here comes the part I'm not so sure about. My
plotting routines are outside of django, and I don't want (would
prefer anyway) to have django as a dependency. I would prefer to just
'pass' the data to the external class/function.
The plot routines need to create the png files, and thus, need to tell
the calling routine where they files were created, so I can pass this
information back in the context to the return render_to_response.
I can force things to work if I don't validate the form, but if I
validate the form first, I get an error. Any insight on to where that
would be coming from?? Is this the correct paradigm for this process?
Here's some pseudocode:
MyView(DetailView, FormView):
def post()
H = MyForm( POST )
C = externalClass(H)
def get_object:
H = externFileCall(*args)
def get_context
if not POST:
C = MyForm(H)
put_to_session(H)
return render_to_response(C)
Actual code here:
http://paste2.org/p/1728601
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.