Skip to content

Instantly share code, notes, and snippets.

@sdfsdhgjkbmnmxc
Forked from anonymous/cid.py
Created December 7, 2017 18:57
Show Gist options
  • Save sdfsdhgjkbmnmxc/aa466aced3bae81f34765cb7e027d4c2 to your computer and use it in GitHub Desktop.
Save sdfsdhgjkbmnmxc/aa466aced3bae81f34765cb7e027d4c2 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