add messagfe

This commit is contained in:
baoliang 2021-02-02 13:22:45 +08:00
parent 523968ffc9
commit 32acb606f9
8 changed files with 46 additions and 46 deletions

View File

@ -254,8 +254,13 @@ UNQUALIFIED_MEDIA_TYPE_CHOICES = (
class UnqualifiedMedia(models.Model): class UnqualifiedMedia(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
media_id = models.UUIDField('media_id', null=True, blank=True) media_id = models.UUIDField('media_id', null=True, blank=True)
name = models.CharField('name',max_length=256, null=True, blank=True)
unit = models.CharField('unit', max_length=256, null=True, blank=True)
type = models.IntegerField( type = models.IntegerField(
'Type', choices=UNQUALIFIED_MEDIA_TYPE_CHOICES, default=0) 'Type', choices=UNQUALIFIED_MEDIA_TYPE_CHOICES, default=0)
province = models.CharField('', max_length=256, null=True, blank=True)
cities = models.CharField('', max_length=256, null=True, blank=True)
district = models.CharField('', max_length=256, null=True, blank=True)
result = models.TextField('result', null=True, blank=True) result = models.TextField('result', null=True, blank=True)
cou = models.IntegerField('count of update', default=0) cou = models.IntegerField('count of update', default=0)
dos = models.IntegerField('days of silent', default=0) dos = models.IntegerField('days of silent', default=0)

View File

@ -2,23 +2,24 @@
<div class="flex-container"> <div class="flex-container">
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<div> <div style="margin: 5px 15px">
{% if level == '1' or level == '9'%} {% for key, value in {% if level == '1' or level == '9' %}
compartments.items %} {% if len(key) != 0 %} {% for key, value in compartments.items %}
{% if key|length != 0 %}
<a <a
class="btn {{ cities==value|yesno:"btn-primary,btn-default" }}" class="btn btn-default {% if cities == key %}btn-primary{% endif %}"
href="{% url 'myview' %}?province={{province}}&cities={{value}}&district={{district}}&level={{level}}" href="{% url 'polls_media_unqualified' %}?province={{province}}&cities={{key}}}&district={{district}}&level={{level}}"
role="button" role="button"
>{{value}}</a >{{value}}</a
> >
{% endif%} {% endfor %} {% endif %} {% endif%}
{% if level == '2'%} {% endfor %}
{% for key, value in {% endif %}
compartments.items %} {% if level == '2'%} {% for key, value in compartments.items %}
{% if key == cities %} {% if key == cities %}
<a <a
class="btn {{ cities==value|yesno:"btn-primary,btn-default" }}" class="btn btn-primary"
href="{% url 'myview' %}?province={{province}}&cities={{value}}&district={{district}}&level={{level}}" href="{% url 'polls_media_unqualified' %}?province={{province}}&cities={{value}}&district={{district}}&level={{level}}"
role="button" role="button"
>{{value}}</a >{{value}}</a
> >
@ -30,30 +31,20 @@
<thead> <thead>
<tr> <tr>
<th>#</th> <th>#</th>
<th>First Name</th> <th>名称</th>
<th>Last Name</th> <th>单位</th>
<th>Username</th> <th>原因</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for m in medias %}
<tr> <tr>
<th scope="row">1</th> <th scope="row">{{m.counter}}</th>
<td>Mark</td> <td>{{m.name}}</td>
<td>Otto</td> <td>{{m.unit}}</td>
<td>@mdo</td> <td>{{m.comment}}</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr> </tr>
{% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -28,7 +28,8 @@ urlpatterns = [
path('medias/update/', views.update_media, name='polls_update_media'), path('medias/update/', views.update_media, name='polls_update_media'),
path('medias/list/', views.medias, name='polls_medias'), path('medias/list/', views.medias, name='polls_medias'),
path('medias/my/', views.my_medias, name='polls_my_medias'), path('medias/my/', views.my_medias, name='polls_my_medias'),
path('medias/admin/change/', views.media_admin_change, name='polls_media_admin_change'), path('medias/admin/change/', views.media_admin_change,
name='polls_media_admin_change'),
path('medias/<str:type>/<str:media_id>/', path('medias/<str:type>/<str:media_id>/',
views.media_detail, name='polls_media_detail'), views.media_detail, name='polls_media_detail'),
path('medias/delete/', views.delete_media, name='polls_delete_media'), path('medias/delete/', views.delete_media, name='polls_delete_media'),
@ -43,6 +44,8 @@ urlpatterns = [
path('monitor/city/ranking/', views.city_ranking, name='polls_city_ranking'), path('monitor/city/ranking/', views.city_ranking, name='polls_city_ranking'),
path('monitor/result/', views.monitor_result, path('monitor/result/', views.monitor_result,
name='polls_monitor_result'), name='polls_monitor_result'),
path('monitor/media/unqualified',
views.monitor_unqualified_result, name='polls_media_unqualified'),
path('tasks/list/', views.tasks, name='polls_tasks_list'), path('tasks/list/', views.tasks, name='polls_tasks_list'),
path('tasks/create/', views.create_task, name='polls_tasks_create'), path('tasks/create/', views.create_task, name='polls_tasks_create'),
path('tasks/get/', views.get_task, name='polls_tasks_get'), path('tasks/get/', views.get_task, name='polls_tasks_get'),
@ -73,7 +76,8 @@ urlpatterns = [
path('app/intro.html', views.app_intro, name='polls_app_intro'), path('app/intro.html', views.app_intro, name='polls_app_intro'),
path('app/download/', views.download, name='polls_app_download'), path('app/download/', views.download, name='polls_app_download'),
path('app/has/update/', views.has_update, name='polls_app_has_update'), path('app/has/update/', views.has_update, name='polls_app_has_update'),
path('app/profile/image/upload/', views.upload_profile, name='polls_profile_upload'), path('app/profile/image/upload/', views.upload_profile,
name='polls_profile_upload'),
] ]
tasks.process_notify_task(repeat=5) tasks.process_notify_task(repeat=5)

View File

@ -2,7 +2,7 @@ from .user import index, status_500, status_401, polls_login, send_code, registe
from .notice import notices, notice_top, read_notice, pass_notice, reject_notice, detail_notice, unread_notice_count from .notice import notices, notice_top, read_notice, pass_notice, reject_notice, detail_notice, unread_notice_count
from .media import medias, my_medias, create_media, update_media, media_detail, delete_media, media_admin_change from .media import medias, my_medias, create_media, update_media, media_detail, delete_media, media_admin_change
from .news import news_list, news_top, news_detail from .news import news_list, news_top, news_detail
from .monitor import monitor_statistics, monitor_result, media_statistics, city_ranking from .monitor import monitor_statistics, monitor_result, media_statistics, city_ranking, monitor_unqualified_result
from .task import tasks, create_task, create_test_task, get_task from .task import tasks, create_task, create_test_task, get_task
from .group import groups, room, is_level1_or_leve2, group_member, group_manager, group_enter, group_leave, pick_groups from .group import groups, room, is_level1_or_leve2, group_member, group_manager, group_enter, group_leave, pick_groups
from .compartment import compartments from .compartment import compartments

View File

@ -147,17 +147,17 @@ def monitor_result(request):
def monitor_unqualified_result(request): def monitor_unqualified_result(request):
if request.method == 'POST': if request.method == 'POST':
return HttpResponse(status=405) return HttpResponse(status=405)
province = request.GET.get('province') province = request.GET.get('province','')
cities = request.GET.get('cities') cities = request.GET.get('cities','')
district = request.GET.get('district') district = request.GET.get('district','')
version = request.GET.get('version', '0') version = request.GET.get('version', '0')
level = request.GET.get('level', '0') level = request.GET.get('level', '0')
q = UnqualifiedMedia.objects.filter(version=version) q = UnqualifiedMedia.objects.filter(version=version)
if province: if province:
q = q.filter(media__organization__province=province) q = q.filter(province=province)
if cities: if cities:
q = q.filter(media__organization__cities=cities) q = q.filter(cities=cities)
if district: if district:
q = q.filter(media__organization__district=district) q = q.filter(district=district)
return render(request, 'polls/monitor_unqualified_result.html', {'medias': q, 'level': level, 'province': province, 'cities': cities, 'district': district, 'compartments': COMPARTMENTS}) return render(request, 'polls/monitor_unqualified_result.html', {'medias': q, 'level': level, 'province': province, 'cities': cities, 'district': district, 'compartments': COMPARTMENTS})