Lunch Service is a Django-based web application that allows users to manage restaurants and their menus. Users can sign up, log in, add restaurants, and vote for their favorite menus.
Check the demo here.
- Installation
- Usage
- Project Structure
- Features
-
Clone the repository:
git clone https://github.com/mhendy25/MindTales_Python_Assignment.git
-
Go to the project's directory:
cd MindTales_Python_Assignment -
Build and start the Docker containers:
docker-compose up --build
-
Apply the migrations:
docker-compose exec web python manage.py migrate -
Create a superuser:
docker-compose exec web python manage.py createsuperuser -
Create a superuser:
python manage.py createsuperuser
-
Signup, login, & continue using the app:
http://127.0.0.1:8000/singup/
- Open your web browser and navigate to
http://127.0.0.1:8000/. - Sign up for a new account or log in if you already have one.
- Add new restaurants and menus.
- To get the menu for users who didn't update the app to the latest version:
curl -X GET http://127.0.0.1:8000/1/menu/ -H "build-version:1.0"- To get the menu for users of the app's latest version:
curl -X GET http://127.0.0.1:8000/1/menu/ -H "build-version:2.0"- Vote for your favorite menus.
.gitignore # Git ignore file
lunch_service/
db.sqlite3 # SQLite database file
lunch_service/
__init__.py # Package initialization
__pycache__/ # Compiled Python files
asgi.py # ASGI configuration
middleware.py # Custom middleware
settings.py # Django settings
urls.py # URL routing
wsgi.py # WSGI configuration
manage.py # Django management script
requirements.txt # Project dependencies
restaurant/
__init__.py # Package initialization
__pycache__/ # Compiled Python files
admin.py # Admin configuration
apps.py # App configuration
forms.py # Form definitions
migrations/
__init__.py # Package initialization
__pycache__/ # Compiled Python files
0001_initial.py # Initial migration
0002_rename_rating_menu_voting.py # Rename rating to voting
0003_alter_menu_voting.py # Alter menu voting field
0004_customuser.py # Custom user model migration
0005_delete_customuser.py # Delete custom user model
models.py # Data models
templates/
restaurant/
add_menu.html # Template for adding a menu
index.html # Template for the index page
login.html # Template for the login page
menu.html # Template for displaying a general menu
menu1.html # Template for displaying menu1 for build 1.x
menu2.html # Template for displaying menu2 for build 2.x
results.html # Template for displaying results
signup.html # Template for the signup page
tests.py # Unit tests
urls.py # URL routing for the restaurant app
views.py # View functions
readme.md # Project documentation
- Sign Up
- URL:
/signup/ - Method:
POST - Form:
SignUpForm
- URL:
- Log In
- URL:
/login/ - Method:
POST - Form:
LoginForm
- URL:
- Add Restaurant
- URL:
/restaurant/ - Method:
POST - Form:
RestaurantForm
- URL:
- View Restaurants
- URL:
/restaurant/ - Method:
GET - Template:
restaurant/index.html
- URL:
- View Menu
- URL:
/{restaurant_id}/menu/ - Method:
GET - Template:
restaurant/menu.html
- URL:
- View Menu with Build Version 1.x
- URL:
{restaurant_id}/menu1/ - Method:
GET - Template:
restaurant/menu1.html
- URL:
- View Menu with Build Version 2.x
- URL:
/{restaurant_id}/menu2/ - Method:
GET - Template:
restaurant/menu2.html
- URL:
- Vote for Menu
- URL:
/vote/{menu_id}/ - Method:
POST
- URL:
- View Top Voted Menus
- URL:
/top-menus/ - Method:
GET - Template:
restaurant/results.html
- URL:
- Name:
name(CharField, max_length=255) - Location:
location(CharField, max_length=255) - Phone Number:
phone_number(CharField, max_length=255)
- Restaurant:
restaurantForeignKey to Restaurant - Name:
nameCharField, max_length=255 - Western Cuisine:
western_cuisinemodels.JSONField(default=dict) - Arab Cuisine:
arab_cuisinemodels.JSONField(default=dict) - Vegeterian Cuisine:
Vegeterian_cuisinemodels.JSONField(default=dict) - Date:
datemodels.DateField() - Voting:
voting(IntegerField)
To run the tests, you can use the following command:
python manage.py test restaurant- User authentication (sign up, log in)
- Add and manage restaurants
- Add and manage menus
- View menus based on build version
- Vote for menus
- View top voted menus