Skip to content

Instantly share code, notes, and snippets.

Created December 7, 2017 18:34
Show Gist options
  • Save anonymous/2aaef1b3a2633a6ccaadb4a92e79c249 to your computer and use it in GitHub Desktop.
Save anonymous/2aaef1b3a2633a6ccaadb4a92e79c249 to your computer and use it in GitHub Desktop.
cid.py
def apply_cid(obj):
cids = models.CallerId.objects.filter(extension=obj).all()
for c in cids:
c.status = 1
c.save()
class CidInLineAdmin(admin.TabularInline):
model = model.CallerId
extra = 0
class ExtensionAdmin(admin.ModelAdmin):
list_display = (
'extension',
'employee',
)
inlines = [
CidInLineAdmin,
]
def save_model(self, request, obj, form, change):
obj.save()
apply_cid(obj)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment