Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
D
Django LDP
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 20
    • Issues 20
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 5
    • Merge Requests 5
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Packages
    • Packages
    • Container Registry
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Startin blox
  • djangoldp-packages
  • Django LDP
  • Merge Requests
  • !113

Open
Opened Jan 22, 2020 by Christophe Henry@christophehenry
  • Report abuse
Report abuse

WIP: feat: Add support for defining a custom serializer

I've come accross this limitation several times. I think DjangoLDP's automatic serialization system is great. But there are times when the data present in database must be a minimum processed before serialization or deserialization which raises the need for defining a custom serializing method.

An example is supporting generic likes. The model makes use of GenericForeignKey and Django's ContentType framework. But these values mean nothing as is in a federated world. There are just a DB representation. So they need a transformation before serialization/deserialization.

This PR brings the possibility to completely bypass DjangoLDP's serializer generation and define your own in your model's metaclass using ldp_write_serializer and ldp_read_serializer.

NB: tests incomming.

Edited Jan 22, 2020 by Christophe Henry

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b "add-custom-serializer-support" "origin/add-custom-serializer-support"

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout "origin/master"
git merge --no-ff "add-custom-serializer-support"

Step 4. Push the result of the merge to GitLab

git push origin "master"

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

  • Discussion 11
  • Commits 1
  • Pipelines 1
  • Changes 2
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
0
Labels
None
Assign labels
  • View project labels
Reference: startinblox/djangoldp-packages/djangoldp!113