Skip to content

Commit 7ea1300

Browse files
committed
Clean up minor mistakes in docs, links and version references.
1 parent 9f9ad2e commit 7ea1300

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Proceed to [Lab 1](docs/lab1.md).
143143

144144
1. From the command prompt, create a virtual environment.
145145
```shell
146-
python3 -m venv venv
146+
python -m venv venv
147147
```
148148
2. Activate the project
149149
```shell

‎docs/lab1.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Let's consider what we know:
2626

2727
- The error message is ``Post matching query does not exist.``, implying the
2828
QuerySet does not contain a Post matching the filters.
29-
- The line that causes the error is on line 80:``post = posts.get(title=lookup)``
29+
- The line that causes the error is in ``newsletter/views.py`` on line 80: ``post = posts.get(title=lookup)``
3030
- We know the post exists, we can find it in the
3131
[admin](http://127.0.0.1:8000/admin/newsletter/post/?q=Welcome+to+Our+Newsletter)
3232
- This impacts more than just the post in the report. The detail
@@ -273,7 +273,7 @@ Let's start with searching the code base for existing piece of HTML. Using the B
273273

274274
We can assume that the date specific information is going to be in some type of template filter or template tag. So let's try searching our codebase for ``left floated six wide column``. This should have two code matches. One of which will have a child element with the text "Read More", and since that doesn't appear in our HTML, we can exclude it. This leaves us with the template ``projects/templates/posts/includes/list_item.html``. From our search result, we can see that the template tag ``{% nice_datetime ... %}`` is rendering the timestamp.
275275

276-
If we wanted to try from the other approach, we'd start by looking at ``project/templates/posts/list.html``. We can see a loop over
276+
If we wanted to try from the other approach, we'd start by looking at ``project/templates/posts/list.html``. We can see a loop over ``page``
277277
to render individual elements for posts on the page, ``{% for post in page %}``.
278278
This brings us to the template ``projects/templates/posts/includes/list_item.html``. From there, we'd need to compare the rendered HTML to the template to narrow it down to the template tag ``{% nice_datetime ... %}``.
279279

‎docs/lab2.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def categories_list(self, obj):
124124
```
125125

126126

127-
There should also be an indexes on
127+
There should also be an index on
128128
``created``. Arguments could be made to add indexes on the fields that are
129129
search-able and ``is_published``. I would stop at ``created`` because that's used
130130
on the default loading. Any other cases would need to be proven as common
@@ -346,13 +346,13 @@ inflated count.
346346
This can be fixed by using an appropriate ``GROUP BY`` clause in the SQL. To use this
347347
in the ORM, we can either inspect the code or use the docs to see what options Django
348348
ORM's``Count`` provides us. You can use the [docs](https://docs.djangoproject.com/en/stable/ref/models/querysets/#id9)
349-
or inspect [the code](https://github.com/django/django/blob/stable/5.2.x/django/db/models/aggregates.py#L168-L173)
349+
or inspect [the code](https://github.com/search?q=repo%3Adjango%2Fdjango+class+Count%28Aggregate%29%3A&type=code)
350350
(right-click on ``Count`` and choose "Go To Definition") in your IDE if you're using
351351
PyCharm or VSCode.
352352

353353
We can see that ``Count`` subclasses
354-
[``Aggregate`` which has ``distinct`` as a param](https://github.com/django/django/blob/stable/5.2.x/django/db/models/aggregates.py#L26-L37).
355-
This matches [the documentation](https://docs.djangoproject.com/en/5.2/ref/models/querysets/#django.db.models.Count.distinct) as well.
354+
[``Aggregate`` which has ``distinct`` as a param](https://github.com/search?q=repo%3Adjango%2Fdjango+class+Aggregate%28Func%29%3A&type=code).
355+
This matches [the documentation](https://docs.djangoproject.com/en/stable/ref/models/querysets/#django.db.models.Count.distinct) as well.
356356

357357
</details>
358358

@@ -470,8 +470,8 @@ Another would be to avoid using ``.update()``, but only change the public
470470
field via:
471471

472472
```python
473-
post = get_objects_or_404(...)
474-
post.is_public != post.is_public
473+
post = get_object_or_404(...)
474+
post.is_public = not post.is_public
475475
# Include updated to keep our updated timestamp fresh.
476476
post.save(update_fields=['is_public', 'updated'])
477477
```

0 commit comments

Comments
 (0)