Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[django2] Many corrections. Consider evaluating this pull request! #617

Open
wants to merge 240 commits into
base: django2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
240 commits
Select commit Hold shift + click to select a range
6d9f519
fiexd quick-form file upload bug #47
Aug 2, 2016
540befb
Correcting error generated in converting 'nav_menu' to json when DEBU…
alexsilva Oct 10, 2016
c600a09
Fixing user access model (get_user_model).
alexsilva Oct 10, 2016
27dc671
Removing import duplicate.
alexsilva Oct 10, 2016
609d2af
Merge remote-tracking branch 'upstream/master'
alexsilva Dec 12, 2016
8682b67
Correction in language menu (did not show the scroll bar which all la…
alexsilva Dec 12, 2016
4bad67c
Merge remote-tracking branch 'upstream/master'
alexsilva Jan 12, 2017
a8e8edd
Implemented inline editing support in plugin.
alexsilva Jan 12, 2017
26f7a61
Correction of strange behavior generated by the quick-form plugin (ev…
alexsilva Jan 13, 2017
0b5a7f6
Fixing multiple error message inserts.
alexsilva Jan 13, 2017
9cbd724
Updating attributes used by the quick-form plugin inside inlines.
alexsilva Jan 16, 2017
62be69a
Removing unused reference.
alexsilva Jan 17, 2017
c2cbb8e
Fixing more problems generated by the quick-form plugin
alexsilva Jan 17, 2017
7d9a140
Fixing the inlines API.
alexsilva Jan 17, 2017
be6f9af
Adding JS translation string that was missing to pt-BR.
alexsilva Jan 24, 2017
4700e3c
Merge remote-tracking branch 'upstream/master'
alexsilva Jan 24, 2017
c2077d2
Fixing installation error (open is py3 only).
alexsilva Jan 24, 2017
1cf7260
Implemented hook that lets you configure menus dynamically (hidden_mo…
alexsilva Jan 24, 2017
b1280c5
Fixing error messages from online table type.
alexsilva Jan 26, 2017
1449c84
Implemented csv support in unicode format.
alexsilva Feb 1, 2017
28e246a
Merge branch 'master' into master
alexsilva Feb 8, 2017
8040167
Merge remote-tracking branch 'upstream/bugfix/quickform_file_upload'
alexsilva Feb 10, 2017
54a0b86
Merge branch 'master' of github.com:alexsilva/django-xadmin
alexsilva Feb 10, 2017
a1564fb
Correcting the configuration of inline fields.
alexsilva Feb 13, 2017
a8a0006
Exporting content in the given configuration in (export_unicode_encod…
alexsilva Feb 23, 2017
80b8baa
Implanted method to unregister plugins (unregister_plugin - Useful to…
alexsilva Feb 23, 2017
78aaf88
Corrections to additions of new translations to pt-BR.
alexsilva May 3, 2017
55fb6b8
Merge remote-tracking branch 'upstream/master'
alexsilva May 3, 2017
f296bee
Merge branch 'master' into master
sshwsfc May 27, 2017
ffd50c8
Using python 2.7 compatibility functions.
alexsilva Oct 6, 2017
8c0d5a9
Fixing removal of inline tab objects.
alexsilva Oct 6, 2017
6d10d87
Fix on adding formsets that failed due to incorrect html parser.
alexsilva Oct 6, 2017
de0c786
merge upstream
alexsilva Oct 6, 2017
d45d95b
Correcting access to references (io)
alexsilva Oct 6, 2017
6545482
Fixing py2 compatibility bugs
alexsilva Oct 6, 2017
0c170b6
Fixing bug introduced by the importxport plugin.
alexsilva Oct 6, 2017
a89c17f
Synchronizing dependencies (pip / setup).
alexsilva Oct 6, 2017
ed65dce
Compatibility with py2 and py3.
alexsilva Oct 6, 2017
ec0ca00
Correction in the parser.
alexsilva Oct 6, 2017
c3e69ed
Correction in the parser 2 try.
alexsilva Oct 6, 2017
504afad
Improving translations.
alexsilva Jan 8, 2018
67ab9f1
Fix translation and compile.
alexsilva Jan 8, 2018
635b56b
Merge remote-tracking branch 'upstream/master'
alexsilva Jan 30, 2018
c686a2b
[upstream] remove duplicated entry.
alexsilva Jan 30, 2018
1d2b0cb
Best api that allows better customization of the plugin.
alexsilva Feb 1, 2018
515ee22
修复AdminSplitDateTime IndexError
Mar 16, 2018
697a658
Merge pull request #534 from Friday21/master
wgbbiao Mar 22, 2018
9ea3576
Update logged_out.html
styleolder Mar 27, 2018
5b4448d
Merge remote-tracking branch 'upstream/master'
geniofuturo Apr 24, 2018
f209bf6
Merge pull request #541 from styleolder/master
wgbbiao May 7, 2018
42491c8
Improvements in api to work with dynamically selected actions.
geniofuturo May 15, 2018
dadb99a
Removing unused code.
geniofuturo May 22, 2018
cb911c7
New translation
alexsilva Jul 3, 2018
9dddc4d
Add icon sotablelist; Change buttom theme.
alexsilva Jul 3, 2018
4e08412
Fix context.
alexsilva Jul 3, 2018
f3dab3f
Add support to custom columns.
alexsilva Jul 3, 2018
a872cbd
Fixing broken file upload layout.
alexsilva Jul 11, 2018
d0ff906
Merge remote-tracking branch 'upstream/master'
alexsilva Aug 7, 2018
cf03196
Fix inline fields setup.
alexsilva Aug 14, 2018
9b79d83
Fix html sintax.
alexsilva Aug 17, 2018
5c40c63
Merge remote-tracking branch 'upstream/django2' into django2
alexsilva Aug 20, 2018
ea0dc8a
Option to export files by email.
alexsilva Aug 20, 2018
bd433d9
Sending email asynchronously.
alexsilva Aug 20, 2018
bad6ee0
Refactoring on/off options.
alexsilva Aug 20, 2018
0c60ae8
Sending email with possibility inheritance.
alexsilva Aug 20, 2018
2e231f0
Sending host details.
alexsilva Aug 20, 2018
1026796
Fix django compat version (2.1 - 2.0.8 is bug).
alexsilva Aug 20, 2018
52bb98c
Correction in the export of selected items (when there is no selection).
alexsilva Aug 21, 2018
27985a7
Correction in the notice of unselected items.
alexsilva Aug 21, 2018
3c17612
Fix form export styles.
alexsilva Aug 21, 2018
4ae4d0a
Form role=form.
alexsilva Aug 21, 2018
64c2a08
Bug fix: Removing url data after warning.
alexsilva Aug 21, 2018
57bbedd
Setting required fields.
alexsilva Aug 21, 2018
f20b8a1
Fieldset as form-group.
alexsilva Aug 21, 2018
37540f1
Layout compatible with xadmin.
alexsilva Aug 22, 2018
d071251
Export all data considering filters.
alexsilva Aug 22, 2018
880c8ac
Optionally send results by email.
alexsilva Aug 22, 2018
c77c54a
[import-export] Updating translations pt_BR.
alexsilva Aug 22, 2018
9cf3515
[import-export] Fix some translations.
alexsilva Aug 22, 2018
f5a4844
[import-export] Fix email validation.
alexsilva Aug 22, 2018
324c878
[import-export] Update translations.
alexsilva Aug 22, 2018
5833fa4
Update Bootstrap v3.3.7
alexsilva Aug 22, 2018
5b0f5d9
Correction of checkbox alignment in form.
alexsilva Aug 22, 2018
3fe6b63
Fix html for checkbox.
alexsilva Aug 22, 2018
85d027d
Merge branch 'master' into django2
alexsilva Aug 22, 2018
daaba30
Merge fix.
alexsilva Aug 22, 2018
1f76b84
Giving the ability to disable the plugin selectize.
alexsilva Aug 27, 2018
74addaf
Correction in username when changing password.
alexsilva Aug 29, 2018
14364cd
Merge remote-tracking branch 'upstream/django2' into django2
alexsilva Oct 31, 2018
19b8ac3
Add tox CI config file.
alexsilva Oct 31, 2018
17e3cf1
tests: pep8
alexsilva Oct 31, 2018
5e25346
tests: fix templates path
alexsilva Oct 31, 2018
6790bd5
tests: Configuring django variants.
alexsilva Oct 31, 2018
38b84f1
tests: django.contrib.admin is required.
alexsilva Oct 31, 2018
02a7232
tests: Update urls
alexsilva Oct 31, 2018
cb84953
tests: with support coverage.
alexsilva Oct 31, 2018
d91085a
Tests: erase report.
alexsilva Nov 1, 2018
ea53bfc
解决xadmin主题无效的问题
xiaobao996 Nov 28, 2018
676f0a3
Adding variable XADMIN_I18N_JAVASCRIPT_PACKAGES
alexsilva Feb 26, 2019
291b63b
Merge pull request #642 from JieZhaoAllen/bootswatch-dev
wgbbiao Apr 3, 2019
d650b2d
Bug fix on using jquery select2 plugin with multiple input.
alexsilva Apr 26, 2019
2a3cdc1
Fix filter title.
alexsilva May 9, 2019
50e5778
change select2-container width to 600px.
alexsilva May 10, 2019
5734a71
reload with no cache.
alexsilva May 21, 2019
e86b0d6
Fix sortable page reload.
alexsilva May 21, 2019
3105500
Update jquery-ui-sorteable v1.12.1
alexsilva May 21, 2019
6a62d57
Update jquery-ui-effect v1.12.1
alexsilva May 21, 2019
446d52b
Reduze select2-container to 450px.
alexsilva May 21, 2019
d1c16b6
Changing the status of the button.
alexsilva May 21, 2019
318f1b6
change 'fa-circle-o' to 'fa-chevron-right'
alexsilva Jun 7, 2019
7003451
Change fields size.
alexsilva Jun 13, 2019
0ff09ab
Merge remote-tracking branch 'upstream/master'
alexsilva Jul 16, 2019
22aff1d
Fix language locale middleware check.
alexsilva Jul 16, 2019
9ce534e
Fix old api to django 1.11+
alexsilva Jul 17, 2019
559f627
Fix old api to django 1.11+ (get_all_field_names).
alexsilva Jul 24, 2019
ddbd634
Remove widget on lookup error.
alexsilva Jul 24, 2019
8cf5302
Merge branch 'master' into django2
alexsilva Aug 13, 2019
259ac7c
Remove invalid package.
alexsilva Aug 13, 2019
4fc30e9
Revert "解决xadmin主题无效的问题"
alexsilva Aug 13, 2019
0a41806
Fix inline set readonly fields.
alexsilva Aug 22, 2019
8800612
Fix django-formtools compat version.
alexsilva Aug 26, 2019
773c706
Optimize imports.
alexsilva Aug 26, 2019
6656dd2
Add 'requests' to requirements.
alexsilva Aug 26, 2019
ae14d4f
Add formset events.
alexsilva Sep 12, 2019
b3505f9
Optimization of '_create plugin' loading time.
alexsilva Jan 21, 2020
0f97f51
Optimization of 'get_plugins' loading time.
alexsilva Jan 21, 2020
8076806
Fix.
alexsilva Jan 22, 2020
73f5f16
Changing translations of the Log model (pt-br).
alexsilva Jan 28, 2020
0dd876a
Configuration for translations.
alexsilva Jan 28, 2020
d91885f
Giving the ability to disable the plugin selectize.
alexsilva Aug 27, 2018
150bd01
add quick_addbtn_fields_exclude option.
alexsilva May 28, 2020
02fe2ea
raw pattern.
alexsilva May 29, 2020
c6231fd
Better control over addbtn plugin.
alexsilva May 29, 2020
15a37d1
Fix block name.
alexsilva Aug 11, 2020
e67e7d0
v0.6.2
alexsilva Aug 11, 2020
465285c
Fix non-unique.
alexsilva Aug 11, 2020
2c15eaa
Add 'autocomplete=off' for date/time inputs.
alexsilva Aug 19, 2020
7d9fcae
export_filename as str.
alexsilva Aug 19, 2020
7ec5ac8
Move 'setCookie' to xadmin-main.
alexsilva Aug 19, 2020
5e98598
Merge remote-tracking branch 'origin/master' into django2
alexsilva Sep 16, 2020
9d3183c
Add select2 v4.0
alexsilva Sep 17, 2020
316a566
Update select2 static.
alexsilva Sep 17, 2020
73e30f8
Update select2 v4.0 vendor.
alexsilva Sep 17, 2020
94c1c7e
Update selectize==0.12.1
alexsilva Sep 17, 2020
c2fbbc4
Update selectize static vendor.
alexsilva Sep 17, 2020
f000e79
Add selectize deps.
alexsilva Sep 17, 2020
649d8e4
Update selectize vendors.
alexsilva Sep 17, 2020
7745051
Update datepicker==1.9.0
alexsilva Sep 17, 2020
7dec039
Update datepicker==1.9.0 static
alexsilva Sep 17, 2020
89e1ae8
Move datepicker locale.
alexsilva Sep 17, 2020
f3bed28
Update datepicker vendor.
alexsilva Sep 17, 2020
dd82b25
ignore venv.
alexsilva Sep 18, 2020
0e4060d
Fix renderer option to widgets.
alexsilva Sep 21, 2020
785da12
Fix 'datepicker'.
alexsilva Sep 21, 2020
d26ead4
Add migrações.
alexsilva Sep 21, 2020
498b4d8
Add gitignore.
alexsilva Sep 21, 2020
ef50cbf
Fix select2 production vendor.
alexsilva Sep 25, 2020
fceec43
update httplib2 to v0.18.1
alexsilva Oct 1, 2020
d2120e4
Optional export to email.
alexsilva Oct 16, 2020
9e43585
Export by email optional.
alexsilva Oct 19, 2020
aba2205
Allow custom template.
alexsilva Oct 19, 2020
3d6b382
Fix config.
alexsilva Oct 19, 2020
ea651ed
Updating 'build_attrs' method signature.
alexsilva Oct 26, 2020
62ee865
Updating 'build_attrs' method signature.
alexsilva Oct 26, 2020
840c0b1
Fix relfield plugin.
alexsilva Oct 26, 2020
9024c93
django2 is python3 only.
alexsilva Oct 26, 2020
4b6e7a3
Fix remote field model (rel.to)
alexsilva Oct 26, 2020
3df65cd
Missing 'RegistrationError' import.
alexsilva Oct 26, 2020
2d34409
Fix revision compare.
alexsilva Oct 26, 2020
bfbc31b
Fix remote field model.
alexsilva Oct 26, 2020
fc88f77
Rename xrange to range.
alexsilva Oct 26, 2020
e3d9510
Use str only.
alexsilva Oct 26, 2020
b1aed7d
Literal set.
alexsilva Oct 26, 2020
06b56a4
Updating method signature.
alexsilva Oct 26, 2020
31e8d2a
Fix 'statement seems to have no effect'.
alexsilva Oct 26, 2020
dc6078e
Fix 'local variable might be referenced before assigment'.
alexsilva Oct 26, 2020
e5789cb
compat python3 only.
alexsilva Oct 26, 2020
27e9f4c
Update username-field.
alexsilva Oct 26, 2020
af7cb27
pep8
alexsilva Oct 26, 2020
820fac0
enable support to 'django-contrib-comments'.
alexsilva Oct 26, 2020
6004b99
Add settings 'XADMIN_INCLUDE_PLUGINS'.
alexsilva Oct 26, 2020
6de3b23
Remove all compacts.
alexsilva Oct 26, 2020
9613378
QUERY TERMS is no more.
alexsilva Oct 26, 2020
b20d11d
Remove compat.
alexsilva Oct 26, 2020
0dd030e
Rename 'do_filte' to 'do_filter'.
alexsilva Oct 26, 2020
87411eb
Update language code.
alexsilva Oct 26, 2020
2f47334
Decode with correct encoding.
alexsilva Oct 26, 2020
4e92331
Fix USERNAME_FIELD.
alexsilva Oct 27, 2020
c1fa1eb
New migration.
alexsilva Oct 27, 2020
09d6de9
Optional 'comments'.
alexsilva Oct 27, 2020
b9c9c9d
Add LocaleMiddleware.
alexsilva Oct 27, 2020
37a55d4
Remove old 'MIDDLEWARE_CLASSES'.
alexsilva Oct 27, 2020
acc0d14
Add context processors.
alexsilva Oct 27, 2020
bd0de9b
Change language only.
alexsilva Oct 27, 2020
38007a6
Fix xversion history.
alexsilva Oct 27, 2020
a88cadb
Configure bookmark widget_title.
alexsilva Oct 27, 2020
5a0bac8
Remove unicode prefix.
alexsilva Oct 27, 2020
1b8d13a
Removing explicit inheritance with 'object'.
alexsilva Oct 27, 2020
656c314
Supporte wizard.
alexsilva Oct 28, 2020
ead3014
Update jquery v2.2.4
alexsilva Oct 29, 2020
31aa8f4
Fix password focus.
alexsilva Oct 29, 2020
0270435
Add class 'empty-form' to formset row.
alexsilva Oct 29, 2020
ebbbb52
pep8
alexsilva Nov 3, 2020
26f58ee
Correct close tag.
alexsilva Nov 3, 2020
670e183
add view block 'form_tag_attrs' to post forms.
alexsilva Nov 3, 2020
f49edb3
Remove django-contrib-comments from requirments.
alexsilva Nov 3, 2020
bc102bb
pep8
alexsilva Nov 9, 2020
52e6535
Correction for delete action (model) with inheritance.
alexsilva Nov 9, 2020
7e69534
Merge branch 'django2' of github.com:alexsilva/django-xadmin into dja…
alexsilva Nov 9, 2020
edb9a24
Add empty-form
alexsilva Nov 25, 2020
2c71308
Add $.urlParam.
alexsilva Nov 26, 2020
6b6bf36
Add changelist-table id.
alexsilva Dec 2, 2020
793ed74
Improvements in the title of related filters.
alexsilva Dec 4, 2020
dd4eb52
Suporte to declared fields.
alexsilva Dec 5, 2020
5553407
Rename f to field.
alexsilva Dec 5, 2020
df85512
Collect to declared_fields.
alexsilva Dec 5, 2020
5af7745
Support custom batch form and fix form declared fields.
alexsilva Dec 5, 2020
f06ad43
Verification of declared fields and existing fields.
alexsilva Dec 6, 2020
59c9b41
Overlap with declared fields.
alexsilva Dec 6, 2020
717068b
Custom fields validation.
alexsilva Dec 6, 2020
af6047b
Add cancel button.
alexsilva Dec 6, 2020
1554699
Bug fix: removal of fields declared but not existing in the post.
alexsilva Dec 8, 2020
b1bc1d0
ignore venv3.
alexsilva Dec 10, 2020
73e78fa
ignore db3.sqlite3
alexsilva Dec 10, 2020
3bde9f5
Convert Context to dict.
alexsilva Dec 16, 2020
db4cae8
Load plugins ordered.
alexsilva Dec 17, 2020
03cd1ef
Support form label.
geniofuturo Jan 21, 2021
e21cd23
pep8
geniofuturo Jan 22, 2021
45433b4
Fix ajax search.
geniofuturo Jan 25, 2021
af1191d
Import compat.
geniofuturo Jan 28, 2021
d6f54e9
pep8
geniofuturo Feb 1, 2021
4b08373
Transfer of the form object to DetailAdminUtil.
geniofuturo Feb 2, 2021
51692aa
Add option 'batch_fields_exclude'.
geniofuturo Feb 8, 2021
9704026
Check field declared exists before delete.
geniofuturo Feb 8, 2021
778be60
Remove unused var.
geniofuturo Feb 8, 2021
6bf0cf9
Support custom media filter.
geniofuturo Feb 8, 2021
f4b4708
Adjust popover-content.
geniofuturo Feb 8, 2021
9c1f515
Fix ie issue with default args.
geniofuturo Feb 10, 2021
624a29e
Priority to view blocks.
geniofuturo Feb 19, 2021
b9aa155
fix priority reference.
diogolor Feb 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# C extensions
*.so

htmlcov

# Packages
*.egg
*.egg-info
Expand All @@ -17,6 +19,8 @@ develop-eggs
.installed.cfg
lib
lib64
venv
venv3

# Installer logs
pip-log.txt
Expand Down
2 changes: 2 additions & 0 deletions demo_app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
db.sqlite3
db3.sqlite3
26 changes: 13 additions & 13 deletions demo_app/app/adminx.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


@xadmin.sites.register(views.website.IndexView)
class MainDashboard(object):
class MainDashboard:
widgets = [
[
{"type": "html", "title": "Test Widget",
Expand All @@ -26,28 +26,28 @@ class MainDashboard(object):


@xadmin.sites.register(views.BaseAdminView)
class BaseSetting(object):
class BaseSetting:
enable_themes = True
use_bootswatch = True


@xadmin.sites.register(views.CommAdminView)
class GlobalSetting(object):
class GlobalSetting:
global_search_models = [Host, IDC]
global_models_icon = {
Host: "fa fa-laptop", IDC: "fa fa-cloud"
}
menu_style = 'default' # 'accordion'


class MaintainInline(object):
class MaintainInline:
model = MaintainLog
extra = 1
style = "accordion"


@xadmin.sites.register(IDC)
class IDCAdmin(object):
class IDCAdmin:
list_display = ("name", "description", "create_time", "contact", "telphone", "address", "customer_id")
list_display_links = ("name",)
wizard_form_list = [
Expand All @@ -70,7 +70,7 @@ class IDCAdmin(object):


@xadmin.sites.register(Host)
class HostAdmin(object):
class HostAdmin:

def open_web(self, instance):
return """<a href="http://%s" target="_blank">Open</a>""" % instance.ip
Expand Down Expand Up @@ -150,7 +150,7 @@ def open_web(self, instance):
reversion_enable = True

data_charts = {
"host_service_type_counts": {'title': u"Host service type count", "x-field": "service_type",
"host_service_type_counts": {'title': "Host service type count", "x-field": "service_type",
"y-field": ("service_type",),
"option": {
"series": {"bars": {"align": "center", "barWidth": 0.8, 'show': True}},
Expand All @@ -161,7 +161,7 @@ def open_web(self, instance):


@xadmin.sites.register(HostGroup)
class HostGroupAdmin(object):
class HostGroupAdmin:
list_display = ("name", "description")
list_display_links = ("name",)

Expand All @@ -171,7 +171,7 @@ class HostGroupAdmin(object):


@xadmin.sites.register(MaintainLog)
class MaintainLogAdmin(object):
class MaintainLogAdmin:
list_display = (
"host", "maintain_type", "hard_type", "time", "operator", "note")
list_display_links = ("host",)
Expand Down Expand Up @@ -201,7 +201,7 @@ class MaintainLogAdmin(object):


@xadmin.sites.register(AccessRecord)
class AccessRecordAdmin(object):
class AccessRecordAdmin:

def avg_count(self, instance):
return int(instance.view_count / instance.user_count)
Expand All @@ -219,10 +219,10 @@ def avg_count(self, instance):

refresh_times = (3, 5, 10)
data_charts = {
"user_count": {'title': u"User Report", "x-field": "date", "y-field": ("user_count", "view_count"),
"user_count": {'title': "User Report", "x-field": "date", "y-field": ("user_count", "view_count"),
"order": ('date',)},
"avg_count": {'title': u"Avg Report", "x-field": "date", "y-field": ('avg_count',), "order": ('date',)},
"per_month": {'title': u"Monthly Users", "x-field": "_chart_month", "y-field": ("user_count",),
"avg_count": {'title': "Avg Report", "x-field": "date", "y-field": ('avg_count',), "order": ('date',)},
"per_month": {'title': "Monthly Users", "x-field": "_chart_month", "y-field": ("user_count",),
"option": {
"series": {"bars": {"align": "center", "barWidth": 0.8, 'show': True}},
"xaxis": {"aggregate": "sum", "mode": "categories"},
Expand Down
36 changes: 36 additions & 0 deletions demo_app/app/migrations/0004_auto_20190813_0916.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated by Django 2.2.4 on 2019-08-13 12:16

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
('app', '0003_host_administrator'),
]

operations = [
migrations.AlterField(
model_name='host',
name='administrator',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL,
verbose_name='Admin'),
),
migrations.AlterField(
model_name='host',
name='core_num',
field=models.SmallIntegerField(
choices=[(2, '2 Cores'), (4, '4 Cores'), (6, '6 Cores'), (8, '8 Cores'), (10, '10 Cores'),
(12, '12 Cores'), (14, '14 Cores'), (16, '16 Cores'), (18, '18 Cores'), (20, '20 Cores'),
(22, '22 Cores'), (24, '24 Cores'), (26, '26 Cores'), (28, '28 Cores')]),
),
migrations.AlterField(
model_name='host',
name='service_type',
field=models.CharField(
choices=[('moniter', 'Moniter'), ('lvs', 'LVS'), ('db', 'Database'), ('analysis', 'Analysis'),
('admin', 'Admin'), ('storge', 'Storge'), ('web', 'WEB'), ('email', 'Email'), ('mix', 'Mix')],
max_length=32),
),
]
20 changes: 20 additions & 0 deletions demo_app/app/migrations/0005_idc_is_valid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2019-09-05 13:57
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('app', '0004_auto_20190813_0916'),
]

operations = [
migrations.AddField(
model_name='idc',
name='is_valid',
field=models.BooleanField(default=False),
),
]
17 changes: 17 additions & 0 deletions demo_app/app/migrations/0006_remove_idc_is_valid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.16 on 2020-10-27 14:55

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('app', '0005_idc_is_valid'),
]

operations = [
migrations.RemoveField(
model_name='idc',
name='is_valid',
),
]
44 changes: 22 additions & 22 deletions demo_app/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')

SERVER_STATUS = (
(0, u"Normal"),
(1, u"Down"),
(2, u"No Connect"),
(3, u"Error"),
(0, "Normal"),
(1, "Down"),
(2, "No Connect"),
(3, "Error"),
)
SERVICE_TYPES = (
('moniter', u"Moniter"),
('lvs', u"LVS"),
('db', u"Database"),
('analysis', u"Analysis"),
('admin', u"Admin"),
('storge', u"Storge"),
('web', u"WEB"),
('email', u"Email"),
('mix', u"Mix"),
('moniter', "Moniter"),
('lvs', "LVS"),
('db', "Database"),
('analysis', "Analysis"),
('admin', "Admin"),
('storge', "Storge"),
('web', "WEB"),
('email', "Email"),
('mix', "Mix"),
)


Expand All @@ -41,32 +41,32 @@ def __str__(self):
return self.name

class Meta:
verbose_name = u"IDC"
verbose_name = "IDC"
verbose_name_plural = verbose_name


@python_2_unicode_compatible
class Host(models.Model):
idc = models.ForeignKey(IDC, on_delete=models.CASCADE)
name = models.CharField(max_length=64)
nagios_name = models.CharField(u"Nagios Host ID", max_length=64, blank=True, null=True)
nagios_name = models.CharField("Nagios Host ID", max_length=64, blank=True, null=True)
ip = models.GenericIPAddressField(blank=True, null=True)
internal_ip = models.GenericIPAddressField(blank=True, null=True)
user = models.CharField(max_length=64)
password = models.CharField(max_length=128)
ssh_port = models.IntegerField(blank=True, null=True)
status = models.SmallIntegerField(choices=SERVER_STATUS)

brand = models.CharField(max_length=64, choices=[(i, i) for i in (u"DELL", u"HP", u"Other")])
brand = models.CharField(max_length=64, choices=[(i, i) for i in ("DELL", "HP", "Other")])
model = models.CharField(max_length=64)
cpu = models.CharField(max_length=64)
core_num = models.SmallIntegerField(choices=[(i * 2, "%s Cores" % (i * 2)) for i in range(1, 15)])
hard_disk = models.IntegerField()
memory = models.IntegerField()

system = models.CharField(u"System OS", max_length=32, choices=[(i, i) for i in (u"CentOS", u"FreeBSD", u"Ubuntu")])
system = models.CharField("System OS", max_length=32, choices=[(i, i) for i in ("CentOS", "FreeBSD", "Ubuntu")])
system_version = models.CharField(max_length=32)
system_arch = models.CharField(max_length=32, choices=[(i, i) for i in (u"x86_64", u"i386")])
system_arch = models.CharField(max_length=32, choices=[(i, i) for i in ("x86_64", "i386")])

create_time = models.DateField()
guarantee_date = models.DateField()
Expand All @@ -79,7 +79,7 @@ def __str__(self):
return self.name

class Meta:
verbose_name = u"Host"
verbose_name = "Host"
verbose_name_plural = verbose_name


Expand All @@ -97,7 +97,7 @@ def __str__(self):
self.maintain_type, self.hard_type)

class Meta:
verbose_name = u"Maintain Log"
verbose_name = "Maintain Log"
verbose_name_plural = verbose_name


Expand All @@ -110,7 +110,7 @@ class HostGroup(models.Model):
Host, verbose_name=u'Hosts', blank=True, related_name='groups')

class Meta:
verbose_name = u"Host Group"
verbose_name = "Host Group"
verbose_name_plural = verbose_name

def __str__(self):
Expand All @@ -124,7 +124,7 @@ class AccessRecord(models.Model):
view_count = models.IntegerField()

class Meta:
verbose_name = u"Access Record"
verbose_name = "Access Record"
verbose_name_plural = verbose_name

def __str__(self):
Expand Down
15 changes: 12 additions & 3 deletions demo_app/demo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@
LANGUAGES = (
('en', _('English')),
('zh-hans', _('Chinese')),
('pt-br', _('Portuguese')),
)

ALLOWED_HOSTS = []
# SITE_ID = 1

# extra optional plugin
# XADMIN_INCLUDE_PLUGINS = ('comments',)

# Application definition

Expand All @@ -41,7 +45,8 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

# 'django.contrib.sites',
# 'django_comments',
'xadmin',
'crispy_forms',
'reversion',
Expand All @@ -57,6 +62,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware'
]

ROOT_URLCONF = 'demo.urls'
Expand All @@ -68,6 +74,10 @@
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
Expand All @@ -79,7 +89,6 @@

WSGI_APPLICATION = 'demo.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases

Expand Down Expand Up @@ -113,7 +122,7 @@
# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/

LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'en'

TIME_ZONE = 'UTC'

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
'setuptools',
'django>=2',
'django-crispy-forms>=1.6.0',
'django-import-export>=0.5.1',
'django-reversion>=2.0.0',
'django-formtools>=1.0',
'django-import-export>=0.5.1',
'httplib2==0.9.2',
'httplib2==0.18.1',
'future',
'six'
],
Expand Down
Loading