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

Cập nhật dữ liệu hành chính đúng chuẩn #150

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a9dbc0d
Add NewTinh Model
vu-luong Oct 27, 2020
a11bf71
Add new models for Huyen and Xa, change longitude/latitude name and type
dungpt3003 Oct 27, 2020
6b67c7a
Add scripts to import tinh, huyen, xa data from files
dungpt3003 Oct 27, 2020
db2a905
Return new location data in API
dungpt3003 Oct 27, 2020
926a82b
Change old location models to new ones
dungpt3003 Oct 27, 2020
78c498e
Resolve conflicts
dungpt3003 Oct 30, 2020
e20ac70
Add migration to migrate old tinh data (csv file needed)
dungpt3003 Oct 31, 2020
35e18b7
Add migration to migrate old huyen data
dungpt3003 Oct 31, 2020
fc1f55f
Change verbose name of model NewTinh
dungpt3003 Oct 31, 2020
2a45c42
Add migration to migrate xa data
dungpt3003 Oct 31, 2020
80343a2
Rename template name to match new model name
dungpt3003 Oct 31, 2020
adcc3c4
Merge branch 'develop' of github.com:Cuuhomientrung/cuuhomientrung in…
dungpt3003 Oct 31, 2020
38a8c87
Merge migrations
dungpt3003 Oct 31, 2020
57a93cf
Add data files for location update
dungpt3003 Oct 31, 2020
ab074f5
Fix absolute part of data directory
dungpt3003 Oct 31, 2020
b22bbb9
Merge branch 'develop' of github.com:Cuuhomientrung/cuuhomientrung in…
dungpt3003 Oct 31, 2020
4b47592
Move foreign key migration to last
dungpt3003 Oct 31, 2020
1c2ecc0
Rearrange migrations
dungpt3003 Oct 31, 2020
1bb0ab8
Merge branch 'develop' of github.com:Cuuhomientrung/cuuhomientrung in…
dungpt3003 Oct 31, 2020
2630631
Fix absolute path in migration files
dungpt3003 Oct 31, 2020
8073b16
Fix missing library import in migration 79
dungpt3003 Oct 31, 2020
41e0ade
Fix wrong flag value in migration 79
dungpt3003 Nov 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions project/app/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from rest_framework import routers

from app.settings import TIME_ZONE
from app.models import TinTuc, TinhNguyenVien, CuuHo, HoDan, Tinh, Huyen, Xa,\
from app.models import TinTuc, TinhNguyenVien, CuuHo, HoDan, NewTinh, NewHuyen, NewXa,\
TrangThaiHoDan, CUUHO_STATUS, TINHNGUYEN_STATUS
from app.views import CuuHoViewSet, HoDanViewSet,\
TinhNguyenVienViewSet, TinhViewSet, HuyenViewSet, XaViewSet, TrangThaiHoDanSet
Expand Down Expand Up @@ -104,24 +104,24 @@ def __init__(self, *args, **kwargs):
attrs={'style': 'min-width:250px', 'data-minimum-input-length': 0}
), required=False)

self.fields["tinh"] = ModelChoiceField(queryset=Tinh.objects.order_by("name"),
self.fields["tinh"] = ModelChoiceField(queryset=NewTinh.objects.order_by("name"),
widget=ModelSelect2Widget(
model=Tinh,
model=NewTinh,
search_fields=['name__unaccent__icontains'],
attrs={'style': 'min-width:250px', 'data-minimum-input-length': 0}
), required=False)

self.fields["huyen"] = ModelChoiceField(queryset=Huyen.objects.order_by("name"),
self.fields["huyen"] = ModelChoiceField(queryset=NewHuyen.objects.order_by("name"),
widget=ModelSelect2Widget(
model=Huyen,
model=NewHuyen,
search_fields=['name__unaccent__icontains'],
dependent_fields={'tinh': 'tinh'},
attrs={'style': 'min-width:250px', 'data-minimum-input-length': 0}
), required=False)

self.fields["xa"] = ModelChoiceField(queryset=Xa.objects.order_by("name"),
self.fields["xa"] = ModelChoiceField(queryset=NewXa.objects.order_by("name"),
widget=ModelSelect2Widget(
model=Xa,
model=NewXa,
search_fields=['name__unaccent__icontains'],
dependent_fields={'huyen': 'huyen'},
attrs={'style': 'min-width:250px', 'data-minimum-input-length': 0}
Expand Down Expand Up @@ -211,24 +211,24 @@ class Meta:

def __init__(self, *args, **kwargs):
super(HoDanForm, self).__init__(*args, **kwargs)
self.fields["tinh"] = ModelChoiceField(queryset=Tinh.objects.order_by("name"),
self.fields["tinh"] = ModelChoiceField(queryset=NewTinh.objects.order_by("name"),
widget=ModelSelect2Widget(
model=Tinh,
model=NewTinh,
search_fields=['name__unaccent__icontains'],
attrs={'style': 'min-width:250px', 'data-minimum-input-length': 0}
), required=False)

self.fields["huyen"] = ModelChoiceField(queryset=Huyen.objects.order_by("name"),
self.fields["huyen"] = ModelChoiceField(queryset=NewHuyen.objects.order_by("name"),
widget=ModelSelect2Widget(
model=Huyen,
model=NewHuyen,
search_fields=['name__unaccent__icontains'],
dependent_fields={'tinh': 'tinh'},
attrs={'style': 'min-width:250px', 'data-minimum-input-length': 0}
), required=False)

self.fields["xa"] = ModelChoiceField(queryset=Xa.objects.order_by("name"),
self.fields["xa"] = ModelChoiceField(queryset=NewXa.objects.order_by("name"),
widget=ModelSelect2Widget(
model=Xa,
model=NewXa,
search_fields=['name__unaccent__icontains'],
dependent_fields={'huyen': 'huyen'},
attrs={'style': 'min-width:250px', 'data-minimum-input-length': 0}
Expand Down Expand Up @@ -458,9 +458,9 @@ def __init__(self, model, admin_site):
admin.site.register(CuuHo, CuuHoAdmin)
admin.site.register(TinhNguyenVien, TinhNguyenVienAdmin)

admin.site.register(Tinh, TinhAdmin)
admin.site.register(Huyen, HuyenAdmin)
admin.site.register(Xa, XaAdmin)
admin.site.register(NewTinh, TinhAdmin)
admin.site.register(NewHuyen, HuyenAdmin)
admin.site.register(NewXa, XaAdmin)
admin.site.register(TrangThaiHoDan, TrangThaiHoDanAdmin)
# admin.site.register(Thon, ThonAdmin)

Expand Down
Loading