Warning should be considered and should be made resonable decision.
-
In academic app model's has
ForeignKey(settings.AUTH_USER_MODEL)
. But it should (may be) beOneToOneField(settings.AUTH_USER_MODEL)
. -
Running migrations: D:\Dev\cseai_env\lib\site-packages\django\db\models\fields__init__.py:1421: RuntimeWarning: DateTimeField User.validity received a naive datetime (2019-10-16 10:15:38.094172) while time zone support is active. RuntimeWarning) Applying account.0004_auto_20191016_0414... OK
- django.core.exceptions.FieldError: 'validity' cannot be specified for User model form as it is a non-editable field
Fix:
Previous:
validity = models.DateTimeField(
auto_now=False, auto_now_add=True) # need customization
Fixed:
validity = models.DateTimeField(
auto_now=False, auto_now_add=False) # need customization
It is the step by step implementation activity.
django-admin startproject core
python manage.py startapp account
python manage.py makemigrations
python manage.py migrate
In academic app several model-class can have, i.e. department, faculty, program, institute etc.
We want to create three model-class in this academic app:
faculty
: It is the university faculty.department
: It is the university department.program
: It is the university academic program.
First create academic app
python manage.py startapp academic
Then create three models and make a migration on academic app
python manage.py makemigrations academic
python manage.py migrate academic
There are six type of member in CLIC and each member type is a model-class in member
app.
These six member types are:
- Student
- Teacher
- Officer
- Staff
- Othermember
- Librarian
First create member
app:
python manage.py startapp member
Then create various model-class and make migration.
python manage.py makemigrations member
python manage.py migrate member
There are money type of resource, like book, digital document, publication etc. We want create two model-class.
- Author
- Book
- Resource
python manage.py startapp resource
Then create model-class and migrate
python manage.py makemigrations resource
python manage.py migrate resource
There are two type of transaction currently in CLIC.
- TrxBook
- TrxResource
Firstly create transaction
app and then add model-class.
python manage.py startapp transaction
Then make migrations for transaction
python manage.py makemigrations transaction
python manage.py migrate transaction
In service
app can have many type of model-class. Currently have:
- Request
- Report
- Notice
Firstly create service
app and then add model-class.
python manage.py startapp service
Then make a migration:
python manage.py makemigrations service
python manage.py migrate service
Activity Monitoring and Threat Detection
( AMTD ) is for monitoring all transaction and user activity and threat dectection.
In this amtd
App currently have one model-class:
- Activity
Firstly create amtd
app and then add model-class.
python manage.py startapp amtd
Then make a migration:
python manage.py makemigrations amtd
python manage.py migrate amtd
In this post
App currently have one model-class:
- Post
Firstly create post
app and then add model-class.
python manage.py startapp post
Then make a migration:
python manage.py makemigrations post
python manage.py migrate post
In this comment
App currently have one model-class:
- Comment
Firstly create comment
app and then add model-class.
python manage.py startapp comment
Then make a migration:
python manage.py makemigrations comment
python manage.py migrate comment
In this messenger
App currently have one model-class:
- Message
Firstly create messenger
app and then add model-class.
python manage.py startapp messenger
Then make a migration:
python manage.py makemigrations messenger
python manage.py migrate messenger
django-notifications-hq is a GitHub notification alike app for Django.
Installation is easy using pip
and will install all required libraries.
$ pip install django-notifications-hq
The app should go somewhere after all the apps that are going to be generating notifications like django.contrib.auth
INSTALLED_APPS = (
'django.contrib.auth',
...
'notifications',
...
)
Add the notifications urls to your urlconf:
import notifications.urls
urlpatterns = [
...
path('inbox/notifications/', include(notifications.urls, namespace='notifications')),
...
]
To run schema migration, execute:
python manage.py migrate notifications
In this wishlist
App currently have two model-class:
- bookCart
- resourceCart
Firstly create wishlist
app and then add model-class.
python manage.py startapp wishlist
Then make a migration:
python manage.py makemigrations wishlist
python manage.py migrate wishlist
python
# python version required 3.6 ...i.e. 3.6.8
pip install virtualenv
environment
virtualenv clicpustenv
clone repository
git clone https://github.com/belal-bh/CLIC_PUST.git
activate env
# cmd
clicpustenv\Scripts\activate
# or in git-bash
source clicpustenv\Scripts\activate
installation
cd CLIC_PUST
pip install -r requirements.txt
Then create or copy directories and files for media_cdn
and static_cdn
:
Or copy from copyUpdir
to one lebel upper directory that means => CLIC_PUST/
media_cdn
----account
--------user
------------image
----------------default.png
----comment
--------image
----post
--------image
--------post
------------image
----resource
--------book
------------default.png
--------resource
------------default.png
static_cdn
Check Database and settings:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'clicpust-v0-0', # change if needed
'USER': 'dbuser', # change if needed
'PASSWORD': 'dbpassword',# change if needed
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
Then make migrations and migrate:
cd src
python manage.py makemigrations
python manage.py migrate
Run development server:
python manage.py runserver