def reset( user, notification ): not_key = get_db_key_from_choices( MENU_NOTIFICATIONS_CHOICES, notification ) try: not2 = MenuNotifications.objects.get( user = user, notification = not_key ) except MenuNotifications.DoesNotExist: pass else: not2.delete()
def inc( user, notification ): not_key = get_db_key_from_choices( MENU_NOTIFICATIONS_CHOICES, notification ) try: not2 = MenuNotifications.objects.get( user = user, notification = not_key ) except MenuNotifications.DoesNotExist: MenuNotifications( user = user, notification = not_key ).save() else: not2.count += 1 not2.save()