mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-22 12:31:07 -05:00
Implement wiki and parks plugin architecture: add initial app configurations, models, and update dependencies
This commit is contained in:
197
memory-bank/documentation/wiki_parks_plugin.md
Normal file
197
memory-bank/documentation/wiki_parks_plugin.md
Normal file
@@ -0,0 +1,197 @@
|
||||
# Parks Plugin for Django-Wiki
|
||||
|
||||
## Overview
|
||||
The Parks Plugin extends Django-Wiki to provide specialized functionality for theme park articles. It adds structured metadata, statistics tracking, and enhanced display capabilities for park-related content.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Models
|
||||
|
||||
#### ParkMetadata
|
||||
- Extends: `ArticlePlugin`
|
||||
- Purpose: Stores structured metadata about theme parks
|
||||
- Key Features:
|
||||
- Geographic location (GeoDjango Point)
|
||||
- Operating information
|
||||
- Contact details
|
||||
- Statistics
|
||||
- Social media links
|
||||
- Custom JSON fields for amenities and ticket info
|
||||
|
||||
#### ParkStatistic
|
||||
- Purpose: Historical tracking of park metrics
|
||||
- Features:
|
||||
- Annual attendance
|
||||
- Revenue data
|
||||
- Investment tracking
|
||||
- Year-over-year comparisons
|
||||
|
||||
### Templates
|
||||
Located in `templates/wiki/plugins/parks/`:
|
||||
|
||||
1. `park_metadata.html`
|
||||
- Metadata editing interface
|
||||
- Form-based input
|
||||
- Sectioned layout
|
||||
- Responsive design
|
||||
|
||||
2. `park_statistics.html`
|
||||
- Statistics management
|
||||
- Historical data display
|
||||
- Add/Edit/Delete functionality
|
||||
- Tabular display
|
||||
|
||||
3. `sidebar.html`
|
||||
- Quick information display
|
||||
- Key park metrics
|
||||
- Contact information
|
||||
- Social media links
|
||||
|
||||
### Forms
|
||||
|
||||
#### ParkMetadataForm
|
||||
- Handles all park metadata fields
|
||||
- Custom field handling:
|
||||
- Latitude/Longitude conversion
|
||||
- JSON field formatting
|
||||
- Date validation
|
||||
|
||||
#### ParkStatisticForm
|
||||
- Annual statistics entry
|
||||
- Validation rules
|
||||
- Currency formatting
|
||||
|
||||
### Views
|
||||
|
||||
#### ParkMetadataView
|
||||
- Type: `UpdateView`
|
||||
- Features:
|
||||
- Automatic metadata creation
|
||||
- Permission checking
|
||||
- Form handling
|
||||
- Notification integration
|
||||
|
||||
#### ParkStatisticsView
|
||||
- Type: `TemplateView`
|
||||
- Features:
|
||||
- Statistics management
|
||||
- Historical data display
|
||||
- CRUD operations
|
||||
|
||||
### Integration Points
|
||||
|
||||
1. Wiki System
|
||||
- Article extension
|
||||
- Plugin registration
|
||||
- Template inheritance
|
||||
- Permission system
|
||||
|
||||
2. Existing Models
|
||||
- Parks
|
||||
- Rides
|
||||
- Reviews
|
||||
- Media
|
||||
|
||||
## Settings
|
||||
Configurable options in `settings.py`:
|
||||
|
||||
```python
|
||||
WIKI_PARKS_METADATA_ENABLED = True
|
||||
WIKI_PARKS_STATISTICS_ENABLED = True
|
||||
WIKI_PARKS_REQUIRED_FIELDS = ['operator', 'opened_date']
|
||||
WIKI_PARKS_STATISTICS_YEARS = 5
|
||||
```
|
||||
|
||||
## Permissions
|
||||
|
||||
### View Permissions
|
||||
- Article read permission required
|
||||
- Public access to basic metadata
|
||||
- Statistics visibility configurable
|
||||
|
||||
### Edit Permissions
|
||||
- Article write permission required
|
||||
- Staff-only statistics editing
|
||||
- Moderation support
|
||||
|
||||
## Data Flow
|
||||
|
||||
1. Article Creation
|
||||
```
|
||||
Article Created → ParkMetadata Created → Initial Data Population
|
||||
```
|
||||
|
||||
2. Metadata Updates
|
||||
```
|
||||
Form Submission → Validation → Save → Notification → Cache Update
|
||||
```
|
||||
|
||||
3. Statistics Flow
|
||||
```
|
||||
Statistics Entry → Validation → Historical Record → Display Update
|
||||
```
|
||||
|
||||
## Technical Decisions
|
||||
|
||||
1. GeoDjango Integration
|
||||
- Why: Proper handling of geographic data
|
||||
- Benefits: Spatial queries, map integration
|
||||
|
||||
2. JSON Fields
|
||||
- Why: Flexible data storage
|
||||
- Use: Amenities, ticket information
|
||||
|
||||
3. Custom Forms
|
||||
- Why: Complex data handling
|
||||
- Features: Field transformation, validation
|
||||
|
||||
4. Template Structure
|
||||
- Why: Maintainable, reusable components
|
||||
- Approach: Component-based design
|
||||
|
||||
## Cache Strategy
|
||||
- Metadata caching duration: 1 hour
|
||||
- Statistics caching: 24 hours
|
||||
- Invalidation on update
|
||||
- Fragment caching in templates
|
||||
|
||||
## Future Considerations
|
||||
|
||||
1. Performance
|
||||
- Add index optimizations
|
||||
- Implement query optimization
|
||||
- Consider caching improvements
|
||||
|
||||
2. Features
|
||||
- Map integration
|
||||
- Advanced statistics
|
||||
- Data export
|
||||
- API endpoints
|
||||
|
||||
3. Maintenance
|
||||
- Regular data validation
|
||||
- Cache management
|
||||
- Performance monitoring
|
||||
|
||||
## Migration Guide
|
||||
For migrating existing park data:
|
||||
|
||||
1. Create wiki articles
|
||||
2. Populate metadata
|
||||
3. Import historical statistics
|
||||
4. Validate relationships
|
||||
5. Update references
|
||||
|
||||
## Testing
|
||||
|
||||
### Unit Tests Needed
|
||||
- Model validation
|
||||
- Form processing
|
||||
- Permission checks
|
||||
- View responses
|
||||
|
||||
### Integration Tests Needed
|
||||
- Wiki integration
|
||||
- Cache behavior
|
||||
- Template rendering
|
||||
- Data flow
|
||||
Reference in New Issue
Block a user