List Info

Thread: Cannot resolve keyword '___' into field




Cannot resolve keyword '___' into field
country flaguser name
Australia
2007-05-13 22:33:48
Hi,

Im currently at a loss about how to fix this issue.

I have tried the modpython.patch in #1796.

What is weird is that the doesn't consistently appear - it is intermittent. When I refresh the page it sometimes appears as it should, and other times with the error. I'm running the latest Django SVN version, and latest versions of Postgres, Psycopg, mod_python, python. The system is being hosted on Freebsd 6.1.

Getting 2 errors:
1)Cannot resolve keyword 'products' into field. Choices are: id, osIconName, osIconImage, altText, isPublished
2)Cannot resolve keyword 'products' into field. Choices are: id, osIconName, osIconImage, altText, isPublished, created_on, created_by, last_modified, modified_by
the models.py:

class Products(models.Model):
    productName = models.CharField('Product Name',maxlength=200)
    productSlug = models.SlugField('Product Slug',prepopulate_from=('productName',), unique=True)
    productDrivers = models.ManyToManyField('ProductDrivers', filter_interface=models.HORIZONTAL, blank=True, verbose_name='Product Drivers')
    productDocuments = models.ManyToManyField('ProductDocuments', filter_interface=models.HORIZONTAL, blank=True, verbose_name='Product Documents', related_name='productDocuments')
    productOSIcons = models.ManyToManyField('ProductOSIcons',verbose_name='Product Operating System Icons', filter_interface=models.HORIZONTAL, blank=True)
    relatedProducts = models.ManyToManyField('self',verbose_name='Related Products', filter_interface=models.HORIZONTAL, blank=True)
    class Admin:
        pass

class ProductOSIcons(models.Model):
    osIconName = models.CharField('Icon Name',maxlength=200)
    osIconImage = models.ImageField('Icon Image',upload_to='...' )
    altText = models.CharField('Icon Alt Text',maxlength=200)
    isPublished = models.BooleanField('Is Icon Published?' )
    class Admin:
        pass

class ProductDrivers(models.Model):
    driverName = models.CharField('Driver Name',maxlength=200)
    driverLink = models.URLField('Driver URL')
    isPublished = models.BooleanField('Is Driver Published?')
    class Admin:
        pass   

class ProductDocuments(models.Model):
    documentTitle = models.CharField('Document Title', maxlength=200)
    documentFile = models.FileField('Document File', upload_to='...')
    isPublished = models.BooleanField('Is Document Published?')
    class Admin:
        pass


views.py:

VIEW FOR ERROR 1.
    ...
    productCategories = ProductCategory.objects.filter(isPublished=True).order_by('categoryName')   
    for category in productCategories:
        products = Products.objects.filter(productCategory=category, isPublished=True, productDrivers__isPublished=True) or Products.objects.filter(productCategory=category, isPublished=True, productDocuments__isPublished=True)
        products = products.distinct().order_by('productName')
...
if product.productDrivers.filter(isPublished=True) and product.productDocuments.filter(isPublished=True):  # <------- ERROR IS HERE
     ...

VIEW FOR ERROR 2.

   ...     
    product = Products.objects.get(productSlug=product_slug, isPublished=True)
    relatedDocuments = product.productDocuments.filter(isPublished=True).order_by('documentTitle')
    osIcons = product.productOSIcons.filter(isPublished=True).order_by('osIconName')
    drivers = product.productDrivers.filter(isPublished=True).order_by('driverName')
   ...     
    return render_to_response('ProductPage.html', {'OsIcons':osIcons,'MEDIA_URL':MEDIA_URL}



Template Code:
...
{% if OsIcons %} # <----- ERROR IS HERE
<li>
{% for icon in OsIcons %}
<img class="logo" src="{{MEDIA_URL}}{{icon.osIconImage}}" alt="{{ icon.altText }}" />
{% endfor %}
</li>;
{% endif %} 
...

settings.py:

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.middleware.doc.XViewMiddleware',
    'appname.middleware.threadlocals.ThreadLocals',
)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users"; group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to django-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Re: Cannot resolve keyword '___' into field
country flaguser name
United States
2007-05-16 06:33:07
I'm getting the same problem as well.  Very frustrating,
can't find a
work around.. essentially makes django useless at this
point.

Malcolm Tredinnick wrote:
> On Tue, 2007-05-15 at 16:54 +1000, Mark Jarecki wrote:
> > The temporary fix that I've employed at the moment
is e.g.:
> >
> >
> > Instead of
> >
> >
> > > > osIcons =
> > > >
product.productOSIcons.filter(isPublished=True).order_by('os
IconName')
> >
> >
> > I've got:
> >
> >
> >     icons =
ProductOSIcons.objects.filter(isPublished=True)
> >     osIcons2 = []
> >     for icon in icons:
> >         if Products.objects.filter(id=product.id,
productOSIcons=icon,
> > isPublished=True):
> >             osIcons2.append(icon)
> >
> >
> > Which is a REALLY ugly solution, but hopefully I
wont have to use it
> > for too long.
>
> As the ticket you found suggests, we're aware of the
problem and I think
> we understand the latest reason it's not working
(middleware is
> introducing an extra curve-ball for some reason).
Fixing it is very hard
> because the problem is so non-reproducible. It's quite
likely that
> somebody running your exact code on a different machine
or with a
> different version of Python will not be able to
reproduce the problem.
>
> At the moment, I'm probably the most likely person to
end up fixing
> this. However all my free time for Django is taken at
the moment on some
> other items, so all I can encourage people who find
these problems to do
> is try to shuffle things around a little, as you've
done, in the hope of
> finding a workaround.
>
> Regards,
> Malcolm
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Cannot resolve keyword '___' into field
country flaguser name
Australia
2007-05-31 21:31:46
The solution I implemented for my app has worked without a
hitch at  
the moment. Unfortunately the problem still persists in the
admin.  
eg: when I log into the admin, the first page always shows
up the  
'Auth' and 'Sites' apps but intermittently shows up the app
i've  
written.

I would like to go through the admin and apply my fix to it.
I'm just  
wondering what files I would have to look through. Do I only
have to  
go through the django/contrib/admin/ folder and all the
files in it?

Regards,

Mark.



On 15/05/2007, at 7:33 PM, Malcolm Tredinnick wrote:


On Tue, 2007-05-15 at 16:54 +1000, Mark Jarecki wrote:
> The temporary fix that I've employed at the moment is
e.g.:
>
>
> Instead of
>
>
>>> osIcons =
>>>
product.productOSIcons.filter(isPublished=True).order_by 
>>> ('osIconName')
>
>
> I've got:
>
>
>     icons =
ProductOSIcons.objects.filter(isPublished=True)
>     osIcons2 = []
>     for icon in icons:
>         if Products.objects.filter(id=product.id,
productOSIcons=icon,
> isPublished=True):
>             osIcons2.append(icon)
>
>
> Which is a REALLY ugly solution, but hopefully I wont
have to use it
> for too long.

As the ticket you found suggests, we're aware of the problem
and I think
we understand the latest reason it's not working (middleware
is
introducing an extra curve-ball for some reason). Fixing it
is very hard
because the problem is so non-reproducible. It's quite
likely that
somebody running your exact code on a different machine or
with a
different version of Python will not be able to reproduce
the problem.

At the moment, I'm probably the most likely person to end up
fixing
this. However all my free time for Django is taken at the
moment on some
other items, so all I can encourage people who find these
problems to do
is try to shuffle things around a little, as you've done, in
the hope of
finding a workaround.

Regards,
Malcolm

>





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )