1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-21 19:37:28 +00:00

[social auth & notification] Add wechat work notification

This commit is contained in:
zhengxie
2018-11-14 16:04:50 +08:00
parent 57fac87e44
commit 0efcbb10a3
45 changed files with 2589 additions and 3 deletions

View File

@@ -0,0 +1,34 @@
# coding=utf-8
import six
import django
from django.db import models
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
MiddlewareMixin = object
def get_rel_model(field):
if django.VERSION >= (2, 0):
return field.remote_field.model
user_model = field.rel.to
if isinstance(user_model, six.string_types):
app_label, model_name = user_model.split('.')
user_model = models.get_model(app_label, model_name)
return user_model
def get_request_port(request):
if django.VERSION >= (1, 9):
return request.get_port()
host_parts = request.get_host().partition(':')
return host_parts[2] or request.META['SERVER_PORT']