Skip to content

Commit

Permalink
Part 26
Browse files Browse the repository at this point in the history
  • Loading branch information
zeliangyao committed Aug 27, 2021
1 parent fd22220 commit 6e74399
Show file tree
Hide file tree
Showing 77 changed files with 7,835 additions and 7 deletions.
6 changes: 3 additions & 3 deletions book/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
from django.views.decorators.csrf import csrf_exempt
from .forms import BookCreateEditForm,PubCreateEditForm,MemberCreateEditForm,ProfileForm,BorrowRecordCreateForm

from .utils import get_n_days_ago,create_clean_dir,change_col_format
# from .utils import get_n_days_ago,create_clean_dir,change_col_format
from util.useful import get_n_days_ago,create_clean_dir,change_col_format
from .groups_permissions import check_user_group,user_groups,check_superuser,SuperUserRequiredMixin
from .custom_filter import get_item
from datetime import date,timedelta,datetime
Expand Down Expand Up @@ -813,13 +814,12 @@ def get(self, request, *args, **kwargs):


# Data center
@method_decorator(user_passes_test(lambda u: check_user_group(u,"download_data")), name='dispatch')
class DataCenterView(LoginRequiredMixin,TemplateView):
template_name = 'book/download_data.html'
login_url = 'login'


def get(self,request,*args, **kwargs):
check_user_group(request.user,"download_data")
data = {m.objects.model._meta.db_table:
{"source":pd.DataFrame(list(m.objects.all().values())) ,
"path":f"{str(settings.BASE_DIR)}/datacenter/{m.__name__}_{TODAY}.csv",
Expand Down
1 change: 1 addition & 0 deletions core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
'rest_framework',
'ckeditor',
'comment',
'mptt',
]

CRISPY_ALLOWED_TEMPLATE_PACKS = "tailwind"
Expand Down
13 changes: 13 additions & 0 deletions datacenter/Category_20210827.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
id,name,created_at
2,Economics,2021-07-31 18:19:30.473140+00:00
3,Finance,2021-07-31 18:19:43.229982+00:00
4,Historical,2021-07-31 18:19:49.221871+00:00
5,Fantasy,2021-07-31 18:19:56.916918+00:00
6,Cooking,2021-07-31 18:20:02.315268+00:00
7,Computers & Tech,2021-07-31 18:20:10.279309+00:00
8,Fiction,2021-07-31 18:20:17.988670+00:00
9,Watch,2021-07-31 18:20:31.205351+00:00
10,Detective and Mystery,2021-07-31 18:20:36.975123+00:00
11,Literary Fiction,2021-07-31 18:20:41.851775+00:00
12,Comic,2021-07-31 18:20:54.997368+00:00
20,Fashion,2021-08-09 17:29:13.408340+00:00
Binary file modified db.sqlite3
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pip
21 changes: 21 additions & 0 deletions env/Lib/site-packages/django_mptt-0.13.2.dist-info/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Django MPTT
-----------

Copyright (c) 2007, Jonathan Buchanan

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
141 changes: 141 additions & 0 deletions env/Lib/site-packages/django_mptt-0.13.2.dist-info/METADATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
Metadata-Version: 2.1
Name: django-mptt
Version: 0.13.2
Summary: Utilities for implementing Modified Preorder Tree Traversal with your Django Models and working with trees of Model instances.
Home-page: https://github.com/django-mptt/django-mptt/
Author: Craig de Stigter
Author-email: [email protected]
License: MIT-License
Platform: OS Independent
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 3.0
Classifier: Framework :: Django :: 3.1
Classifier: Framework :: Django :: 3.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Python: >=3.6
Description-Content-Type: text/x-rst
Requires-Dist: django-js-asset
Provides-Extra: tests
Requires-Dist: coverage ; extra == 'tests'
Requires-Dist: mock-django ; extra == 'tests'

==========================================
**This project is currently unmaintained**
==========================================

Alternatives to django-mptt include:

* `django-treebeard <https://pypi.org/project/django-treebeard/>`_ includes a MPTT
implementation (called nested set)
* Maybe you do not need MPTT, especially when using newer databases. See
`django-tree-queries <https://github.com/matthiask/django-tree-queries>`_ for an
implementation using recursive Common Table Expressions (CTE). See the
`announcement blog post <https://406.ch/writing/django-tree-queries/>`__.


===========
django-mptt
===========

Utilities for implementing Modified Preorder Tree Traversal with your
Django Models and working with trees of Model instances.

.. image:: https://secure.travis-ci.org/django-mptt/django-mptt.svg?branch=master
:alt: Build Status
:target: https://travis-ci.org/django-mptt/django-mptt

Project home: https://github.com/django-mptt/django-mptt/

Documentation: https://django-mptt.readthedocs.io/

Discussion group: https://groups.google.com/forum/#!forum/django-mptt-dev

What is Modified Preorder Tree Traversal?
=========================================

MPTT is a technique for storing hierarchical data in a database. The aim is to
make retrieval operations very efficient.

The trade-off for this efficiency is that performing inserts and moving
items around the tree is more involved, as there's some extra work
required to keep the tree structure in a good state at all times.

Here are a few articles about MPTT to whet your appetite and provide
details about how the technique itself works:

* `Trees in SQL`_
* `Storing Hierarchical Data in a Database`_
* `Managing Hierarchical Data in MySQL`_

.. _`Trees in SQL`: https://www.ibase.ru/files/articles/programming/dbmstrees/sqltrees.html
.. _`Storing Hierarchical Data in a Database`: https://www.sitepoint.com/hierarchical-data-database/
.. _`Managing Hierarchical Data in MySQL`: http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/

What is ``django-mptt``?
========================

``django-mptt`` is a reusable Django app which aims to make it easy for you
to use MPTT with your own Django models.

It takes care of the details of managing a database table as a tree
structure and provides tools for working with trees of model instances.

Requirements
------------

* Python 3.6+
* A supported version of Django (currently 2.2+)

Feature overview
----------------

* Simple registration of models - fields required for tree structure will be
added automatically.

* The tree structure is automatically updated when you create or delete
model instances, or change an instance's parent.

* Each level of the tree is automatically sorted by a field (or fields) of your
choice.

* New model methods are added to each registered model for:

* changing position in the tree
* retrieving ancestors, siblings, descendants
* counting descendants
* other tree-related operations

* A ``TreeManager`` manager is added to all registered models. This provides
methods to:

* move nodes around a tree, or into a different tree
* insert a node anywhere in a tree
* rebuild the MPTT fields for the tree (useful when you do bulk updates
outside of django)

* `Form fields`_ for tree models.

* `Utility functions`_ for tree models.

* `Template tags and filters`_ for rendering trees.

* `Admin classes`_ for visualizing and modifying trees in Django's administration
interface.

.. _`Form fields`: https://django-mptt.readthedocs.io/en/latest/forms.html
.. _`Utility functions`: https://django-mptt.readthedocs.io/en/latest/utilities.html
.. _`Template tags and filters`: https://django-mptt.readthedocs.io/en/latest/templates.html
.. _`Admin classes`: https://django-mptt.readthedocs.io/en/latest/admin.html


86 changes: 86 additions & 0 deletions env/Lib/site-packages/django_mptt-0.13.2.dist-info/RECORD
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
django_mptt-0.13.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
django_mptt-0.13.2.dist-info/LICENSE,sha256=62buPd8x_Ju5NBnzPKjdYzm8OJPs5ulZ7kWf5Y9OeJQ,1087
django_mptt-0.13.2.dist-info/METADATA,sha256=kcfNHz2PAMjApBV-7JW1CNeJ_GmXGtpNIeiiwS-31UY,5120
django_mptt-0.13.2.dist-info/RECORD,,
django_mptt-0.13.2.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
django_mptt-0.13.2.dist-info/top_level.txt,sha256=-Lvswb-wzFbnIWo2guYCC0TRJRJdg5RUciJLhwSJjBM,5
mptt/__init__.py,sha256=6XL5zvNTYV35igQKIWzwDTuClHFT2bpXcyYmA1CKAbo,639
mptt/__pycache__/__init__.cpython-38.pyc,,
mptt/__pycache__/admin.cpython-38.pyc,,
mptt/__pycache__/apps.cpython-38.pyc,,
mptt/__pycache__/compat.cpython-38.pyc,,
mptt/__pycache__/exceptions.cpython-38.pyc,,
mptt/__pycache__/fields.cpython-38.pyc,,
mptt/__pycache__/forms.cpython-38.pyc,,
mptt/__pycache__/managers.cpython-38.pyc,,
mptt/__pycache__/models.cpython-38.pyc,,
mptt/__pycache__/querysets.cpython-38.pyc,,
mptt/__pycache__/settings.cpython-38.pyc,,
mptt/__pycache__/signals.cpython-38.pyc,,
mptt/__pycache__/utils.cpython-38.pyc,,
mptt/admin.py,sha256=1e9pMd8NBTll-AOjOOV38AvaIn_t-C89gYB_miFgSfE,15768
mptt/apps.py,sha256=NkhNH3zKVgah1VvKNYCLyYt2laG_BmcH9qNBQxlrfJE,167
mptt/compat.py,sha256=MSwxDJS4EQd-oyMF66jV2tlaojhpNNSHYOedYSPNAsc,413
mptt/exceptions.py,sha256=8qSMeYOZE9vHZPwrSpIrFfcHTXK4_Pxb5xLPkshKqWk,393
mptt/fields.py,sha256=QW-MAmdjUhyr8gknoZrvJkonlOcErgTzQmvnJDh5N8M,1100
mptt/forms.py,sha256=TzjxANWCTqAevZ1yh7juCGOGamm9JL5cbC_U-eR5h_U,7232
mptt/locale/da/LC_MESSAGES/django.mo,sha256=zS6fjsV9QnL75xSrZ8xMM3vW-mr8WO5m5RtzhczQ7yw,3013
mptt/locale/da/LC_MESSAGES/django.po,sha256=jE4eVQXHtcYHqJA-CiW-izx3333A7--t4f0btIy4wcM,4120
mptt/locale/de/LC_MESSAGES/django.mo,sha256=fUiA05aKzBV0pST50WfsAk6HzjmE8f-RFnrXdmknwaA,4514
mptt/locale/de/LC_MESSAGES/django.po,sha256=-3yKeb3CBpG7pUPicAdxb2Y03PpoQpdP-jdKSzQL6sA,5996
mptt/locale/es/LC_MESSAGES/django.mo,sha256=gzD26nZdb9xPo9HvvIEIlyCSv86bP7qv4NAblhSQSg4,4331
mptt/locale/es/LC_MESSAGES/django.po,sha256=ryuqUnu1fez-Ws1KEDUrVGhUgFlAyIO8si05PpXOwjE,6101
mptt/locale/es_AR/LC_MESSAGES/django.mo,sha256=aV68fy9i0OnhX-V1OifaJrVPTC7iy0ZAN2qSAZy6OtA,3001
mptt/locale/es_AR/LC_MESSAGES/django.po,sha256=hQA7lYRI9kfVFPYOdInVgREeOPkzY0rkDiljm8GK4Gw,3998
mptt/locale/fi/LC_MESSAGES/django.mo,sha256=LQ_nAOd0i3UD_fCPt6vxEOx_42vQHNKQWINrBEgFlxw,4355
mptt/locale/fi/LC_MESSAGES/django.po,sha256=y8FCt56H7K7rB4Mmz2Q4PKk5ZpAi6-lDEUwCAThRVKM,5857
mptt/locale/fr/LC_MESSAGES/django.mo,sha256=TPd9QY6fmHrhN6nxhlAKxDCsL4LTB3-4Q01D5LH4NoI,4633
mptt/locale/fr/LC_MESSAGES/django.po,sha256=57plMcthlhsPkhx9ydiGvBGnDlW8sPhlny2y2oJr0E4,6266
mptt/locale/hu/LC_MESSAGES/django.mo,sha256=rqC4Dn5pYDxfd7qasnPDPG0aDFRLygJLIF0r937d2gI,4507
mptt/locale/hu/LC_MESSAGES/django.po,sha256=rNkE4-V30qhSKBdFCjnfj657YyN3bqj62qq2SM4jzOQ,5799
mptt/locale/it/LC_MESSAGES/django.mo,sha256=oTYUE2TZKdam0bCgYNYE1PyYtEGqiThY8qL6GOZpPxs,4162
mptt/locale/it/LC_MESSAGES/django.po,sha256=s418oLTjzsSWVThpnXmMjFU5MuS7afVDeqT0eF0zfCE,5758
mptt/locale/mn/LC_MESSAGES/django.mo,sha256=HDOZQlOmhqXrmQpNUk4sASQHMwcBKpbHEA8s--TT8zc,3609
mptt/locale/mn/LC_MESSAGES/django.po,sha256=9HEx7dXNnx0oChc5hpgFjAdBmkCXXTZd7EtOjRNpUtY,4633
mptt/locale/nb/LC_MESSAGES/django.mo,sha256=lcFUmV1GmZl22sA3KUskgZJ7O36L2jk0B0H0AU4j_lY,3937
mptt/locale/nb/LC_MESSAGES/django.po,sha256=k0YOwZ2o3bfkzGfNVOLdFkDN7qnL1PcctoRb1BhCTTQ,5517
mptt/locale/pl/LC_MESSAGES/django.mo,sha256=cexPy1wquD6V8CgBKP_88dd4InIWU0BdcrPcMKL98T8,3840
mptt/locale/pl/LC_MESSAGES/django.po,sha256=SgvaP0cECiTyLrS9wP9d83P2WoRHdmDplXkqEy0AHB4,5154
mptt/locale/pt_BR/LC_MESSAGES/django.mo,sha256=rlXABG9Uw517x1z7vHkQ7jsEAg5Q6rGcIxmFFK9fu8Y,2955
mptt/locale/pt_BR/LC_MESSAGES/django.po,sha256=Eggru-cnidwz9_W43YyvASHqxMdfd-KlgO6H0ECsQXI,3988
mptt/locale/ru/LC_MESSAGES/django.mo,sha256=eAk0C8WQkuxWR3JcISYf5ZsNoURdODH0_2RmsgZzW9Q,5278
mptt/locale/ru/LC_MESSAGES/django.po,sha256=586HJiHcyT_raDTpcdrU0tBnBpd-5T6dt81JsLkA0tY,7169
mptt/locale/uk/LC_MESSAGES/django.mo,sha256=QdCdKURhQMEZRO7Dve6XzO7SeqEbBMxezRZCHQvnuBQ,5551
mptt/locale/uk/LC_MESSAGES/django.po,sha256=Hu1u3ND4FuClsR2xTiQZbRJGyfYF0x2Ecby02TVxx6s,6967
mptt/locale/zh_Hans/LC_MESSAGES/django.mo,sha256=9p4Phx9gbf2ouBW7nw5fcfyZcpnnFKV6qvfTDdqtm1g,3991
mptt/locale/zh_Hans/LC_MESSAGES/django.po,sha256=w255flRCsQRvNmFA_fO8pwFA564yOUVzmyzogh-lJBs,4354
mptt/locale/zh_Hant/LC_MESSAGES/django.mo,sha256=4LF_7aBze_8PIzHDWwnwC4Tmcbxugu1GZ76-NwtGNLo,4030
mptt/locale/zh_Hant/LC_MESSAGES/django.po,sha256=Nx-xySEePvs7cxg_EF7sAlhwV-6EmM2hFFX2dZ3BIYw,4404
mptt/managers.py,sha256=irL06x4M-tQUIXxd8J0Vlrjs-AjKO-W-XzM0WFq67Tc,49078
mptt/models.py,sha256=7B4uFu74NHqQtW0KyykR0z6ZmeYdX61GzGm3LV_MM1Q,44377
mptt/querysets.py,sha256=lfuEAmp77zeRcjgIlloGGDkOQ1vpZdR8lt6zPXsXcXk,1133
mptt/settings.py,sha256=LYs4DgNkAsX9I2jMYYcwrIwwDpZvnG6m52H6OVcAHSY,172
mptt/signals.py,sha256=316ulUHQjT6Zu36lFeNV3T8bO-gWftTspwHcJNv0GPc,300
mptt/static/mptt/arrow-move-black.png,sha256=DZsGK_1SxNesa8PPCdsYnt-JMIEXi4iZIR_69v-WJ_A,457
mptt/static/mptt/arrow-move-white.png,sha256=nRnBCAc3v29DeRy4UDWPoXaiKDm5LdnT0Hi2IZthUh8,740
mptt/static/mptt/arrow-move.png,sha256=DZsGK_1SxNesa8PPCdsYnt-JMIEXi4iZIR_69v-WJ_A,457
mptt/static/mptt/disclosure-down-black.png,sha256=oARKEVji9IiCtqR7qQ6SEFHGhjZgoQo1kIcNXnXsBzc,496
mptt/static/mptt/disclosure-down-white.png,sha256=ufwRR5DWChNOGrY3K7MZe7rWonmva07gw8VnnQp4Oiw,753
mptt/static/mptt/disclosure-down.png,sha256=oARKEVji9IiCtqR7qQ6SEFHGhjZgoQo1kIcNXnXsBzc,496
mptt/static/mptt/disclosure-right-black.png,sha256=4JG6_tPug64hl4PIS_Jdqxx8Eiu6I-_t2cKTOGfj0x4,464
mptt/static/mptt/disclosure-right-white.png,sha256=kP2SZ_dmYoUAm2XeixfeSMk1jGTzx-o7jX_tXYpu85c,711
mptt/static/mptt/disclosure-right.png,sha256=4JG6_tPug64hl4PIS_Jdqxx8Eiu6I-_t2cKTOGfj0x4,464
mptt/static/mptt/draggable-admin.css,sha256=I0Ag9HferR_QJc7QBxO70EPbiDNM-FPcsP0poBq8mVw,1358
mptt/static/mptt/draggable-admin.js,sha256=f2Iz50FCtC3mHEJ3ik_gROQsehlwYoly5_bf0-eOELU,14682
mptt/templates/admin/grappelli_mptt_change_list.html,sha256=XVeXViiLGAB7CN-8hqNL59T_qfXYjSvjANzy15VK6jw,248
mptt/templates/admin/grappelli_mptt_change_list_results.html,sha256=wa9bFhchpKNSKE26Oivf3AxRqkhwo3UNcG2nziaXnN8,1241
mptt/templates/admin/mptt_change_list.html,sha256=FDqfqXFnstrOkRAlNwS1KM9j4HfLoENL_VG_x5OixIo,350
mptt/templates/admin/mptt_change_list_results.html,sha256=58uRr5xt2ku3rRdn3SbzWWom147wDclq2OY8ogUnFwE,821
mptt/templates/admin/mptt_filter.html,sha256=sfkqcUxnnyBf7hqLKLNe3r_yQFXASK9Qne6ROvzMfF0,349
mptt/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
mptt/templatetags/__pycache__/__init__.cpython-38.pyc,,
mptt/templatetags/__pycache__/mptt_admin.cpython-38.pyc,,
mptt/templatetags/__pycache__/mptt_tags.cpython-38.pyc,,
mptt/templatetags/mptt_admin.py,sha256=aNpHBoes3lWspS-zvmARi2y_vt6fNxPn94CR-9_Zs4A,9064
mptt/templatetags/mptt_tags.py,sha256=KTVvnaFSPNDVRY1dlm5KdPXgDHYM4EFXAm73BQkK_lA,11087
mptt/utils.py,sha256=G_zYGi13Ms_Mlz_WU1G1lacs0qCCJaof2Q-QoLF1I-U,10717
5 changes: 5 additions & 0 deletions env/Lib/site-packages/django_mptt-0.13.2.dist-info/WHEEL
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.34.2)
Root-Is-Purelib: true
Tag: py3-none-any

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mptt
22 changes: 22 additions & 0 deletions env/Lib/site-packages/mptt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import django


__version__ = "0.13.2"
VERSION = tuple(__version__.split("."))

if django.VERSION < (3, 2): # pragma: no cover
default_app_config = "mptt.apps.MpttConfig"


def register(*args, **kwargs):
"""
Registers a model class as an MPTTModel, adding MPTT fields and adding MPTTModel to __bases__.
This is equivalent to just subclassing MPTTModel, but works for an already-created model.
"""
from mptt.models import MPTTModelBase

return MPTTModelBase.register(*args, **kwargs)


class AlreadyRegistered(Exception):
"Deprecated - don't use this anymore. It's never thrown, you don't need to catch it"
Loading

0 comments on commit 6e74399

Please sign in to comment.