def duplicate(self, request, queryset): from utils import helpers for o in queryset: c = helpers.clone_model(o) c.id = None c.save() self.message_user(request, "Credentials successfully duplicated.")
def new_version(self, request, queryset): from utils import helpers for o in queryset: c = helpers.clone_model(o) c.id = None c.version = c.version + 1 c.save() d = datetime.datetime.fromtimestamp(time.time() - 1 , pytz.UTC) o.valid_until_date = d o.save() self.message_user(request, "New credentials version.")