status: hidden
title: Python — Django Blog in Markdown
slug: Keer2ePh-django
robots: noindex


# Django Blog with Markdown

The project name is `django-blog`, the project delivery protocol is
[here](https://mdk.fr/pages/obiree2uaza2sh-rendu.html).

The goal of this project is to create an elementary blogging platform,
writers will use markdown to format their content, they are *not*
required to be logged in to post. There is *no* modification and
deletion tool for them once published, only superuser can do so.


## Specifications

- You'll provide a `/admin/` interface for superusers to be able to
  edit and remove blog entries: No self-registration are provided for
  users, staff members are created only from command-line using
  `./manage.py createsuperuser`.
- The home page will display a list of articles, each article linking
  to the article page.
- In the home page, there's a link to write a new article.
- In the "create new article" page, the user can type an article title
  (to be displayed in the home page) and an article body in Markdown
  (to be displayed in the article page).
- The article page is rendering the article body (converting from
  markdown to html for proper display).


## Bonus

If a logged-in user creates a blog entry, he can then see the list of
its own articles, edit them, and remove them.


## Hints

You'll need:

- Django > 2
- No database server, just use the default (sqlite3) backend.
- [django_markdown2](https://pypi.org/project/django-markdown2/)
- 4 routes (admin, list article, new article, article detail)
- A single [model](https://docs.djangoproject.com/en/2.1/topics/db/models/).
- A [ModelForm](https://docs.djangoproject.com/en/2.1/topics/forms/modelforms/)
- You'll need to
  [makemigratiosn](https://docs.djangoproject.com/en/2.1/ref/django-admin/#django-admin-makemigrations)
  and
  [migrate](https://docs.djangoproject.com/en/2.1/ref/django-admin/#django-admin-migrate) at some point.
- 3 templates: Home, new article, and article detail.
- Use only class-based views, you'll need a
  [ListView](http://ccbv.co.uk/projects/Django/2.0/django.views.generic.list/ListView/),
  a
  [DetailView](http://ccbv.co.uk/projects/Django/2.0/django.views.generic.detail/DetailView/),
  and a
  [CreateView](http://ccbv.co.uk/projects/Django/2.0/django.views.generic.edit/CreateView/).


Keep things simple:

- Your three views should only declare some class attributes (I have like
  1 to 3 attr per class), no code needed here.
- Your model should be as simple as possible, two fields are enough,
  no code here.
- Your templates can be elaborated with CSS and whatever. Mine are
  simple to be fair (two lines of code for the article template, 4 for the
  create, 9 for the index), so yes I'll accept ugly projects.
- Your ModelForm should be simple too, only a `class Meta`, some
  attributes, and as always, no code.


Wait, this project can literally be down with 0 lines of code.
