<commit_before># django mongodbforms

This is an implementation of django's model forms for mongoengine documents.

## Requirements

 * mongoengine

## Usage



## What works and doesn't work

django-mongodbforms currently only supports the most basic things and even they are not really tested.

Changelists only support basic listings you probably won't be able to use fieldlists and every other feature that django supports for changelists (search, etc.).

Inline admin objects are created automatically for embedded objects, but can't be defined manually for referenced objects. Although I haven't tested it, field widget can't be overwritten.
<commit_msg>Updated readme a bit.<commit_after># django mongodbforms

This is an implementation of django's model forms for mongoengine documents.

## Requirements

 * [mongoengine](http://mongoengine.org/)

## Usage

mongodbforms supports forms for normal documents and embedded documents. 

### Normal documents

To use mongodbforms with normal documents replace djangos forms with mongodbform forms.

    from mongodbforms import DocumentForm

    class BlogForm(DocumentForm)
        ...

### Embedded documents

For embedded documents use `EmbeddedDocumentForm`. The Meta-object of the form has to be provided with an embedded field name. The embedded object is appended to this. The form constructor takes an additional argument: The document the embedded document gets added to.

    # forms.py
    from mongodbforms import EmbeddedDocumentForm
    
    class MessageForm(EmbeddedDocumentForm):
        class Meta:
		    document = Message
		    embedded_field_name = 'messages'
    
		    fields = ['subject', 'sender', 'message',]

    # views.py
    form = MessageForm(parent_document=some_document, ...)

## What works and doesn't work

django-mongodbforms currently only supports the most basic things and even they are not really tested.

{'fraction_non_alphanumeric': 0.05687203791469194, 'fraction_numerical': 0.0, 'mean_word_length': 4.149051490514905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3647692', 'n_tokens_mistral': 494, 'n_tokens_neox': 452, 'n_words': 220}