Example to use django queryset

时间:2023-02-07 00:24:55
from django.db.models import get_app, get_models, get_model
from django.db import models #get the certain model
sisense_model=get_model('fastlogin','sis_user_auth') #get the distinct values list
oa_username_list_temp=oa_user_model.objects.values('oa_username').distinct() #use the filter to get the certain value of model object
sisense_ser_id=sisense_model.objects.filter(sis_username__exact=sis_username).values('serv_id_id')[0].values()[0]