Hi,
First of all - the examples you are giving can't be correct.
z = Model.objects.get(name=x)
will only return 1 object - and will raise an exception if you get more than one result. So in this case z should be an instance of the model Model.
z = <Object: 1>
and cannot be [<Object: 1>, <Object: 2>]
When querying the second query you should get a QuerySet as a result, because you have filtered.
So from : z = Model.objects.filter(name=x) you would get:
[<Object: 1>]
in other words a list of 1 object (because the name was unique). Then your code:
should definitely work.
If your want to do the query and just get one result (because you are querying with the unique name), you can write:
z = Model.objects.filter(name=x).first()
This way z will also be None if there isn't any object that has the name = x.