-
Notifications
You must be signed in to change notification settings - Fork 2
Models
This page contains a breakdown of the models within the system.
https://drive.google.com/file/d/1MoR7NglzlB7UrP2poZhehi4HtH9fYRDk/view?usp=sharing
Defines a user that has an account associated with the system; they are either an admin or an SOW. Extends Django's AbstractUser class, so the user can log in and out of the system and has the ability to change or reset their passwords.
- is_superuser corresponds with admin, and is_staff corresponds with an SOW.
Defines an individual on a user's case load. CaseLoadUsers cannot log into the system. A CaseLoadUser can only belong to one User.
- Admins see all
CaseLoadUser
s - SOWs see only those belonging to them
Represents a transaction of resources made by a single User. Referrals must have a User, but they do not need a CaseLoadUser. A referral without a CaseLoadUser represents an out-of-system referral, while a referral with a CaseLoadUser represents a referral to a User's CaseLoadUser. A referral can include many resources.
-
Notifications:
- Types: The referral model contains
sendSMS
andsendEmail
methods that fire when a referral is created - Referral Tracking: The system uses a verification mechanism to check whether a referral link (for a particular resource) was accessed by the user. It does this by generating a
created_at
object for the referral, and appending it as a querystring to each link. If the param is seen again by the server (in the get_resource or home actions), themarkReferralAsSeen()
function matches the timestamp to a referral marks it as seen.THIS IS A CRUCIAL APPLICATION MECHANISM
- Although collisions are possible, they are highly unlikely. The
Str()
representation of the object contains SIX decimal points. Read more here
- Types: The referral model contains
Represents the basic item used in referrals and which can be accessed freely on the site. Resources are referred to individuals, but they can exist without being referred. A resource can also have many tags, though it does not need any.
- Resource Images (type:
django.db.models.fields.FileField
):- These are stored in the application's
MEDIA_ROOT
directory (currentlyNewERA/user_uploads
) - They are validated by the ResourceForm, and have an upload limit.
- A
content_type
field is used to store image types: This is required because prior to validation, images are stored as an in memory type (native) and then converted to a FileField type, thereby losing their .content_type attributes. See the try/except block in views.pyedit_resource
function. - The default Django forms mechanism is not used to implement uploads. Instead, images are added and removed from the filesystem manually
- These are stored in the application's
Represents a category that a resource fits into. Used specifically in filtering resources. Resources can have multiple tags, and tags can have multiple resources, but a resource does not need to be tagged, and a tag does not need to be associated with any resources.
© 2020 Max Kornyev | Joey Perrino | Brent Hong
Table Of Contents
- Intro
- Model Breakdown
- [View Actions](View Actions) In progress
- Deployment
- Technical & System Contacts