django-mom

Maps plain text data to a model, creating, updating, or removing it as it changes


Keywords
database, database-management, django, serialization
License
MIT
Install
pip install django-mom==0.0.5

Documentation

PyPI version View the Docs example workflow

Model Object Mapper for Django

Map YAML files to a database and add/update/delete them as they change.

Installation

For Fresh Builds

pip install -i https://test.pypi.org/simple/ django-mom

For Milestone Builds

pip install django-mom

Usage

Model

# File: home/models.py

from django.db import models

class Post(models.Model):
    title = models.CharField(max_length=100, )
    date = models.DateTimeField()
    slug = models.SlugField(unique=True, )

Map

# File: mom.yaml

mom:
  map:
    post:
      model: home.models.Post
      lookupField: slug

Object

# File: post.my-awesome-post.mom.yaml
#            ^^^^^^^^^^^^^^^ is `slug` 

field:
  title: My Awesome Title
  date: 2021-06-25 13:00:00+3

Result

title: My Awesome Title
date: 2021-06-25 13:00:00+3
slug: my-awesome-post