mirror of https://github.com/zulip/zulip.git
confirmation: Remove util.get_status_field and settings.STATUS_FIELDS.
Unnecessarily general for our needs.
This commit is contained in:
parent
7cef3d95ee
commit
11c2b76275
|
@ -14,7 +14,6 @@ from django.contrib.contenttypes.models import ContentType
|
|||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.utils.timezone import now as timezone_now
|
||||
|
||||
from confirmation.util import get_status_field
|
||||
from zerver.lib.send_email import send_email
|
||||
from zerver.lib.utils import generate_random_token
|
||||
from zerver.models import PreregistrationUser, EmailChangeStatus
|
||||
|
@ -42,9 +41,8 @@ class ConfirmationManager(models.Manager):
|
|||
return False
|
||||
|
||||
obj = confirmation.content_object
|
||||
status_field = get_status_field(obj._meta.app_label, obj._meta.model_name)
|
||||
setattr(obj, status_field, getattr(settings, 'STATUS_ACTIVE', 1))
|
||||
obj.save()
|
||||
obj.status = getattr(settings, 'STATUS_ACTIVE', 1)
|
||||
obj.save(update_fields=['status'])
|
||||
return obj
|
||||
return False
|
||||
|
||||
|
|
|
@ -7,5 +7,3 @@ from typing import Any, Dict
|
|||
__revision__ = '$Id: settings.py 12 2008-11-23 19:38:52Z jarek.zgoda $'
|
||||
|
||||
STATUS_ACTIVE = 1
|
||||
|
||||
STATUS_FIELDS = {} # type: Dict[Any, Any]
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com>
|
||||
|
||||
__revision__ = '$Id: util.py 3 2008-11-18 07:33:52Z jarek.zgoda $'
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
def get_status_field(app_label, model_name):
|
||||
# type: (str, str) -> str
|
||||
model = '%s.%s' % (app_label, model_name)
|
||||
mapping = getattr(settings, 'STATUS_FIELDS', {})
|
||||
return mapping.get(model, 'status')
|
Loading…
Reference in New Issue