Skip to content

Instantly share code, notes, and snippets.

View shrihari1999's full-sized avatar

Shrihari shrihari1999

  • India
View GitHub Profile
@nikhilkumarsingh
nikhilkumarsingh / google_calendar_api_integration.ipynb
Created May 10, 2019 10:01
Integrating Google Calendar API in Python Projects
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@victorono
victorono / remove_duplicates.py
Last active April 28, 2025 13:48
Django - remove duplicate objects where there is more than one field to compare
from django.db.models import Count, Max
unique_fields = ['field_1', 'field_2']
duplicates = (
MyModel.objects.values(*unique_fields)
.order_by()
.annotate(max_id=Max('id'), count_id=Count('id'))
.filter(count_id__gt=1)
)