I want unique elements in hubcode_list. I can do it by
hubcode_list
hubcode_alarm_obj = HubAlarm.objects.all() for obj in hubcode_alarm_obj: hubcode = obj.h
Since you are using django, let the database do the filtering for you. It will be (by far) the fastest option:
objects = HubAlarm.objects.exclude(hubcode__in=hubcode_list)
See the documentation for more.