diff --git a/groups/admin.py b/groups/admin.py index bcccd803..f8050ce2 100644 --- a/groups/admin.py +++ b/groups/admin.py @@ -1,4 +1,4 @@ from django.contrib import admin from . import models # Register your models here. -admin.site.register(models.Groups) \ No newline at end of file +admin.site.register(models.Groups) diff --git a/groups/forms.py b/groups/forms.py new file mode 100644 index 00000000..7696e0a7 --- /dev/null +++ b/groups/forms.py @@ -0,0 +1,7 @@ +from django import forms +from captcha.fields import CaptchaField + +class GroupsForm(forms.Form): + username = forms.CharField(label="用户名", max_length=128, widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': "Username",'autofocus': ''})) + password = forms.CharField(label="密码", max_length=256, widget=forms.PasswordInput(attrs={'class': 'form-control','placeholder': "Password"})) + captcha = CaptchaField(label='验证码', error_messages={"invalid":"验证码错误"}) diff --git a/groups/static/groups/images/pic1.jpg b/groups/static/groups/images/pic1.jpg new file mode 100644 index 00000000..6683b7a8 Binary files /dev/null and b/groups/static/groups/images/pic1.jpg differ diff --git a/groups/static/groups/images/pic11.jpg b/groups/static/groups/images/pic11.jpg new file mode 100644 index 00000000..f74e6d9f Binary files /dev/null and b/groups/static/groups/images/pic11.jpg differ diff --git a/groups/static/groups/login/login.css b/groups/static/groups/login/login.css new file mode 100644 index 00000000..cb62f4c2 --- /dev/null +++ b/groups/static/groups/login/login.css @@ -0,0 +1,41 @@ +body { + height: 100%; + background-image: url('../images/pic1.jpg'); +} +.form-login { + width: 100%; + max-width: 330px; + padding: 15px; + margin: 0 auto; +} +.form-login{ + margin-top:80px; + font-weight: 400; +} +.form-login .form-control { + position: relative; + box-sizing: border-box; + height: auto; + padding: 10px; + font-size: 16px; + +} +.form-login .form-control:focus { + z-index: 2; +} +.form-login input[type="text"] { + margin-bottom: -1px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.form-login input[type="password"] { + margin-bottom: 10px; + border-top-left-radius: 0; + border-top-right-radius: 0; +} +form a{ + display: inline-block; + margin-top:25px; + font-size: 12px; + line-height: 10px; +} \ No newline at end of file diff --git a/groups/templates/groups/base.html b/groups/templates/groups/base.html new file mode 100644 index 00000000..2e49593e --- /dev/null +++ b/groups/templates/groups/base.html @@ -0,0 +1,210 @@ + + + + {% load static %} + + + {% block title %} title {% endblock %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + +
+ +
+

+ Dashboard + Control panel +

+ +
+ + {% block content %} + +
+

content

+
+ + {% endblock %} +
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/groups/templates/groups/company.html b/groups/templates/groups/company.html new file mode 100644 index 00000000..7d1f8d30 --- /dev/null +++ b/groups/templates/groups/company.html @@ -0,0 +1,56 @@ +{% extends "./base.html" %} + +{% block title %}company list{% endblock %} + +{% block content %} + +
+
+
+ + +
+
+

Data Table With Full Features

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Rendering engineBrowserPlatform(s)Engine versionCSS grade
GeckoFirefox 1.0Win 98+ / OSX.2+1.7A
GeckoCamino 1.5OSX.3+1.8A
GeckoMozilla 1.0Win 95+ / OSX.1+1A
Rendering engineBrowserPlatform(s)Engine versionCSS grade
Showing 1 to 10 of 57 entries
+
+ +
+ +
+ +
+ +
+ +{% endblock %} \ No newline at end of file diff --git a/groups/templates/groups/index.html b/groups/templates/groups/index.html index b121d0b7..88769275 100644 --- a/groups/templates/groups/index.html +++ b/groups/templates/groups/index.html @@ -1,818 +1,503 @@ - - - - {% load static %} - - - AdminLTE 2 | Dashboard - - - - - - - - - - - - - - - - - - - - - - +{% extends "./base.html" %} - - - - - - - - -
- -
- - - - -
- - - - -
- -
-

