Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
b4f9b84d
Commit
b4f9b84d
authored
May 07, 2014
by
Matt Drayer
Committed by
Jonathan Piacenti
Aug 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mattdrayer/api-timestampedmodels: Derive models from TimeStampedModel
parent
d51df23b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
lms/djangoapps/api_manager/migrations/0004_timestampedmodels.py
+0
-0
lms/djangoapps/api_manager/models.py
+7
-8
No files found.
lms/djangoapps/api_manager/migrations/0004_timestampedmodels.py
0 → 100644
View file @
b4f9b84d
This diff is collapsed.
Click to expand it.
lms/djangoapps/api_manager/models.py
View file @
b4f9b84d
...
...
@@ -5,9 +5,10 @@
from
django.contrib.auth.models
import
Group
from
django.db
import
models
from
django.utils
import
timezone
from
model_utils.models
import
TimeStampedModel
class
GroupRelationship
(
models
.
Model
):
class
GroupRelationship
(
TimeStamped
Model
):
"""
The GroupRelationship model contains information describing the relationships of a group,
which allows us to utilize Django's user/group/permission
...
...
@@ -23,8 +24,6 @@ class GroupRelationship(models.Model):
symmetrical
=
False
,
related_name
=
"linked_to+"
),
record_active
=
models
.
BooleanField
(
default
=
True
)
record_date_created
=
models
.
DateTimeField
(
default
=
timezone
.
now
())
record_date_modified
=
models
.
DateTimeField
(
auto_now
=
True
)
def
add_linked_group_relationship
(
self
,
to_group_relationship
,
symmetrical
=
True
):
""" Create a new group-group relationship """
...
...
@@ -66,7 +65,7 @@ class GroupRelationship(models.Model):
return
GroupRelationship
.
objects
.
filter
(
**
query
)
.
exists
()
class
LinkedGroupRelationship
(
models
.
Model
):
class
LinkedGroupRelationship
(
TimeStamped
Model
):
"""
The LinkedGroupRelationship model manages self-referential two-way
relationships between group entities via the GroupRelationship model.
...
...
@@ -80,11 +79,9 @@ class LinkedGroupRelationship(models.Model):
related_name
=
"to_group_relationships"
,
verbose_name
=
"To Group"
)
record_active
=
models
.
BooleanField
(
default
=
True
)
record_date_created
=
models
.
DateTimeField
(
default
=
timezone
.
now
())
record_date_modified
=
models
.
DateTimeField
(
auto_now
=
True
)
class
CourseGroupRelationship
(
models
.
Model
):
class
CourseGroupRelationship
(
TimeStamped
Model
):
"""
The CourseGroupRelationship model contains information describing the
link between a course and a group. A typical use case for this table
...
...
@@ -92,9 +89,10 @@ class CourseGroupRelationship(models.Model):
"""
course_id
=
models
.
CharField
(
max_length
=
255
,
db_index
=
True
)
group
=
models
.
ForeignKey
(
Group
,
db_index
=
True
)
record_active
=
models
.
BooleanField
(
default
=
True
)
class
GroupProfile
(
models
.
Model
):
class
GroupProfile
(
TimeStamped
Model
):
"""
This table will provide additional tables regarding groups. This has a foreign key to
the auth_groups table
...
...
@@ -107,3 +105,4 @@ class GroupProfile(models.Model):
group_type
=
models
.
CharField
(
null
=
True
,
max_length
=
32
,
db_index
=
True
)
name
=
models
.
CharField
(
max_length
=
255
,
null
=
True
,
blank
=
True
)
data
=
models
.
TextField
(
blank
=
True
)
# JSON dictionary for generic key/value pairs
record_active
=
models
.
BooleanField
(
default
=
True
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment