Skip to content

Commit 5d7715e

Browse files
authored
DOCSP-46516: Setup (#4)
* DOCSP-46516: Setup * more files * test script * edit * JS feedback
1 parent aecdcbc commit 5d7715e

File tree

7 files changed

+288
-6
lines changed

7 files changed

+288
-6
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Django MongoDB Backend Documentation
22

3-
[Your words here].
3+
This repository contains documentation for Django MongoDB Backend, the
4+
Django database backend that uses PyMongo to connect to MongoDB.
45

56
## Report Issues
67

REVIEWING.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Pull Request Reviewing Guidelines for the Django MongoDB Backend Documentation
2+
3+
Contributions to the set of documents in this repository can receive reviews from one or both of the following types of reviews:
4+
5+
1. A **copy review**, which focuses on information structure and wording; typically performed by a MongoDB Documentation Team member
6+
2. A **technical review**, which addresses code snippets and the technical correctness of prose; typically performed by a MongoDB engineer.
7+
8+
See the following sections for reviewer expectations for each type of pull request (PR) review:
9+
10+
## Copy Review
11+
12+
Review the structure, wording, and flow of the information in the PR, and correct it if necessary.
13+
14+
### What to Review
15+
16+
- Wording
17+
- Page structure
18+
- Technical content to the extent of the reviewer's understanding.
19+
- Whether the PR fulfills the Acceptance Criteria described in the
20+
linked JIRA ticket.
21+
22+
### What Not to Review
23+
24+
Nothing is completely off-limits to a copy review of a PR -- if you notice a technical issue, it's best to call it out early.
25+
Copy reviewers should constrain their reviews to content within the scope of the JIRA ticket, or otherwise create PRs to address anything unrelated.
26+
27+
## Technical Review
28+
29+
Review the technical accuracy and completeness of a PR and correct it if necessary.
30+
31+
### What to Review
32+
33+
- Code snippets; ensure the code is idiomatic and that all technical claims are correct. e.g. ("To create a `Foo`, use the `Bar.createFoo()` method")
34+
- Problematic explanations that could trip up users who try to follow the documentation.
35+
36+
### What Not to Review
37+
38+
While we welcome any recommendations on wording and structure, avoid blocking approval based on any copy edits. Please entrust the author to make the writing decisions based on style guidelines and team-specific writing conventions, and to create PRs to address anything they deem outside the technical review scope.
39+
40+
- Wording of sentences, although corrections to technical claims are welcome
41+
- Structure of the page
42+
- Any unchanged lines outside the PR unless relevant to the ticket
43+
acceptance criteria.

github/pull_request_template.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Pull Request Info
2+
3+
[PR Reviewing Guidelines](https://github.com/mongodb/docs-django/blob/master/REVIEWING.md)
4+
5+
JIRA - <https://jira.mongodb.org/browse/DOCSP-NNNNN>
6+
7+
### Staging Links
8+
9+
<!-- start insert-links --><!-- end insert-links -->
10+
11+
## Self-Review Checklist
12+
13+
- [ ] Is this free of any warnings or errors in the RST?
14+
- [ ] Did you run a spell-check?
15+
- [ ] Did you run a grammar-check?
16+
- [ ] Are all the links working?
17+
- [ ] Are the [facets and meta keywords](https://wiki.corp.mongodb.com/display/DE/Docs+Taxonomy) accurate?
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Add Netlify Links To Changed Pages
2+
on:
3+
workflow_call:
4+
pull_request_target:
5+
jobs:
6+
get-pr-changes:
7+
name: Get Changed Files & Update PR Description
8+
runs-on: ubuntu-latest
9+
permissions:
10+
issues: write
11+
contents: write
12+
pull-requests: write
13+
repository-projects: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Get Changed Files
17+
id: changed-files
18+
# pin to a specific commit to ensure stability
19+
uses: tj-actions/changed-files@c65cd883420fd2eb864698a825fc4162dd94482c
20+
with:
21+
separator: ","
22+
files: source/**
23+
- name: Build Netlify Links for Changed Pages
24+
id: build_page_links
25+
env:
26+
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
27+
run: |
28+
new_links=""
29+
base_link='https://deploy-preview-${{ github.event.number }}--docs-django.netlify.app'
30+
files=$(echo "$CHANGED_FILES" | tr "," "\n")
31+
for file in $files; do
32+
echo "processing ${file}"
33+
if (! grep -s "includes/" <<< "$file") &&
34+
(! grep -s "images/" <<< "$file") &&
35+
(! grep -s "examples/" <<< "$file"); then
36+
file="${file#source}"
37+
file="${file%.txt}"
38+
filenoslash="${file:1}"
39+
echo "${base_link}${file}"
40+
new_links+="<li><a href=${base_link}${file}>${filenoslash}</a></li>"
41+
else
42+
echo "(file skipped)"
43+
fi
44+
done
45+
if [ "$new_links" == "" ]; then
46+
new_links="No pages to preview"
47+
fi
48+
echo "Final new_links string: "
49+
echo "${new_links}"
50+
echo "staging_links=${new_links}" >> "$GITHUB_OUTPUT"
51+
- name: Update the PR Description
52+
uses: MongoCaleb/pr-description-action@master
53+
with:
54+
regex: "<!-- start insert-links -->.*<!-- end insert-links -->"
55+
appendContentOnMatchOnly: true
56+
regexFlags: is
57+
content: "<!-- start insert-links -->\n${{ steps.build_page_links.outputs.staging_links }}\n<!-- end insert-links -->"
58+
token: ${{ secrets.GITHUB_TOKEN }}

snooty.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@ intersphinx = [ "https://www.mongodb.com/docs/manual/objects.inv",
77

88
# toc_landing_pages = ["/paths/to/pages/that/have/nested/content"]
99

10-
# [constants]
11-
# constant = "value"
10+
[constants]
11+
django-odm = "Django MongoDB Backend"
12+
api = "https://django-mongodb.readthedocs.io/en/latest/"
13+
mdb-server = "MongoDB Server"
14+
django-version = "5.0"
15+
django-docs = "https://docs.djangoproject.com/en/{+django-version+}"
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# start-models
2+
from django.db import models
3+
from django_mongodb_backend.fields import EmbeddedModelField, ArrayField
4+
5+
class Award(models.Model):
6+
wins = models.IntegerField(default=0)
7+
nominations = models.IntegerField(default=0)
8+
text = models.CharField(max_length=100)
9+
10+
class Meta:
11+
managed = False
12+
13+
class Movie(models.Model):
14+
title = models.CharField(max_length=200)
15+
plot = models.TextField(blank=True)
16+
runtime = models.IntegerField(default=0)
17+
released = models.DateTimeField("release date", null=True, blank=True)
18+
awards = EmbeddedModelField(Award)
19+
genres = ArrayField(models.CharField(max_length=100), null=True, blank=True)
20+
imdb = models.JSONField(null=True)
21+
22+
class Meta:
23+
db_table = "movies"
24+
managed = False
25+
26+
def __str__(self):
27+
return self.title
28+
# end-models
29+
30+
# start-all
31+
Movie.objects.all()
32+
# end-all
33+
34+
# start-filter
35+
Movie.objects.filter(runtime=300)
36+
# end-filter
37+
38+
# start-get
39+
Movie.objects.get(title="Finding Nemo")
40+
# end-get
41+
42+
# start-exclude
43+
Movie.objects.exclude(released__lt=timezone.make_aware(datetime(1980, 1, 1)))
44+
# end-exclude
45+
46+
# start-filter-contains
47+
Movie.objects.filter(plot__contains="coming-of-age")
48+
# end-filter-contains
49+
50+
# start-filter-lte
51+
Movie.objects.filter(runtime__lte=50)
52+
# end-filter-lte
53+
54+
# start-filter-relationships
55+
Movie.objects.filter(awards__wins=93)
56+
# end-filter-relationships
57+
58+
# start-filter-combine
59+
Movie.objects.filter(awards__text__istartswith="nominated")
60+
# end-filter-combine
61+
62+
# start-sort
63+
Movie.objects.filter(title__startswith="Rocky").order_by("released")
64+
# end-sort
65+
66+
# start-limit
67+
Movie.objects.filter(released=timezone.make_aware(datetime(2010, 7, 16)))[2:4]
68+
# end-limit
69+
70+
# start-first
71+
Movie.objects.filter(genres=["Crime", "Comedy"]).first()
72+
# end-first
73+
74+
# start-json
75+
Movie.objects.filter(imdb__votes__gt=900000)
76+
# end-json
77+
78+
# start-kt
79+
from django.db.models.fields.json import KT
80+
81+
Movie.objects.annotate(score=KT("imdb__rating")).all().order_by("-score")
82+
# end-kt
83+
84+
# start-primary-key-pk
85+
from bson import ObjectId
86+
87+
Movie.objects.get(pk=ObjectId("573a1394f29313caabce0d37"))
88+
# end-primary-key-pk
89+
90+
# start-primary-key-id
91+
from bson import ObjectId
92+
93+
Movie.objects.get(id=ObjectId("573a1394f29313caabce0d37"))
94+
# end-primary-key-id

source/index.txt

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,74 @@
22
Django MongoDB Backend
33
======================
44

5-
.. default-domain:: mongodb
5+
.. facet::
6+
:name: programming_language
7+
:values: python
68

7-
Your words here. Don't forget to add a toctree!
9+
.. meta::
10+
:keywords: home
811

9-
Have a lovely day!
12+
.. toctree::
1013

14+
Issues & Help </issues-and-help>
15+
16+
17+
.. TODO:
18+
Get Started </get-started>
19+
Connection Configuration </connect>
20+
Interact with Data </interact-data>
21+
Model Your Data </model-data>
22+
Django Feature Limitations </feature-limitations>
23+
Compatibility </compatibility>
24+
API Documentation <{+api+}>
25+
26+
Introduction
27+
------------
28+
29+
Welcome to the documentation site for the official {+django-odm+},
30+
a Django database backend that uses PyMongo to connect to MongoDB.
31+
32+
.. TODO:
33+
34+
.. Get Started
35+
.. -----------
36+
37+
.. Learn how to install {+django-odm+}, establish a connection to MongoDB, and begin
38+
working with data in the :ref:`django-get-started` tutorial.
39+
40+
.. Connect to MongoDB
41+
.. ------------------
42+
43+
.. Learn how to configure a connection to a MongoDB deployment
44+
in the :ref:`django-connection-configuration` section.
45+
46+
.. Interact with Data
47+
.. ------------------
48+
49+
.. Learn how to use {+django-odm+} to perform operations on MongoDB data
50+
in the :ref:`django-interact-data` section.
51+
52+
.. Model Your Data
53+
.. ---------------
54+
55+
.. Learn how to create Django models that represent MongoDB collections
56+
in the :ref:`django-model-data` section.
57+
58+
.. Django Feature Limitations
59+
.. --------------------------
60+
61+
.. Learn about the Django features that {+django-odm+} does not support
62+
in the :ref:`django-feature-limitations` section.
63+
64+
.. Compatibility
65+
.. -------------
66+
67+
.. Learn about the versions of {+mdb-server+}, PyMongo, Python, and Django
68+
that are compatible with {+django-odm+} in the :ref:`Compatibility <django-compatibility>`
69+
section.
70+
71+
Issues & Help
72+
-------------
73+
74+
Learn how to report bugs, contribute to {+django-odm+}, and find more resources for
75+
receiving help in the :ref:`Issues & Help <django-issues-and-help>` section.

0 commit comments

Comments
 (0)