简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM