from PixivSearch.model.config import rule def insert(value): rule(regex=value).save() def delete(value): select(value).delete() def select(value=None): if value == None: return rule.objects.all() else: return rule.objects.filter(regex=value)