You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
346 B
Python
12 lines
346 B
Python
default_app_config = 'nano.badge.apps.NanoBadgeConfig'
|
|
|
|
def add_badge(badge, model):
|
|
"Put a badge on a model"
|
|
if badge not in model.badges.all():
|
|
model.badges.add(badge)
|
|
|
|
def batchbadge(badge, queryset):
|
|
"Put a badge on all models that do not already have the badge"
|
|
for model in queryset:
|
|
add_badge(badge, model)
|