-
-
+{% block title %}index{% endblock %}
+{% block content %}
+
-
-
+
+
+
+
+ CPU Traffic
+ 90%
+
+
+
+
+
+
+
+
+
+
+
+ Likes
+ 41,410
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Sales
+ 760
+
+
+
+
+
+
+
+
+
+
+
+ New Members
+ 2,000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
90,70,90,70,75,80,70
+
+
Visits
+
+
+
+
90,50,90,70,61,83,63
+
+
Referrals
+
+
+
+
90,50,90,70,61,83,63
+
+
Organic
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Order ID |
+ Item |
+ Status |
+ Popularity |
+
+
+
+
+ OR9842 |
+ Call of Duty IV |
+ Shipped |
+
+ 90,80,90,-70,61,-83,63
+ |
+
+
+ OR1848 |
+ Samsung Smart TV |
+ Pending |
+
+ 90,80,-90,70,61,-83,68
+ |
+
+
+ OR7429 |
+ iPhone 6 Plus |
+ Delivered |
+
+ 90,-80,90,70,-61,83,63
+ |
+
+
+ OR7429 |
+ Samsung Smart TV |
+ Processing |
+
+ 90,80,-90,70,-61,83,63
+ |
+
+
+ OR1848 |
+ Samsung Smart TV |
+ Pending |
+
+ 90,80,-90,70,61,-83,68
+ |
+
+
+ OR7429 |
+ iPhone 6 Plus |
+ Delivered |
+
+ 90,-80,90,70,-61,83,63
+ |
+
+
+ OR9842 |
+ Call of Duty IV |
+ Shipped |
+
+ 90,80,90,-70,61,-83,63
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Inventory
+
5,200
+
+
+
+ 50% Increase in 30 Days
+
+
+
+
+
+
+
+
+
+
Mentions
+
92,050
+
+
+
+ 20% Increase in 30 Days
+
+
+
+
+
+
+
+
+
+
Downloads
+
114,381
+
+
+
+ 70% Increase in 30 Days
+
+
+
+
+
+
+
+
+
+
Direct Messages
+
163,921
+
+
+
+ 40% Increase in 30 Days
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+

+
+
+
+
+ -
+
+

+
+
+
Bicycle
+ $700
+
+ 26" Mongoose Dolomite Men's 7-speed, Navy Blue.
+
+
+
+
+ -
+
+

+
+
+
Xbox One $350
+
+ Xbox One Console Bundle with Halo Master Chief Collection.
+
+
+
+
+ -
+
+

+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+{% endblock %}
\ No newline at end of file
diff --git a/groups/templates/groups/job.html b/groups/templates/groups/job.html
new file mode 100644
index 00000000..8681856a
--- /dev/null
+++ b/groups/templates/groups/job.html
@@ -0,0 +1,98 @@
+{% extends "./base.html" %}
+
+{% block title %}jobs{% endblock %}
+
+{% block content %}
+
+
+
+
Warning!
+
+
Morris.js charts are no longer maintained by its author. We would recommend using any of the other
+ charts that come with the template.
+
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/groups/templates/groups/login.html b/groups/templates/groups/login.html
new file mode 100644
index 00000000..bcec24e0
--- /dev/null
+++ b/groups/templates/groups/login.html
@@ -0,0 +1,66 @@
+{% load static %}
+
+
+
+
+
+
+
+
+
+
+ 登录
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/groups/urls.py b/groups/urls.py
index c486297d..44f93535 100644
--- a/groups/urls.py
+++ b/groups/urls.py
@@ -1,6 +1,14 @@
from django.urls import path
+from django.urls import include
from . import views
urlpatterns = [
- path('', views.index, name='index'),
+ path('', views.index, name='groups_index'),
+ path('index/', views.index, name='groups_index'),
+ path('login/', views.login, name='groups_login'),
+ path('logout/', views.logout, name='groups_logout'),
+ path('captcha/', include('captcha.urls')),
+ path('company/', views.company, name='groups_company'),
+ path('job/', views.job, name='groups_job'),
+ path('refresh_captcha/', views.refresh_captcha),
]
\ No newline at end of file
diff --git a/groups/views.py b/groups/views.py
index 1c650cba..955f4d33 100644
--- a/groups/views.py
+++ b/groups/views.py
@@ -1,8 +1,62 @@
from django.http import HttpResponse
from django.shortcuts import render
+from django.shortcuts import redirect
from .models import Groups
+from .forms import GroupsForm
+
def index(request):
- #latest_question_list = Question.objects.order_by('-pub_date')[:5]
+ if not request.session.get('is_login', None):
+ return redirect('/groups/login/')
return render(request, 'groups/index.html')
+
+def login(request):
+ # 不允许重复登录
+ if request.session.get('is_login', None):
+ return redirect('/groups/index/')
+ if request.method == "POST":
+ groups_form = GroupsForm(request.POST)
+ message = '请检查填写的内容!'
+ if groups_form.is_valid():
+ username = groups_form.cleaned_data.get('username')
+ password = groups_form.cleaned_data.get('password')
+
+ try:
+ user = Groups.objects.get(name=username)
+ except:
+ message = '用户不存在!'
+ return render(request, 'groups/login.html', locals())
+ if user.password == password:
+ request.session['is_login'] = True
+ request.session['user_id'] = user.id
+ request.session['user_name'] = user.name
+ return redirect('/groups/index/')
+ else:
+ message = '密码不正确!'
+ return render(request, 'groups/login.html', locals())
+ else:
+ return render(request, 'groups/login.html', locals())
+ groups_form = GroupsForm()
+ return render(request, 'groups/login.html', locals())
+
+def logout(request):
+ if not request.session.get('is_login', None):
+ return redirect('/groups/login')
+ request.session.flush()
+ return redirect('/groups/login')
+
+import json
+from captcha.models import CaptchaStore
+from captcha.helpers import captcha_image_url
+def refresh_captcha(request):
+ hashkey = CaptchaStore.generate_key()
+ image_url = captcha_image_url(hashkey)
+ return HttpResponse(json.dumps({'key': hashkey, 'image_url': image_url}), content_type='application/json')
+
+
+def company(request):
+ return render(request, 'groups/company.html', locals())
+
+def job(request):
+ return render(request, 'groups/job.html', locals())
diff --git a/mysite/settings.py b/mysite/settings.py
index 1a9a43bb..b1fb09f1 100644
--- a/mysite/settings.py
+++ b/mysite/settings.py
@@ -39,6 +39,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
'safesite',
'groups',
+ 'captcha',
]
MIDDLEWARE = [
diff --git a/safesite/migrations/0265_companyinfo.py b/safesite/migrations/0265_companyinfo.py
new file mode 100644
index 00000000..7a9d1543
--- /dev/null
+++ b/safesite/migrations/0265_companyinfo.py
@@ -0,0 +1,35 @@
+# Generated by Django 2.1.4 on 2019-09-12 15:10
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('safesite', '0264_auto_20190909_0916'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='CompanyInfo',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(max_length=64, verbose_name='公司名称')),
+ ('nature', models.SmallIntegerField(choices=[(0, '国企'), (1, '私企')], default=0, verbose_name='企业性质')),
+ ('address', models.CharField(max_length=128, verbose_name='公司地址')),
+ ('fixed_assets', models.IntegerField(blank=True, null=True, verbose_name='固定资产')),
+ ('website', models.CharField(blank=True, max_length=64, null=True, verbose_name='公司网址')),
+ ('peoplenum', models.IntegerField(blank=True, null=True, verbose_name='公司人数')),
+ ('legalperson', models.CharField(blank=True, max_length=24, null=True, verbose_name='法人代表')),
+ ('legalperson_phone', models.CharField(blank=True, max_length=24, null=True, verbose_name='法人电话')),
+ ('liaison', models.CharField(max_length=24, verbose_name='联系人')),
+ ('liaison_phone', models.CharField(max_length=24, verbose_name='联系人电话')),
+ ('liaison_fax', models.CharField(blank=True, max_length=10, null=True, verbose_name='联系人传真')),
+ ('introduce', models.TextField(blank=True, null=True, verbose_name='公司概况')),
+ ('createtime', models.DateTimeField(auto_now_add=True)),
+ ('modifytime', models.DateTimeField(auto_now=True)),
+ ('partment', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='safesite.Partment', verbose_name='公司ID')),
+ ],
+ ),
+ ]
diff --git a/safesite/migrations/0268_merge_20191009_0952.py b/safesite/migrations/0268_merge_20191009_0952.py
new file mode 100644
index 00000000..45a06ae3
--- /dev/null
+++ b/safesite/migrations/0268_merge_20191009_0952.py
@@ -0,0 +1,15 @@
+# Generated by Django 2.1.4 on 2019-10-09 09:52
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('safesite', '0265_auto_20190917_1716'),
+ ('safesite', '0267_auto_20190917_1543'),
+ ('safesite', '0265_companyinfo'),
+ ]
+
+ operations = [
+ ]