Case Study
Project Case Study
Challenges, solutions, outcomes, technical highlights, architecture, and project scale.
⚡
Challenges
- Need for file selling system with secure upload and zip file protection
- Managing online classes and downloadable files simultaneously in a unified cart
- Automatic calculation of professors' share from file sales and class registrations
- Need for accounting system and settlement requests with minimum amount
- Managing class capacity and preventing over-registration
- Ticketing support system with response and follow-up capability
- Zarinpal payment gateway integration
- Access level management (user, professor, admin) and special article access
💡
Solutions
- Designing Product, Classes, and Article models for content management
- Implementing unified shopping cart system with Cart and Class_student models
- Automatic calculation of professors' share with configurable percentage (professor_class_percent, professor_product_percent)
- Using Zarinpal payment gateway for secure transactions
- Designing accounting system with Accounting model and settlement request capability
- Implementing support system with Support_table model and response capability
- Using sorl-thumbnail for image optimization
- Using jdatetime and persiantools for Jalali date conversion
- SMS authentication system via Ghasedak API
- Using pymysql for MySQL connection
📚
Outcomes
- Complete educational platform with file sales and class hosting
- Secure payment system with Zarinpal gateway
- Automatic accounting system for professors
- Professional ticketing support system
- Access level management and special articles
- Full Jalali calendar support
- Responsive and user-friendly design
- Telegram bot integration
🔧
Technical Highlights
- Django 4.2.6 and Python 3
- MySQL database with pymysql
- Zarinpal payment gateway
- SMS-based authentication with Ghasedak API
- Jalali date conversion with persiantools and jdatetime
- Image optimization with sorl-thumbnail and python-resize-image
- Extensive AJAX system with JSON
- Multi-App design (shop_account, shop_profile, zarinpal)
- Access level management (user, professor, admin)
- Telegram bot with django-telegrambot and Pyrogram
- Excel file generation with xlwt
- Accounting and settlement system with automatic professor share calculation
- Discount system with class and file discount codes
🏗️
Architecture
Fileshop is built on Django's MVT (Model-View-Template) architecture and consists of three main applications:
1. shop_account: Responsible for user management, authentication, and registration
- Custom User model with education, property, group_of_user, mobile fields
- Social media and banking information
- SMS and password login system
- Professor share percentages (professor_class_percent, professor_product_percent)
2. shop_profile: Responsible for content and transaction management
- Product model for educational files
- Classes model for online classes
- Article model for articles
- Cart and Class_student models for shopping cart
- Accounting model for accounting
- Support_table model for support
- News_table model for announcements
3. zarinpal: Responsible for online payment
- Zarinpal payment gateway integration
The project runs in DEBUG mode and uses SQLite for development and MySQL for production.
📐
Project Scale
- 3 main applications (shop_account, shop_profile, zarinpal)
- More than 15 data models
- 3 main content types (file, class, article)
- 3 access levels (user, professor, admin)
- More than 30 pages and HTML templates
- More than 40 views and endpoints
- Complete payment system with Zarinpal
- Accounting and settlement system
- Ticketing support system
- Announcement system
- Telegram bot
- Discount system