Subtopics
Motivation: Subtopics are a key feature of Helix applications. They allow users to organize and categorize their content in a meaningful way. This leads to a more structured and navigable experience for users, making it easier to find the information they need.
How it Works:
- Hierarchical Structure: Subtopics are organized in a hierarchical structure, allowing for deep nesting of content.
- Customizable Names and Descriptions: Users can customize the names and descriptions of subtopics to suit their specific needs.
- Content Organization: Users can assign content to specific subtopics, creating logical groups of related information.
- Search and Navigation: Subtopics are integrated into the Helix search and navigation features, making it easy for users to find the content they need.
Options:
- Creating Subtopics: Users can create new subtopics through the Helix web interface.
- Editing Subtopics: Users can edit the names, descriptions, and content assignments of existing subtopics.
- Deleting Subtopics: Users can delete subtopics, but this will also delete all associated content.
Example:
# Example of a Helix application with subtopics
## Main Topic: Python Programming
### Subtopic 1: Data Structures
#### Subtopic 2: Lists
#### Subtopic 3: Dictionaries
### Subtopic 4: Functions
#### Subtopic 5: Recursion
Implementation Details:
- The
Subtopic
class in thehelix
package provides the core functionality for managing subtopics. - Subtopic data is stored in the Helix database.
- Subtopics are integrated with the Helix search and navigation features through the
SearchEngine
class.
Code Examples:
# Create a new subtopic
subtopic = Subtopic(name="Data Structures", description="A collection of related data items", parent_topic=main_topic)
subtopic.save()
# Assign content to a subtopic
content.subtopic = subtopic
content.save()
# Retrieve subtopics for a given topic
subtopics = Topic.objects.get(pk=1).subtopics.all()
# Search for content within a specific subtopic
results = SearchEngine.search(query="list", subtopic=subtopic)