- Dashboard - Control panel -

- -
+{% block title %}index{% endblock %} +{% block content %}
+
-
- +
+
+ +
+ CPU Traffic + 90% +
+ +
+ +
+ +
+
+ + +
+ Likes + 41,410 +
+ +
+ +
+ + + +
+ +
+
+ + +
+ Sales + 760 +
+ +
+ +
+ +
+
+ + +
+ New Members + 2,000 +
+ +
+ +
+ +
+ + +
+
-
-

Data Table With Full Features

+
+

Monthly Recap Report

+ +
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Rendering engineBrowserPlatform(s)Engine versionCSS grade
GeckoFirefox 1.0Win 98+ / OSX.2+1.7A
GeckoCamino 1.5OSX.3+1.8A
GeckoMozilla 1.0Win 95+ / OSX.1+1A
Rendering engineBrowserPlatform(s)Engine versionCSS grade
Showing 1 to 10 of 57 entries
+
+
+

+ Sales: 1 Jan, 2014 - 30 Jul, 2014 +

+ +
+ + +
+ +
+ +
+

+ Goal Completion +

+ +
+ Add Products to Cart + 160/200 + +
+
+
+
+ +
+ Complete Purchase + 310/400 + +
+
+
+
+ +
+ Visit Premium Page + 480/800 + +
+
+
+
+ +
+ Send Inquiries + 250/500 + +
+
+
+
+ +
+ +
+ +
+ + + +
+ +
+ +
+ + + +
+ +
+ +
+
+

Visitors Report

+ +
+ + +
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
90,70,90,70,75,80,70
+
8390
+ Visits +
+ +
+
90,50,90,70,61,83,63
+
30%
+ Referrals +
+ +
+
90,50,90,70,61,83,63
+
70%
+ Organic +
+ +
+
+ +
+
+ +
+
+

Latest Orders

+ +
+ + +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Order IDItemStatusPopularity
OR9842Call of Duty IVShipped +
90,80,90,-70,61,-83,63
+
OR1848Samsung Smart TVPending +
90,80,-90,70,61,-83,68
+
OR7429iPhone 6 PlusDelivered +
90,-80,90,70,-61,83,63
+
OR7429Samsung Smart TVProcessing +
90,80,-90,70,-61,83,63
+
OR1848Samsung Smart TVPending +
90,80,-90,70,61,-83,68
+
OR7429iPhone 6 PlusDelivered +
90,-80,90,70,-61,83,63
+
OR9842Call of Duty IVShipped +
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 + +
+ +
+ + +
+
+

Recently Added Products

+ +
+ + +
+
+ +
+
    +
  • +
    + Product Image +
    +
    + Samsung TV + $1800 + + Samsung 32" 1080p 60Hz LED Smart HDTV. + +
    +
  • + +
  • +
    + Product Image +
    +
    + Bicycle + $700 + + 26" Mongoose Dolomite Men's 7-speed, Navy Blue. + +
    +
  • + +
  • +
    + Product Image +
    +
    + Xbox One $350 + + Xbox One Console Bundle with Halo Master Chief Collection. + +
    +
  • + +
  • +
    + Product Image +
    +
    + PlayStation 4 + $399 + + PlayStation 4 500GB Console (PS4) + +
    +
  • + +
+
+ + + +
+
-
- - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +{% 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.

+
+
+
+ +
+
+

Area Chart

+ +
+ + +
+
+
+
+
+ +
+ + + +
+
+

Donut Chart

+ +
+ + +
+
+
+
+
+ +
+ + +
+ +
+ +
+
+

Line Chart

+ +
+ + +
+
+
+
+
+ +
+ + + +
+
+

Bar Chart

+ +
+ + +
+
+
+
+
+ +
+ + +
+ +
+ + +
+ +{% 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 = [ + ]