Hi.

It sounds like you need to change your code structure a bit to really
take advantage of Django and the possibilities it offer. If you just
want
to get your stuff working with Django and then nothing more, I guess
you could keep it like it is, but else re factoring would be a good
idea.

The way django works, you want to keep the logic separated from the
presentation. So basically that means, that you should keep the Python
code separated from your HTML. In Django terms, we use the view
to make the logic, where we can if needed, import helper functions.
When all the data has been calculated, we pass it to a template, a
html file where we with some Django code can insert data dynamically.

It sounds like you need to grasp these things, before you really get
going.

about writing views: http://docs.djangoproject.com/en/dev/topics/http/views/
about the template language 
http://docs.djangoproject.com/en/dev/topics/templates/
about render_to_response: 
http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to-response

Render to response is  common way of passing data to a template for
display.
Which was what your initial question was about. But I would recommend
that
you strip the html from your Python code and instead put the html in
your template
instead. That would be a more clean and Djangoish way of doing it.

~Jakob

On 13 Apr., 07:24, Tonne <pascal.bomp...@gmail.com> wrote:
> Hi
>
> I'm not too sure how to ask this correctly (not an experienced
> developer so my vocab is not very accurate), but I'll try.
>
> I have created a Python script (collection of functions) that
> generates a calendar of sorts, really just a long list of dates from a
> 4 year date range. It also parses the HTML, as I couldn't work out how
> to do this with the limited logic available the templating language.
>
> My question are:
>
> Is it possible to use a "freeform" python within the Django framework,
> and yet let it receive arguments from the model?
>
> I was intially thinking of making a custom view, but then I have all
> this parsed HTML and am not sure how to get it into a template.
>
> Or should I be looking at making a custom tag?
>
> If not the above, do you have any other pointers on how to go about
> this?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to