It just means the "field_name" you are using in the filter query doesn't
exist.

Multiple reasons:
1. The model doesn't really have that field in its definition.
2. You forgot migrating your database.
3. The field name being sent from your form is not right.

To get a clearer picture, try the same filter query directly on Django
shell ("Python manage.py shell") and check what happens.

On Thu, May 26, 2016, 5:54 PM Jianshu Hu <hujianshu...@gmail.com> wrote:

> To all,
>
> I am new to django, and learning to establish a site.
>
> Here is my problem:
>     I have got a databse and a table in mysql, and am using django to read
> the data from it.
>     I got a pair of values [FIELD_NAME,VALUE] from the GET method of a
> html page. When the values passed to the searching function, I want to get
> the searching result.
>     I knew how to do this in MySQLdb, but unable to achieve it in django
> model.
>     In MySQLdb:
>         cur.execute("SELECT COLUMN_A,COLUMN_B,COLUMN_C FROM mydatabase
> WHERE %s=%s",(filed_name,value))
>     However, in django:
>         results=mydatabase.objects.filter(filed_name=value)
>     I got an error: Cannot resolve keyword 'filed1' into field. Choices
> are: Bla bla bla
>
>    What should I do?
>
> Bests.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bddb8755-33d2-4bb4-9769-3fb350a43ff0%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/bddb8755-33d2-4bb4-9769-3fb350a43ff0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACyRkBUFVBe2K5Ym4xokFdGdNvhFfN-8%3D54YFSdf_NEm_f_Ssw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to