[Solved] template url tag fetches wrong URL with generic view

2010-05-12 Thread Mike Dewhirst
On 13/05/2010 12:43pm, Mike Dewhirst wrote: I'm working through the Coltrane weblog tutorial and trying to implement semi-hard-coded breadcrumbs. It seems reverse doesn't like what I've done. Totally fair. I don't like what I did either. In 3. below I left out the = between href and the url

template url tag fetches wrong URL with generic view

2010-05-12 Thread Mike Dewhirst
I'm working through the Coltrane weblog tutorial and trying to implement semi-hard-coded breadcrumbs. It seems reverse doesn't like what I've done. This is the template inheritance chain ... 1. Salient parts of underlying template ... {% block breadcrumbs %}{{ block.super }} Mike's Blog {%

Re: how to display an image inside Django

2010-05-12 Thread newbiedjango
If you are trying to upload images as static images just as we do in html with an img tag then you might want to look for how to serve static documentation on the django book. You would need to make changes in settings.py by defining media_url, media_root, etc. and then make sure your root is on

Re: Trouble with multi-db test suite.

2010-05-12 Thread J. Cliff Dyer
On Wed, 2010-05-05 at 08:08 +0800, Russell Keith-Magee wrote: > On Wed, May 5, 2010 at 1:43 AM, J. Cliff Dyer wrote: > > I'm having trouble working with multi-db using mysql replication. When > > I run our test suite, I'm getting several hundred errors if I have more > >

Re: Removing template newlines in

2010-05-12 Thread Peter Landry
Right, sorry! Read your question too quickly. Peter On 5/12/10 2:20 PM, "Noah Watkins" wrote: > Peter > > I don't believe "spaceless" will work because in the example I posted > there are no html tags within the block. > Consider the same example where var2 is

Re: Comments inside a loop

2010-05-12 Thread Yanik
Wow, I feel totally stupid... works like a charm now :) On May 12, 2:14 pm, Karen Tracey wrote: > On Wed, May 12, 2010 at 1:52 PM, Yanik wrote: > > Hello, > > > I'm trying to do something that seemed simple, but can't get to work: > > displaying

Re: Removing template newlines in

2010-05-12 Thread Noah Watkins
I just stumbled upon this alternative too. Thanks for the reply, and really I don't think it's too ugly. On May 12, 11:50 am, zinckiwi wrote: > Not the prettiest thing in the world, but there's always: > > >   header >   {% if var1 %}{{ ... }} >   {% endif %}{% if var2 %}{{

Re: Removing template newlines in

2010-05-12 Thread zinckiwi
Not the prettiest thing in the world, but there's always: header {% if var1 %}{{ ... }} {% endif %}{% if var2 %}{{ ... }} {% endif %}{% if var3 %}{{ ... }} {% endif %} footer Regards Scott On May 12, 2:20 pm, Noah Watkins wrote: > Peter > > I don't believe

Re: Removing template newlines in

2010-05-12 Thread Noah Watkins
Peter I don't believe "spaceless" will work because in the example I posted there are no html tags within the block. Consider the same example where var2 is evaluated to be false: header ... --NEWLINE-- ... footer The newline remains, but is displayed on a webpage because it is in

RSS Aggregator

2010-05-12 Thread beetlecube
Hello, Just wondering if there are alternatives to the feedjack RSS aggregator that anyone has used. It doesn't have to be "Django-ized" like feedjack is. Just any Python library that you've had good luck with, parsing a lot of different RSS feeds. I know there are examples of using Mark

Re: Comments inside a loop

2010-05-12 Thread Karen Tracey
On Wed, May 12, 2010 at 1:52 PM, Yanik wrote: > Hello, > > I'm trying to do something that seemed simple, but can't get to work: > displaying comments using Django (1.2 RC)'s Comment framework inside a > loop. > > > {% for entry in entries %} >{% get_comment_list

Re: Taking on a NoneType error

2010-05-12 Thread Nick
Well, I am embarrassed to admin that this issue was 100% user error. I recently set up a dev and production server and copied everything from the old production server to the two new servers. I was testing the search results page on dev, that's the page that generates the links to the pages that

Re: Removing template newlines in

2010-05-12 Thread Peter Landry
If you want to keep the newlines in your template, you can use http://docs.djangoproject.com/en/1.1/ref/templates/builtins/#spaceless Peter On 5/12/10 2:02 PM, "Noah Watkins" wrote: > I have a variable amount of lines that need to be displayed in a > block: > > >

Removing template newlines in

2010-05-12 Thread Noah Watkins
I have a variable amount of lines that need to be displayed in a block: header {% if var1 %}{{ ... }}{% endif %} {% if var2 %}{{ ... }}{% endif %} {% if var3 %}{{ ... }}{% endif %} footer However, if some of the if-statements are not evaluated to be true then the line breaks are

Comments inside a loop

2010-05-12 Thread Yanik
Hello, I'm trying to do something that seemed simple, but can't get to work: displaying comments using Django (1.2 RC)'s Comment framework inside a loop. {% for entry in entries %} {% get_comment_list for entry as comments %} {% render_comment_form for entry %} {% endfor %} but

Re: Taking on a NoneType error

2010-05-12 Thread Karen Tracey
On Wed, May 12, 2010 at 1:06 PM, Nick wrote: > I am using a custom template tag called calculate age to produce an > age in numbers based on a filter for a template tag. > > Here is the tag: > > def age(bday, d=None): >if d is None: >d = datetime.datetime.now() >

Re: Taking on a NoneType error

2010-05-12 Thread Nuno Maltez
Hi, I think the simple {% if entry.DOB %} {{ entry.DOB|age }}{% else %} N/A {% endif %} should work. Or, the other way around: {% if not entry.DOB %} ... You could also try testing in your filter: def age(bday, d=None): if bday is None: return None and use the

Taking on a NoneType error

2010-05-12 Thread Nick
I am using a custom template tag called calculate age to produce an age in numbers based on a filter for a template tag. Here is the tag: def age(bday, d=None): if d is None: d = datetime.datetime.now() return (d.year - bday.year) - int((d.month, d.day) < (bday.month, bday.day))

Re: unit tests: database confusion

2010-05-12 Thread Phlip
> Hi jararaca >               Can u brief me the solution.Even i am not able to access test > database ,some how it fetch production database itself Hear galloping, think horses not zebras. are y'all running your test batch like this? python manage.py test --settings=test_settings.py does

Re: Saving objects that have foreign key fields using the pk instead of an instance of the foreignkeyed object

2010-05-12 Thread Nick Serra
Exactly what I was looking for, thanks! On May 12, 11:50 am, Daniel Roseman wrote: > On May 12, 4:34 pm, Nick Serra wrote: > > > Thanks for the response. I actually will already have the PK, and am > > trying to avoid grabbing an instance of the

Re: Saving objects that have foreign key fields using the pk instead of an instance of the foreignkeyed object

2010-05-12 Thread Daniel Roseman
On May 12, 4:34 pm, Nick Serra wrote: > Thanks for the response. I actually will already have the PK, and am > trying to avoid grabbing an instance of the actual item object. Yes, that's what I meant. You can assign the foreign key directly when instantiating an object,

Re: Dynamically content in include statement not working

2010-05-12 Thread Brian
Tom Thank you, Thanks you, Thank you. {% include inpage.footer %} works just fine. The {{}} is unnecessary as I had it. Sometime the brain is not working. Thanks again. On May 12, 11:36 am, Tom Evans wrote: > On Wed, May 12, 2010 at 4:31 PM, Brian

Re: Extending and Entity with the Django User model

2010-05-12 Thread x13
> something like that maybe works: > > class MyUser(models.Model): >     user = models.ForeignKey(User, unique=True) >     entity = models.ForeignKey(Entity, unique=True) >     > Sorry, this is my current proposal (but I really don't know if there is some difference with the previous one):

Extending and Entity with the Django User model

2010-05-12 Thread x13
Hello, I need to extend the Django User model in this way: I have an Entity model an I want to define a relationship one-2-one from User to Entity (so a Django User can be an Entity, but an Entity can be something else). So what's the best way to extend the User model for this particular case??

Re: Dynamically content in include statement not working

2010-05-12 Thread Tom Evans
On Wed, May 12, 2010 at 4:31 PM, Brian wrote: > Tom, I'm sorry > I am using include and it's not working: > Dynamically content in include statement not working: > > This works just fine: > {% include "FooterMessage.htm" %} > > > This will NOT work for me: > {% include

Re: Saving objects that have foreign key fields using the pk instead of an instance of the foreignkeyed object

2010-05-12 Thread Nick Serra
Thanks for the response. I actually will already have the PK, and am trying to avoid grabbing an instance of the actual item object. On May 12, 11:26 am, Daniel Roseman wrote: > On May 12, 4:04 pm, Nick Serra wrote: > > > > > > > Sorry for the

Re: Dynamically content in include statement not working

2010-05-12 Thread Brian
Tom, I'm sorry I am using include and it's not working: Dynamically content in include statement not working: This works just fine: {% include "FooterMessage.htm" %} This will NOT work for me: {% include "{{inpage.footer}}" %} (I know that inpage.footer == "FooterMessage.htm") On May 12,

Dynamically content in include statement not working

2010-05-12 Thread Brian
Help: Chapter 4: The Django Template System http://www.djangobook.com/en/1.0/chapter04/ This example includes the contents of the template whose name is contained in the variable template_name: {% include template_name %} All i'm trying to do is dynamically include a html template file This

Re: surveys

2010-05-12 Thread Scot Hacker
On May 11, 3:16 pm, HARRY POTTRER wrote: > I have a project that I'm working on that works like this: > > the user enters some points on a map which are then stored in a > database as a LineString object (via geodjango). Along with the > geographic data, the user is given a

Re: Saving objects that have foreign key fields using the pk instead of an instance of the foreignkeyed object

2010-05-12 Thread Daniel Roseman
On May 12, 4:04 pm, Nick Serra wrote: > Sorry for the confusing title. Here is a simple example to illustrate > my question: > > class Item(models.Model): >     name = models.CharField() > > class Manager(models.Model): >     item = models.ForeignKey(Item) > > On a POST I

Re: Dynamically content in include statement not working

2010-05-12 Thread Tom Evans
On Wed, May 12, 2010 at 4:10 PM, Brian wrote: > Help: > > Chapter 4: The Django Template System > http://www.djangobook.com/en/1.0/chapter04/ > > This example includes the contents of the template whose name is > contained in the variable template_name: > {% include

Dynamically content in include statement not working

2010-05-12 Thread Brian
Help: Chapter 4: The Django Template System http://www.djangobook.com/en/1.0/chapter04/ This example includes the contents of the template whose name is contained in the variable template_name: {% include template_name %} All i'm trying to do is dynamically include an html template file: This

Saving objects that have foreign key fields using the pk instead of an instance of the foreignkeyed object

2010-05-12 Thread Nick Serra
Sorry for the confusing title. Here is a simple example to illustrate my question: class Item(models.Model): name = models.CharField() class Manager(models.Model): item = models.ForeignKey(Item) On a POST I have the PK of the Item I want to link to a new instance of the Manager object.

Re: unit tests: database confusion

2010-05-12 Thread gulle
jararaca wrote: > > > Thanks Russ, I don't have a stray settings-file but I've spotted the > problem now: One of my files with custom SQL for the models contained > the line USE xy; (with xy being my database, argh!). So everything > before the execution of this line used my test database

Re: Updating profiles

2010-05-12 Thread Wiiboy
Just as a side note, I made the user part of my Profile model a OneToOneField. Makes it easier to reference, i.e. user.profile.FIELD vs. user.get_profile().field -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: Many2Many / Generic Relation filter, doesn't behave like expected, how is the right way to do it?

2010-05-12 Thread tom
hello all! I have similar problem: assume books-tabls, in manyToMany relation with tags-table through bookTagMatch-table I am looking for a way to do this through the admin filter: subclass relatedFilter to interpret the url: /?bookTag=7=3 and returns book tuples that are tagged under class 7 AND

Re: how to display an image inside Django

2010-05-12 Thread Sam Walters
Specifically what do you want to do? 1. Write a form to upload and display an image? 2. Dynamically display/generate an image? eg: http://effbot.org/zone/django-pil.htm 3. hyperlink an image from a templates folder or media folder? (with either django test server or a production server) On

Re: how to display an image inside Django

2010-05-12 Thread Daniel Roseman
On May 12, 5:36 am, ravi krishna wrote: > Hi, > Thanks for ur reply. I was asking about the ImageField. tried out the > tutorials, but its not working out. Where > all(views,models,urls.py,settings.py) should we make editings inorder to > work. Please help me If you really

Re: Close window after download

2010-05-12 Thread Sebastian Pawlus
I'm not sure about your case http://jquery.malsup.com/form/ and event "success", take a look on http://jquery.malsup.com/form/#ajaxSubmit. > Does anyone know how to track if a download completed? > > On May 6, 9:52 pm, CrabbyPete wrote: >> I have code that generates a file

Re: Multiple django version on developer machine

2010-05-12 Thread Sebastian Pawlus
And after virtualen take a look on virtualenvwrapper, makes virtualenv more handy http://pypi.python.org/pypi/virtualenvwrapper On Wed, May 12, 2010 at 4:50 AM, Andy McKay wrote: > > On 2010-05-11, at 7:26 PM, james_027 wrote: >> While I have a number of django apps develop