Re: Simple_tag strange behaviour

2009-04-22 Thread Tonne
UPDATE: Thanks Anatoliy for you help. You spotted the problem and it now works as I originally wanted it to. The problem was that I had defined an array at the module level, and then updated the array with results from a queryset. Why this is a problem is that every time the page is refreshed,

Re: Simple_tag strange behaviour

2009-04-20 Thread Tonne
et is not being fetched quickly enough so the script runs without it and therefore the update doesn't work? Is that even possible? On Apr 20, 6:48 pm, Anatoliy wrote: > So what is your problem? > > update_cal_links() doesn't work after page refresh? > > On Apr 20, 1:05 pm, To

Re: Simple_tag strange behaviour

2009-04-20 Thread Tonne
ding function, but I'm afraid you eyes might bleed :) On Apr 20, 4:37 pm, Anatoliy wrote: > Tonne, > > I didn't see how you return array to template context. > > On Apr 20, 11:44 am, Tonne wrote: > > > > > Thanks > > > > Can you show code of

Re: Simple_tag strange behaviour

2009-04-20 Thread Tonne
solution to this issue http://groups.google.com/group/django-users/browse_thread/thread/ae40745aca946cf8/7b536034daa92e2b?lnk=gst&q=tonne#7b536034daa92e2b) tag -- cal = { 2007: { 1

Simple_tag strange behaviour

2009-04-19 Thread Tonne
I have a simple_tag that receives a queryset, then updates an array based on the queryset result (using a function), and finally it returns the array to the template context. It works beautifully the first time it is viewed with a browser. However, on subsequent "pageviews" the array is not updat

Re: Use Python to parse HTML and integrating said script into Django

2009-04-18 Thread Tonne
> But it sounds to me like you might want to look into creating your own > template tag to generate the calendar HTML. I'd rather do that than go > nuts with nested loops inside a template. Just to follow up on this... I have a working solution. Right or wrong, my answer was to create a template

Re: Use Python to parse HTML and integrating said script into Django

2009-04-13 Thread Tonne
Thanks for you input. Okay, I clearly need to do a bit of revision on nesting loops in templates then, if you think it might be possible to do that. 3 nested 'while' loops with incrementing variables sound doable in a template? >Well, what does the updating of the dict consist of? It will need t

Re: Use Python to parse HTML and integrating said script into Django

2009-04-13 Thread Tonne
Thanks for you reply, Jakob. I'd prefer to solve the problem the Django way. The problem for me is that what I'm trying to do is not the usual scenario of passing the results of query through a view to a template. I haven't found a precedent in the docs or a tutorial elsewhere that covers this.

Use Python to parse HTML and integrating said script into Django

2009-04-12 Thread Tonne
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

Re: Preserving pretty HTML output

2008-12-09 Thread Tonne
etiffy()>>> > >             >                  title >                  hello world >             >         > > I hope this helps. > > On Dec 3, 3:00 am, Tonne <[EMAIL PROTECTED]> wrote: > > > > > Thank you for the detailed response, Malcolm.

Re: Preserving pretty HTML output

2008-12-03 Thread Tonne
Thank you for the detailed response, Malcolm. I wasn't aware of the complexities of the issue and understand better now why it is the way it is. It was something that was really bugging me, but I feel like I can let it go now :) I'm not skilled enough in Python to take a crack at solving the prob

Preserving pretty HTML output

2008-12-02 Thread Tonne
I am interested to see if anyone could share their solutions for ensuring pretty HTML output. I have found achieving it to be a very uncomfortable compromise in that I seem to need to make my templates almost unreadable to do so, which isn't really a practical solution. Perhaps nicely formatted

Re: Basic SQL

2008-11-04 Thread Tonne
I must have read that section ten times, but not seen the wood for the trees in my haste to find the right approach. It's making more sense to me now. Thanks again. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Dj

Re: Basic SQL

2008-11-04 Thread Tonne
Daniel, thank you (x100)! That was exactly what I was looking for. > {% for entry in entries %} > {{ entry.title }} >     {% for image in entry.image_set.all %} >     >     {% endfor %} > {% endfor %} Now, could I ask what the name of the concept is that allows "image_set" to spontaneously exis

Re: Basic SQL

2008-11-03 Thread Tonne
I think I may be barking up the wrong tree, and if so please excuse the above. I now suspect that I should be associating the images with their relevant entries with template tags. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Go

Basic SQL

2008-11-03 Thread Tonne
*disclosure* I am SQL novice, okay */disclosure* I have what I think is a very simple problem, but can't seem to find a solution without writing raw SQL. I have 2 (simplified here) models: class Entry(models.Model): title = models.CharField(max_length=80) class Image(models.Model):

Re: Query subset

2008-11-02 Thread Tonne
In this case, as the amount of data is fairly small, I'm inclined to download the full queryset and let the template ignore the irrelevant data. Thanks Russ & Marcelo for your very helpful insights. --~--~-~--~~~---~--~~ You received this message because you are s

Re: Query subset

2008-10-31 Thread Tonne
Thanks Marcelo. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED]

Re: Query subset

2008-10-31 Thread Tonne
So, what I've done is use Model.objects.values() to limit the returned values, which is not ideal as I'm losing the objectness of the queryset. I've worked around the loss Queryset.get_absolute_url by using a less than elegant semi-hardcoded url. So if I'm missing a blindingly obvious way of lim

Query subset

2008-10-30 Thread Tonne
I have spent hours looking in the docs and one this list for an answer to this problem: I have a model that has, for example, 20 fields. On my site's homepage, where I'd like to offer a preview version of the object, I'd need to retrieve only say, half of those fields to be displayed. My dilemm

Re: Admin & ForeignKey confusion

2008-10-22 Thread Tonne
Thanks very much Karen. You are right. I have gotten confused by the inline option, and it is not required in the solution I was looking for. I have got it working now, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Admin & ForeignKey confusion

2008-10-22 Thread Tonne
n00b alert, btw: --- I'm very new to django so please forgive the stupid questions, but I'm struggling to get some very basic model relations to work. I'd be very grateful if someone could show me where I am going wrong. I have 2 incredibly simple models, where a Project