A Django-based application for managing and storing property information using Django admin. This project allows for efficient handling of property details, including images, locations, policies and amenities
- Property Management: Store and manage detailed property information.
- Django Admin Interface: Customized admin panel for easy CRUD operations.
- Backend: Python, Django
- Database: PostgreSQL
- ORM: Django ORM
- Containerization: Docker
- Web-Based Database Management: pgAdmin
Ensure you have the following installed:
- Python 3.x
- PostgreSQL
- Docker
- Git
-
Clone the repository:
git clone https://github.com/aa-nadim/inventory-management.git cd inventory-management
-
Set up a virtual environment:
python3 -m venv .venv source .venv/bin/activate # On Windows use `source .venv/bin/activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Create a
config.py
file in the inventory-management root directory and add your PostgreSQL credentials:# config.py DB_USERNAME = 'your_username' DB_PASSWORD = 'your_password' DB_HOST = 'localhost' DB_PORT = 'port' DJANGO_DBNAME = 'django_project_database_name' SECRET_KEY = 'your SECRET_KEY'
-
Create a
.env
file in the inventory-management root directory and add your PostgreSQL credentials:DB_USERNAME=your_username DB_PASSWORD=your_password DB_HOST=localhost DB_PORT=port DJANGO_DBNAME=django_project_database_name SECRET_KEY=your_SECRET_KEY
-
Ensure PostgreSQL is running
-
start docker
docker-compose up --build -d
-
Apply migrations:
docker exec -it inventoryManagement python manage.py makemigrations docker exec -it inventoryManagement python manage.py migrate
-
Create a superuser:
docker exec -it inventoryManagement python manage.py createsuperuser
-
http://localhost:8000
-
http://localhost:8000/signup/
-- successful signup -->http://localhost:8000/signup/success/
. If the admin permite theActive
andStaff status
of the user then the user can login into the admin pannel. -
when a user sings up, he/she will automaticaly
Property Owners
group will be assigned to the user. -
Initially
Property Owners
has no permmission for any activities. Admin has to assign the permission to theProperty Owners
group. -
Access the admin panel at
http://localhost:8000/admin/
and log in with your superuser credentials. -
To see database in pgadmin goto
http://localhost:5050
and useyour_username
=admin@admin.com
andyour_password
=admin123
to login. Then connect tolocalhost:5432
withyour_db_username
andyour_db_password
wherehost
=postgres_db
.
To generate a sitemap.json
file for all country locations.
docker exec -it inventoryManagement python manage.py generate_sitemap
[
"Free Wi-Fi",
"Air Conditioning",
"Swimming Pool",
"Pet-Friendly",
"Room Service",
"Gym Access"
]
{
"pet_policy": {
"en": "Pets are not allowed.",
"ar": "لا يُسمح بالحيوانات الأليفة."
},
"smoking_policy": {
"en": "Smoking is prohibited indoors.",
"ar": "التدخين ممنوع داخل المبنى."
}
}
docker exec -it inventoryManagement pytest --cov=properties --cov-report=term-missing
docker exec -it inventoryManagement pytest --cov=properties --cov-report=html:coverage_report
Open the coverage_report/index.html
file in a web browser to view the detailed coverage report.