doniyor
doniyor

Reputation: 37904

how to work only on one field of ValuesQuerySet - Django

I am stuck in this small issue: i have this query:

 studiengaenge = Studiengang.objects.values('studiengaenge').filter(kurzname__icontains=kurzname)
 res = studiengaenge.cleaned_data['studiengaenge'].split('@')

it is giving me the error saying that:

'ValuesQuerySet' object has no attribute 'cleaned_data'

I will have a tuple in studiengaenge of this kind : ['studiengaenge':'blablabla@blabla@']

i want to split the blablabla@blabla@ by @ to normal array of strings. how do i do this?

Upvotes: 0

Views: 87

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599846

No, your queryset doesn't have a cleaned_data attribute. Why should it? That's for forms.

You can get one of the elements by slicing, just like any other queryset.

Upvotes: 1

Related Questions