Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.

Invalid filter: 'as_uni_form' #120

Open
jdh13 opened this issue Nov 11, 2011 · 6 comments
Open

Invalid filter: 'as_uni_form' #120

jdh13 opened this issue Nov 11, 2011 · 6 comments

Comments

@jdh13
Copy link

jdh13 commented Nov 11, 2011

hello,

i've upgraded from 0.8 to 0.9 and now it's broken.
The browser displays errors:
Django Version: 1.3
Exception Type: TemplateSyntaxError
Exception Value:

Invalid filter: 'as_uni_form'

Exception Location: /Users/me/python/virtualenv/myapp/lib/python2.6/site-packages/django/template/base.py in find_filter, line 320
Python Executable: /Users/me/python/virtualenv/myapp/bin/python
Python Version: 2.6.1
Python Path:

['/Users/me/python/virtualenv/myapp/myproj',
...
'/Users/me/python/virtualenv/myapp/lib/python2.6/site-packages/django_uni_form-0.9.0-py2.6.egg-info',
...

As you can see, the PythonPath shows the package directory, in which we have:
-rw-r--r-- 1 me staff 0 11 nov 05:51 init.py
-rw-r--r-- 1 me staff 184 11 nov 05:51 init.pyc
-rw-r--r-- 1 me staff 592 11 nov 05:51 uni_form_field.py
-rw-r--r-- 1 me staff 1164 11 nov 05:51 uni_form_field.pyc
-rw-r--r-- 1 me staff 2371 11 nov 05:51 uni_form_filters.py
-rw-r--r-- 1 me staff 3157 11 nov 05:51 uni_form_filters.pyc
-rw-r--r-- 1 me staff 6711 11 nov 05:51 uni_form_tags.py
-rw-r--r-- 1 me staff 7338 11 nov 05:51 uni_form_tags.pyc

i notice that as_uni_form is defined in:
templatetags/uni_form_filters.py:def as_uni_form(form):

on the other hand, if i test my form in a shell, it works:

from myapp.forms import LayoutTestForm
lay = LayoutTestForm()
print lay

company: email: password: re-enter password: first name: last name:

Thanks,

@maraujop
Copy link
Collaborator

Can you post a screenshot of the debug traceback?

Would you post some of the code you have to render the form? I guess you have {% load uni_form_tags %} on top and your project settings can look for templates in third party apps.

I don't have any clue what's happening with what you pasted. If you look at the application tests, there are tests in the application that check the filter and run correctly. Have you tried to run those tests to see if they pass in your machine? It could be some incompatibility with your Python version.

Regards,
Miguel

@jdh13
Copy link
Author

jdh13 commented Nov 11, 2011

what i don't understand is that if i do it in the shell:
/manage.py shellPython 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)

everything is ok

if i run the server from the same env:
./manage.py runserver 192.168.56.1:8000
Validating models...

0 errors found
Django version 1.3, using settings 'latp.settings'
Development server is running at http://192.168.56.1:8000/
Quit the server with CONTROL-C.
/Users/me/python/virtualenv/bmfvca6/lib/python2.6/site-packages/uni_form/helpers.py:11: DeprecationWarning: Importing from helpers is deprecated; import from helper or layout instead.
warnings.warn("Importing from helpers is deprecated; import from helper or layout instead.", DeprecationWarning)
[11/Nov/2011 11:36:50] "GET /pers/ HTTP/1.1" 500 259152

the template looks like:
{% load uni_form_tags %}

{{ form|as_uni_form }}

and in the settings:
INSTALLED_APPS = (
...
'uni_form',
...

i'll take a look at he application tests, and see how to pass them on my computer

thanks for your help,

gerard

@jdh13 jdh13 closed this as completed Nov 11, 2011
@jdh13 jdh13 reopened this Nov 11, 2011
@jdh13
Copy link
Author

jdh13 commented Nov 11, 2011

here are the tests results:
pwd
.../lib/python2.6/site-packages/uni_form/tests
python runtests.py
/Users/me/python/virtualenv/bmfvca6/lib/python2.6/site-packages/uni_form/helpers.py:11: DeprecationWarning: Importing from helpers is deprecated; import from helper or layout instead.
warnings.warn("Importing from helpers is deprecated; import from helper or layout instead.", DeprecationWarning)
Creating test database for alias 'default'...

......................

Ran 22 tests in 0.234s

OK
Destroying test database for alias 'default'...

i'm lost...

@ashwoods
Copy link

this issue is hitting me too. python 2.7 upgrading an old app from django 1.2 to 1.3. just started debugging the issue

@dtmunir
Copy link

dtmunir commented Feb 1, 2012

This issue has been plaguing me off and on as well. Sometimes a template that has been working perfectly fine with uni_form will start showing this error because of some change made in the view returning the template that affects one of the other variables. I know the issue here isn't necessarily with just uni_form, but somehow uni_form is the always the first victim of any other bugs that may arise in templates. And because the bugs are always pointed in this direction, sometimes it's hard to actually discover what is really broken

@fdemmer
Copy link

fdemmer commented Sep 8, 2012

make sure, that you don't have the templates directory of 0.8 still around somewhere. if there is a 'uni_form' directory in your templates dir, it may not properly load the new templates, that come with 0.9 (in the site-packages dir).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants