Comments (2)
Because the Discussion Model has a GenericForeignKey
( attached_to = GenericForeignKey('attached_to_content_type', 'attached_to_object_id')
) it can be attached to any model with a GenericRelation
like so:
class Comment(models.Model):
...
likes = GenericRelation(Discussion)
# Creating a new like in the discussion
discussion.likes.create(attached_to_content_type=Discussion.LIKE, user=request.user)
In this example there is a constant in Discussion called LIKE. This issue then seems to either be enhancing the Discussion methods are present and applying GenericRelations to at least the User and Comment models. This is all to say the Discussion model is all setup to attach to other models.
from govready-q.
Unless otherwise discussed below the methods are already ready to be added given the Generic Relationship Discussion can have with any other model (given its GenericForeignKey)
is_discussion_deleted()
is now .is_discussion_inactive() (note there is no deleting of a discussion yet implemented.)get_project_context_dict
doesn't seem relevant for any other model besides task.is_public()
doesn't seems to do anything as assigning the attributeis_discussion_public
to a model doesn't happen anywhere so it always returns the default which is False.- Added
get_discussion_autocompletes
changes to get the organization from the discussion(should be 1 to 1). If another models wants to implement it they can look at the get_discussion_autocompletes in TaskAnswer on_discussion_comment
assumes a task to get the org which is easy enough to replace (comment.discussion.organization) however it also needs a project for the task which you cannot get from the comment.on_discussion_comment_edited
is not implemented see TODO line 95 in discussion/views.pyget_user_role is implemented
solely assuming a task inTaskAnswer
from govready-q.
Related Issues (20)
- SSP for 800-171 appliance apps print out the wrong control_catalog[control.lower()]['family_id'] for 3.3.1 HOT 2
- Fix Enum references. Replace `.value` with `.name` and migrate data HOT 1
- Reproducing DevOps CI/CD Pipeline Example
- Lint issues in dockerfile_exec_\*.sh HOT 6
- Deploying with Docker link on DockerHub page is broken HOT 3
- Server Error 500 when assigning an External OSCAL Baseline to a Project HOT 1
- Server Error 500 when importing FedRAMP Rev4 Moderate Baseline (oscal version 1.0.0) Catalog HOT 4
- Speed up performance of control select HOT 2
- Move catalogs and baselines into database HOT 2
- /usr/src/app/dev_env/docker/remote_interpreter/python_env.sh needs execute permissions in Docker container HOT 1
- Gracefully report registration email conflict HOT 1
- Failed to run developer’s environment HOT 3
- Unable to import OSCAL components HOT 3
- Error with pygithub in Docker HOT 2
- Importing OCAL 1.0.0 catalog causes Exception Type: KeyError at /controls/ HOT 1
- Upgrade to Selenium 4.2.0 to 4.3.0 and adjust deprecated find_element_by_XXX calls
- Importing FedRAMP component error: invalid component json
- Refactor Organization Defined Parameters
- will this project no longer be updated after the acquisition of RegScale ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from govready-q.