Skip to content

Commit

Permalink
#322 put docstrings at top of .py files
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtavis committed Sep 1, 2023
1 parent 28d5670 commit 06ed3d7
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 76 deletions.
32 changes: 17 additions & 15 deletions backend/authentication/models.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
"""
Authentication Models
This file contains models for the authentication app.
TODO: All fields have on_delete=models.CASCADE: this needs to be reviewed, as SET_NULL is preferable in many cases.
TODO: Some relational-models may need to be moved in the "content" app in order to prevent circular dependency issues.
Contents:
- SupportEntityType
- Support
- User
- UserResource
- UserTask
- UserTopic
"""

import uuid

from django.contrib.auth.models import AbstractUser
from django.contrib.postgres.fields import ArrayField
from django.db import models

"""
Considerations:
- All fields have on_delete=models.CASCADE: this needs to be reviewed, as SET_NULL is preferable in many cases.
- More comments should be added to improve the readability and understanding of the code.
- Some relational-models may need to be moved in the "content" app in order to prevent circular dependency issues.
MODELS INDEX:
- SupportEntityType
- Support
- User
- UserResource
- UserTask
- UserTopic
"""


class SupportEntityType(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
Expand Down
33 changes: 17 additions & 16 deletions backend/content/models.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
"""
Content Models
This file contains models for the content app.
TODO: All fields have on_delete=models.CASCADE: this needs to be reviewed, as SET_NULL is preferable in many cases.
TODO: In some/most cases a "ManyToManyField" may be more suitable and scalable than "ArrayField"
Contents:
- Resource
- Task
- Topic
- ResourceTopic
- TopicFormat
"""

import uuid

from django.contrib.postgres.fields import ArrayField
from django.db import models

"""
Considerations:
- All fields have on_delete=models.CASCADE: this needs to be reviewed, as SET_NULL is preferable in many cases.
- More comments should be added to improve the readability and understanding of the code.
- Some relational-models may need to be moved in the "events" app in order to prevent circular dependency issues.
- In some/most cases a "ManyToManyField" may be more suitable and scalable than "ArrayField"
MODELS INDEX:
- Resource
- Task
- Topic
- ResourceTopic
- TopicFormat
"""


class Resource(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
Expand Down Expand Up @@ -46,7 +47,7 @@ class Task(models.Model):

def __str__(self):
return self.name


class Topic(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
Expand Down
50 changes: 25 additions & 25 deletions backend/entities/models.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
"""
Entities Models
This file contains models for the entities app.
TODO: All fields have on_delete=models.CASCADE: this needs to be reviewed, as SET_NULL is preferable in many cases.
TODO: Some relational-models may need to be moved in the "events" or "content" app in order to prevent circular dependency issues.
TODO: In some/most cases a "ManyToManyField" may be more suitable and scalable than "ArrayField"
Contents:
- Organization
- OrganizationApplicationStatus
- OrganizationApplication
- OrganizationEvent
- OrganizationMember
- OrganizationResource
- Group
- OrganizationTask
- OrganizationTopic
- GroupEvent
- GroupMember
- GroupResource
- GroupTopic
"""

import uuid

from django.contrib.postgres.fields import ArrayField
from django.db import models

"""
Considerations:
- All fields have on_delete=models.CASCADE: this needs to be reviewed, as SET_NULL is preferable in many cases.
- More comments should be added to improve the readability and understanding of the code.
- Some relational-models may need to be moved in the "events" or "content" app in order to prevent circular dependency issues.
- In some/most cases a "ManyToManyField" may be more suitable and scalable than "ArrayField"
MODELS INDEX:
- Organization
- OrganizationApplicationStatus
- OrganizationApplication
- OrganizationEvent
- OrganizationMember
- OrganizationResource
- Group
- OrganizationTask
- OrganizationTopic
- GroupEvent
- GroupMember
- GroupResource
- GroupTopic
"""



class Organization(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
Expand Down
41 changes: 21 additions & 20 deletions backend/events/models.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
"""
Events Models
This file contains models for the events app.
TODO: All fields have on_delete=models.CASCADE: this needs to be reviewed, as SET_NULL is preferable in many cases.
Contents:
- Event
- Format
- Role
- EventAttendee
- EventFormat
- EventAttendeeStatus
- EventResource
- EventRole
- EventTask
- EventTopic
"""

import uuid

from django.db import models

"""
Considerations:
- All fields have on_delete=models.CASCADE: this needs to be reviewed, as SET_NULL is preferable in many cases.
- More comments should be added to improve the readability and understanding of the code.
MODELS INDEX:
- Event
- Format
- Role
- EventAttendee
- EventFormat
- EventAttendeeStatus
- EventResource
- EventRole
- EventTask
- EventTopic
"""


class Event(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
Expand All @@ -42,7 +44,7 @@ class Event(models.Model):

def __str__(self):
return self.name


class Format(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
Expand Down Expand Up @@ -122,4 +124,3 @@ class EventTopic(models.Model):

def __str__(self):
return self.id

0 comments on commit 06ed3d7

Please sign in to comment.