1. ===================================
    
  2. Writing your first patch for Django
    
  3. ===================================
    
  4. 
    
  5. Introduction
    
  6. ============
    
  7. 
    
  8. Interested in giving back to the community a little? Maybe you've found a bug
    
  9. in Django that you'd like to see fixed, or maybe there's a small feature you
    
  10. want added.
    
  11. 
    
  12. Contributing back to Django itself is the best way to see your own concerns
    
  13. addressed. This may seem daunting at first, but it's a well-traveled path with
    
  14. documentation, tooling, and a community to support you. We'll walk you through
    
  15. the entire process, so you can learn by example.
    
  16. 
    
  17. Who's this tutorial for?
    
  18. ------------------------
    
  19. 
    
  20. .. seealso::
    
  21. 
    
  22.     If you are looking for a reference on the details of making code
    
  23.     contributions, see the :doc:`/internals/contributing/writing-code/index`
    
  24.     documentation.
    
  25. 
    
  26. For this tutorial, we expect that you have at least a basic understanding of
    
  27. how Django works. This means you should be comfortable going through the
    
  28. existing tutorials on :doc:`writing your first Django app</intro/tutorial01>`.
    
  29. In addition, you should have a good understanding of Python itself. But if you
    
  30. don't, `Dive Into Python`__ is a fantastic (and free) online book for
    
  31. beginning Python programmers.
    
  32. 
    
  33. Those of you who are unfamiliar with version control systems and Trac will find
    
  34. that this tutorial and its links include just enough information to get started.
    
  35. However, you'll probably want to read some more about these different tools if
    
  36. you plan on contributing to Django regularly.
    
  37. 
    
  38. For the most part though, this tutorial tries to explain as much as possible,
    
  39. so that it can be of use to the widest audience.
    
  40. 
    
  41. .. admonition:: Where to get help:
    
  42. 
    
  43.     If you're having trouble going through this tutorial, please post a message
    
  44.     to |django-developers| or drop by `#django-dev on irc.libera.chat`__ to
    
  45.     chat with other Django users who might be able to help.
    
  46. 
    
  47. __ https://diveinto.org/python3/table-of-contents.html
    
  48. __ https://web.libera.chat/#django-dev
    
  49. 
    
  50. What does this tutorial cover?
    
  51. ------------------------------
    
  52. 
    
  53. We'll be walking you through contributing a patch to Django for the first time.
    
  54. By the end of this tutorial, you should have a basic understanding of both the
    
  55. tools and the processes involved. Specifically, we'll be covering the following:
    
  56. 
    
  57. * Installing Git.
    
  58. * Downloading a copy of Django's development version.
    
  59. * Running Django's test suite.
    
  60. * Writing a test for your patch.
    
  61. * Writing the code for your patch.
    
  62. * Testing your patch.
    
  63. * Submitting a pull request.
    
  64. * Where to look for more information.
    
  65. 
    
  66. Once you're done with the tutorial, you can look through the rest of
    
  67. :doc:`Django's documentation on contributing</internals/contributing/index>`.
    
  68. It contains lots of great information and is a must read for anyone who'd like
    
  69. to become a regular contributor to Django. If you've got questions, it's
    
  70. probably got the answers.
    
  71. 
    
  72. .. admonition:: Python 3 required!
    
  73. 
    
  74.     The current version of Django doesn't support Python 2.7. Get Python 3 at
    
  75.     `Python's download page <https://www.python.org/downloads/>`_ or with your
    
  76.     operating system's package manager.
    
  77. 
    
  78. .. admonition:: For Windows users
    
  79. 
    
  80.     See :ref:`install_python_windows` on Windows docs for additional guidance.
    
  81. 
    
  82. Code of Conduct
    
  83. ===============
    
  84. 
    
  85. As a contributor, you can help us keep the Django community open and inclusive.
    
  86. Please read and follow our `Code of Conduct <https://www.djangoproject.com/conduct/>`_.
    
  87. 
    
  88. Installing Git
    
  89. ==============
    
  90. 
    
  91. For this tutorial, you'll need Git installed to download the current
    
  92. development version of Django and to generate patch files for the changes you
    
  93. make.
    
  94. 
    
  95. To check whether or not you have Git installed, enter ``git`` into the command
    
  96. line. If you get messages saying that this command could not be found, you'll
    
  97. have to download and install it, see `Git's download page`__.
    
  98. 
    
  99. If you're not that familiar with Git, you can always find out more about its
    
  100. commands (once it's installed) by typing ``git help`` into the command line.
    
  101. 
    
  102. __ https://git-scm.com/download
    
  103. 
    
  104. Getting a copy of Django's development version
    
  105. ==============================================
    
  106. 
    
  107. The first step to contributing to Django is to get a copy of the source code.
    
  108. First, `fork Django on GitHub <https://github.com/django/django/fork>`__. Then,
    
  109. from the command line, use the ``cd`` command to navigate to the directory
    
  110. where you'll want your local copy of Django to live.
    
  111. 
    
  112. Download the Django source code repository using the following command:
    
  113. 
    
  114. .. console::
    
  115. 
    
  116.     $ git clone https://github.com/YourGitHubName/django.git
    
  117. 
    
  118. .. admonition:: Low bandwidth connection?
    
  119. 
    
  120.     You can add the ``--depth 1`` argument to ``git clone`` to skip downloading
    
  121.     all of Django's commit history, which reduces data transfer from  ~250 MB
    
  122.     to ~70 MB.
    
  123. 
    
  124. Now that you have a local copy of Django, you can install it just like you would
    
  125. install any package using ``pip``. The most convenient way to do so is by using
    
  126. a *virtual environment*, which is a feature built into Python that allows you
    
  127. to keep a separate directory of installed packages for each of your projects so
    
  128. that they don't interfere with each other.
    
  129. 
    
  130. It's a good idea to keep all your virtual environments in one place, for
    
  131. example in ``.virtualenvs/`` in your home directory.
    
  132. 
    
  133. Create a new virtual environment by running:
    
  134. 
    
  135. .. console::
    
  136. 
    
  137.     $ python3 -m venv ~/.virtualenvs/djangodev
    
  138. 
    
  139. The path is where the new environment will be saved on your computer.
    
  140. 
    
  141. The final step in setting up your virtual environment is to activate it:
    
  142. 
    
  143. .. code-block:: console
    
  144. 
    
  145.     $ source ~/.virtualenvs/djangodev/bin/activate
    
  146. 
    
  147. If the ``source`` command is not available, you can try using a dot instead:
    
  148. 
    
  149. .. code-block:: console
    
  150. 
    
  151.     $ . ~/.virtualenvs/djangodev/bin/activate
    
  152. 
    
  153. You have to activate the virtual environment whenever you open a new
    
  154. terminal window.
    
  155. 
    
  156. .. admonition:: For Windows users
    
  157. 
    
  158.     To activate your virtual environment on Windows, run:
    
  159. 
    
  160.     .. code-block:: doscon
    
  161. 
    
  162.         ...\> %HOMEPATH%\.virtualenvs\djangodev\Scripts\activate.bat
    
  163. 
    
  164. The name of the currently activated virtual environment is displayed on the
    
  165. command line to help you keep track of which one you are using. Anything you
    
  166. install through ``pip`` while this name is displayed will be installed in that
    
  167. virtual environment, isolated from other environments and system-wide packages.
    
  168. 
    
  169. .. _intro-contributing-install-local-copy:
    
  170. 
    
  171. Go ahead and install the previously cloned copy of Django:
    
  172. 
    
  173. .. console::
    
  174. 
    
  175.     $ python -m pip install -e /path/to/your/local/clone/django/
    
  176. 
    
  177. The installed version of Django is now pointing at your local copy by installing
    
  178. in editable mode. You will immediately see any changes you make to it, which is
    
  179. of great help when writing your first patch.
    
  180. 
    
  181. Creating projects with a local copy of Django
    
  182. ---------------------------------------------
    
  183. 
    
  184. It may be helpful to test your local changes with a Django project. First you
    
  185. have to create a new virtual environment, :ref:`install the previously cloned
    
  186. local copy of Django in editable mode <intro-contributing-install-local-copy>`,
    
  187. and create a new Django project outside of your local copy of Django. You will
    
  188. immediately see any changes you make to Django in your new project, which is
    
  189. of great help when writing your first patch.
    
  190. 
    
  191. Running Django's test suite for the first time
    
  192. ==============================================
    
  193. 
    
  194. When contributing to Django it's very important that your code changes don't
    
  195. introduce bugs into other areas of Django. One way to check that Django still
    
  196. works after you make your changes is by running Django's test suite. If all
    
  197. the tests still pass, then you can be reasonably sure that your changes
    
  198. work and haven't broken other parts of Django. If you've never run Django's test
    
  199. suite before, it's a good idea to run it once beforehand to get familiar with
    
  200. its output.
    
  201. 
    
  202. Before running the test suite, enter the Django ``tests/`` directory using the
    
  203. ``cd tests`` command, and install test dependencies by running:
    
  204. 
    
  205. .. console::
    
  206. 
    
  207.     $ python -m pip install -r requirements/py3.txt
    
  208. 
    
  209. If you encounter an error during the installation, your system might be missing
    
  210. a dependency for one or more of the Python packages. Consult the failing
    
  211. package's documentation or search the web with the error message that you
    
  212. encounter.
    
  213. 
    
  214. Now we are ready to run the test suite. If you're using GNU/Linux, macOS, or
    
  215. some other flavor of Unix, run:
    
  216. 
    
  217. .. console::
    
  218. 
    
  219.     $ ./runtests.py
    
  220. 
    
  221. Now sit back and relax. Django's entire test suite has thousands of tests, and
    
  222. it takes at least a few minutes to run, depending on the speed of your
    
  223. computer.
    
  224. 
    
  225. While Django's test suite is running, you'll see a stream of characters
    
  226. representing the status of each test as it completes. ``E`` indicates that an
    
  227. error was raised during a test, and ``F`` indicates that a test's assertions
    
  228. failed. Both of these are considered to be test failures. Meanwhile, ``x`` and
    
  229. ``s`` indicated expected failures and skipped tests, respectively. Dots indicate
    
  230. passing tests.
    
  231. 
    
  232. Skipped tests are typically due to missing external libraries required to run
    
  233. the test; see :ref:`running-unit-tests-dependencies` for a list of dependencies
    
  234. and be sure to install any for tests related to the changes you are making (we
    
  235. won't need any for this tutorial). Some tests are specific to a particular
    
  236. database backend and will be skipped if not testing with that backend. SQLite
    
  237. is the database backend for the default settings. To run the tests using a
    
  238. different backend, see :ref:`running-unit-tests-settings`.
    
  239. 
    
  240. Once the tests complete, you should be greeted with a message informing you
    
  241. whether the test suite passed or failed. Since you haven't yet made any changes
    
  242. to Django's code, the entire test suite **should** pass. If you get failures or
    
  243. errors make sure you've followed all of the previous steps properly. See
    
  244. :ref:`running-unit-tests` for more information.
    
  245. 
    
  246. Note that the latest Django "main" branch may not always be stable. When
    
  247. developing against "main", you can check `Django's continuous integration
    
  248. builds`__ to determine if the failures are specific to your machine or if they
    
  249. are also present in Django's official builds. If you click to view a particular
    
  250. build, you can view the "Configuration Matrix" which shows failures broken down
    
  251. by Python version and database backend.
    
  252. 
    
  253. __ https://djangoci.com
    
  254. 
    
  255. .. note::
    
  256. 
    
  257.     For this tutorial and the ticket we're working on, testing against SQLite
    
  258.     is sufficient, however, it's possible (and sometimes necessary) to
    
  259.     :ref:`run the tests using a different database
    
  260.     <running-unit-tests-settings>`.
    
  261. 
    
  262. Working on a feature
    
  263. ====================
    
  264. 
    
  265. For this tutorial, we'll work on a "fake ticket" as a case study. Here are the
    
  266. imaginary details:
    
  267. 
    
  268. .. admonition:: Ticket #99999 -- Allow making toast
    
  269. 
    
  270.     Django should provide a function ``django.shortcuts.make_toast()`` that
    
  271.     returns ``'toast'``.
    
  272. 
    
  273. We'll now implement this feature and associated tests.
    
  274. 
    
  275. Creating a branch for your patch
    
  276. ================================
    
  277. 
    
  278. Before making any changes, create a new branch for the ticket:
    
  279. 
    
  280. .. console::
    
  281. 
    
  282.     $ git checkout -b ticket_99999
    
  283. 
    
  284. You can choose any name that you want for the branch, "ticket_99999" is an
    
  285. example. All changes made in this branch will be specific to the ticket and
    
  286. won't affect the main copy of the code that we cloned earlier.
    
  287. 
    
  288. Writing some tests for your ticket
    
  289. ==================================
    
  290. 
    
  291. In most cases, for a patch to be accepted into Django it has to include tests.
    
  292. For bug fix patches, this means writing a regression test to ensure that the
    
  293. bug is never reintroduced into Django later on. A regression test should be
    
  294. written in such a way that it will fail while the bug still exists and pass
    
  295. once the bug has been fixed. For patches containing new features, you'll need
    
  296. to include tests which ensure that the new features are working correctly.
    
  297. They too should fail when the new feature is not present, and then pass once it
    
  298. has been implemented.
    
  299. 
    
  300. A good way to do this is to write your new tests first, before making any
    
  301. changes to the code. This style of development is called
    
  302. `test-driven development`__ and can be applied to both entire projects and
    
  303. single patches. After writing your tests, you then run them to make sure that
    
  304. they do indeed fail (since you haven't fixed that bug or added that feature
    
  305. yet). If your new tests don't fail, you'll need to fix them so that they do.
    
  306. After all, a regression test that passes regardless of whether a bug is present
    
  307. is not very helpful at preventing that bug from reoccurring down the road.
    
  308. 
    
  309. Now for our hands-on example.
    
  310. 
    
  311. __ https://en.wikipedia.org/wiki/Test-driven_development
    
  312. 
    
  313. Writing a test for ticket #99999
    
  314. --------------------------------
    
  315. 
    
  316. In order to resolve this ticket, we'll add a ``make_toast()`` function to the
    
  317. ``django.shortcuts`` module. First we are going to write a test that tries to
    
  318. use the function and check that its output looks correct.
    
  319. 
    
  320. Navigate to Django's ``tests/shortcuts/`` folder and create a new file
    
  321. ``test_make_toast.py``. Add the following code::
    
  322. 
    
  323.     from django.shortcuts import make_toast
    
  324.     from django.test import SimpleTestCase
    
  325. 
    
  326. 
    
  327.     class MakeToastTests(SimpleTestCase):
    
  328.         def test_make_toast(self):
    
  329.             self.assertEqual(make_toast(), 'toast')
    
  330. 
    
  331. This test checks that the ``make_toast()`` returns ``'toast'``.
    
  332. 
    
  333. .. admonition:: But this testing thing looks kinda hard...
    
  334. 
    
  335.     If you've never had to deal with tests before, they can look a little hard
    
  336.     to write at first glance. Fortunately, testing is a *very* big subject in
    
  337.     computer programming, so there's lots of information out there:
    
  338. 
    
  339.     * A good first look at writing tests for Django can be found in the
    
  340.       documentation on :doc:`/topics/testing/overview`.
    
  341.     * Dive Into Python (a free online book for beginning Python developers)
    
  342.       includes a great `introduction to Unit Testing`__.
    
  343.     * After reading those, if you want something a little meatier to sink
    
  344.       your teeth into, there's always the Python :mod:`unittest` documentation.
    
  345. 
    
  346. __ https://diveinto.org/python3/unit-testing.html
    
  347. 
    
  348. Running your new test
    
  349. ---------------------
    
  350. 
    
  351. Since we haven't made any modifications to ``django.shortcuts`` yet, our test
    
  352. should fail. Let's run all the tests in the ``shortcuts`` folder to make sure
    
  353. that's really what happens. ``cd`` to the Django ``tests/`` directory and run:
    
  354. 
    
  355. .. console::
    
  356. 
    
  357.     $ ./runtests.py shortcuts
    
  358. 
    
  359. If the tests ran correctly, you should see one failure corresponding to the test
    
  360. method we added, with this error::
    
  361. 
    
  362.     ImportError: cannot import name 'make_toast' from 'django.shortcuts'
    
  363. 
    
  364. If all of the tests passed, then you'll want to make sure that you added the
    
  365. new test shown above to the appropriate folder and file name.
    
  366. 
    
  367. Writing the code for your ticket
    
  368. ================================
    
  369. 
    
  370. Next we'll be adding the ``make_toast()`` function.
    
  371. 
    
  372. Navigate to the ``django/`` folder and open the ``shortcuts.py`` file. At the
    
  373. bottom, add::
    
  374. 
    
  375.     def make_toast():
    
  376.         return 'toast'
    
  377. 
    
  378. Now we need to make sure that the test we wrote earlier passes, so we can see
    
  379. whether the code we added is working correctly. Again, navigate to the Django
    
  380. ``tests/`` directory and run:
    
  381. 
    
  382. .. console::
    
  383. 
    
  384.     $ ./runtests.py shortcuts
    
  385. 
    
  386. Everything should pass. If it doesn't, make sure you correctly added the
    
  387. function to the correct file.
    
  388. 
    
  389. Running Django's test suite for the second time
    
  390. ===============================================
    
  391. 
    
  392. Once you've verified that your patch and your test are working correctly, it's
    
  393. a good idea to run the entire Django test suite to verify that your change
    
  394. hasn't introduced any bugs into other areas of Django. While successfully
    
  395. passing the entire test suite doesn't guarantee your code is bug free, it does
    
  396. help identify many bugs and regressions that might otherwise go unnoticed.
    
  397. 
    
  398. To run the entire Django test suite, ``cd`` into the Django ``tests/``
    
  399. directory and run:
    
  400. 
    
  401. .. console::
    
  402. 
    
  403.     $ ./runtests.py
    
  404. 
    
  405. Writing Documentation
    
  406. =====================
    
  407. 
    
  408. This is a new feature, so it should be documented. Open the file
    
  409. ``docs/topics/http/shortcuts.txt`` and add the following at the end of the
    
  410. file::
    
  411. 
    
  412.     ``make_toast()``
    
  413.     ================
    
  414. 
    
  415.     .. function:: make_toast()
    
  416. 
    
  417.     .. versionadded:: 2.2
    
  418. 
    
  419.     Returns ``'toast'``.
    
  420. 
    
  421. Since this new feature will be in an upcoming release it is also added to the
    
  422. release notes for the next version of Django. Open the release notes for the
    
  423. latest version in ``docs/releases/``, which at time of writing is ``2.2.txt``.
    
  424. Add a note under the "Minor Features" header::
    
  425. 
    
  426.     :mod:`django.shortcuts`
    
  427.     ~~~~~~~~~~~~~~~~~~~~~~~
    
  428. 
    
  429.     * The new :func:`django.shortcuts.make_toast` function returns ``'toast'``.
    
  430. 
    
  431. For more information on writing documentation, including an explanation of what
    
  432. the ``versionadded`` bit is all about, see
    
  433. :doc:`/internals/contributing/writing-documentation`. That page also includes
    
  434. an explanation of how to build a copy of the documentation locally, so you can
    
  435. preview the HTML that will be generated.
    
  436. 
    
  437. Previewing your changes
    
  438. =======================
    
  439. 
    
  440. Now it's time to go through all the changes made in our patch. To stage all the
    
  441. changes ready for commit, run:
    
  442. 
    
  443. .. console::
    
  444. 
    
  445.     $ git add --all
    
  446. 
    
  447. Then display the differences between your current copy of Django (with your
    
  448. changes) and the revision that you initially checked out earlier in the
    
  449. tutorial with:
    
  450. 
    
  451. .. console::
    
  452. 
    
  453.     $ git diff --cached
    
  454. 
    
  455. Use the arrow keys to move up and down.
    
  456. 
    
  457. .. code-block:: diff
    
  458. 
    
  459.     diff --git a/django/shortcuts.py b/django/shortcuts.py
    
  460.     index 7ab1df0e9d..8dde9e28d9 100644
    
  461.     --- a/django/shortcuts.py
    
  462.     +++ b/django/shortcuts.py
    
  463.     @@ -156,3 +156,7 @@ def resolve_url(to, *args, **kwargs):
    
  464. 
    
  465.          # Finally, fall back and assume it's a URL
    
  466.          return to
    
  467.     +
    
  468.     +
    
  469.     +def make_toast():
    
  470.     +    return 'toast'
    
  471.     diff --git a/docs/releases/2.2.txt b/docs/releases/2.2.txt
    
  472.     index 7d85d30c4a..81518187b3 100644
    
  473.     --- a/docs/releases/2.2.txt
    
  474.     +++ b/docs/releases/2.2.txt
    
  475.     @@ -40,6 +40,11 @@ database constraints. Constraints are added to models using the
    
  476.      Minor features
    
  477.      --------------
    
  478. 
    
  479.     +:mod:`django.shortcuts`
    
  480.     +~~~~~~~~~~~~~~~~~~~~~~~
    
  481.     +
    
  482.     +* The new :func:`django.shortcuts.make_toast` function returns ``'toast'``.
    
  483.     +
    
  484.      :mod:`django.contrib.admin`
    
  485.      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  486. 
    
  487.     diff --git a/docs/topics/http/shortcuts.txt b/docs/topics/http/shortcuts.txt
    
  488.     index 7b3a3a2c00..711bf6bb6d 100644
    
  489.     --- a/docs/topics/http/shortcuts.txt
    
  490.     +++ b/docs/topics/http/shortcuts.txt
    
  491.     @@ -271,3 +271,12 @@ This example is equivalent to::
    
  492.              my_objects = list(MyModel.objects.filter(published=True))
    
  493.              if not my_objects:
    
  494.                  raise Http404("No MyModel matches the given query.")
    
  495.     +
    
  496.     +``make_toast()``
    
  497.     +================
    
  498.     +
    
  499.     +.. function:: make_toast()
    
  500.     +
    
  501.     +.. versionadded:: 2.2
    
  502.     +
    
  503.     +Returns ``'toast'``.
    
  504.     diff --git a/tests/shortcuts/test_make_toast.py b/tests/shortcuts/test_make_toast.py
    
  505.     new file mode 100644
    
  506.     index 0000000000..6f4c627b6e
    
  507.     --- /dev/null
    
  508.     +++ b/tests/shortcuts/test_make_toast.py
    
  509.     @@ -0,0 +1,7 @@
    
  510.     +from django.shortcuts import make_toast
    
  511.     +from django.test import SimpleTestCase
    
  512.     +
    
  513.     +
    
  514.     +class MakeToastTests(SimpleTestCase):
    
  515.     +    def test_make_toast(self):
    
  516.     +        self.assertEqual(make_toast(), 'toast')
    
  517. 
    
  518. When you're done previewing the patch, hit the ``q`` key to return to the
    
  519. command line. If the patch's content looked okay, it's time to commit the
    
  520. changes.
    
  521. 
    
  522. Committing the changes in the patch
    
  523. ===================================
    
  524. 
    
  525. To commit the changes:
    
  526. 
    
  527. .. console::
    
  528. 
    
  529.     $ git commit
    
  530. 
    
  531. This opens up a text editor to type the commit message. Follow the :ref:`commit
    
  532. message guidelines <committing-guidelines>` and write a message like:
    
  533. 
    
  534. .. code-block:: text
    
  535. 
    
  536.     Fixed #99999 -- Added a shortcut function to make toast.
    
  537. 
    
  538. Pushing the commit and making a pull request
    
  539. ============================================
    
  540. 
    
  541. After committing the patch, send it to your fork on GitHub (substitute
    
  542. "ticket_99999" with the name of your branch if it's different):
    
  543. 
    
  544. .. console::
    
  545. 
    
  546.     $ git push origin ticket_99999
    
  547. 
    
  548. You can create a pull request by visiting the `Django GitHub page
    
  549. <https://github.com/django/django/>`_. You'll see your branch under "Your
    
  550. recently pushed branches". Click "Compare & pull request" next to it.
    
  551. 
    
  552. Please don't do it for this tutorial, but on the next page that displays a
    
  553. preview of the patch, you would click "Create pull request".
    
  554. 
    
  555. Next steps
    
  556. ==========
    
  557. 
    
  558. Congratulations, you've learned how to make a pull request to Django! Details
    
  559. of more advanced techniques you may need are in
    
  560. :doc:`/internals/contributing/writing-code/working-with-git`.
    
  561. 
    
  562. Now you can put those skills to good use by helping to improve Django's
    
  563. codebase.
    
  564. 
    
  565. More information for new contributors
    
  566. -------------------------------------
    
  567. 
    
  568. Before you get too into writing patches for Django, there's a little more
    
  569. information on contributing that you should probably take a look at:
    
  570. 
    
  571. * You should make sure to read Django's documentation on
    
  572.   :doc:`claiming tickets and submitting patches
    
  573.   </internals/contributing/writing-code/submitting-patches>`.
    
  574.   It covers Trac etiquette, how to claim tickets for yourself, expected
    
  575.   coding style for patches, and many other important details.
    
  576. * First time contributors should also read Django's :doc:`documentation
    
  577.   for first time contributors</internals/contributing/new-contributors/>`.
    
  578.   It has lots of good advice for those of us who are new to helping out
    
  579.   with Django.
    
  580. * After those, if you're still hungry for more information about
    
  581.   contributing, you can always browse through the rest of
    
  582.   :doc:`Django's documentation on contributing</internals/contributing/index>`.
    
  583.   It contains a ton of useful information and should be your first source
    
  584.   for answering any questions you might have.
    
  585. 
    
  586. Finding your first real ticket
    
  587. ------------------------------
    
  588. 
    
  589. Once you've looked through some of that information, you'll be ready to go out
    
  590. and find a ticket of your own to write a patch for. Pay special attention to
    
  591. tickets with the "easy pickings" criterion. These tickets are often much
    
  592. simpler in nature and are great for first time contributors. Once you're
    
  593. familiar with contributing to Django, you can move on to writing patches for
    
  594. more difficult and complicated tickets.
    
  595. 
    
  596. If you just want to get started already (and nobody would blame you!), try
    
  597. taking a look at the list of `easy tickets that need patches`__ and the
    
  598. `easy tickets that have patches which need improvement`__. If you're familiar
    
  599. with writing tests, you can also look at the list of
    
  600. `easy tickets that need tests`__. Remember to follow the guidelines about
    
  601. claiming tickets that were mentioned in the link to Django's documentation on
    
  602. :doc:`claiming tickets and submitting patches
    
  603. </internals/contributing/writing-code/submitting-patches>`.
    
  604. 
    
  605. __ https://code.djangoproject.com/query?status=new&status=reopened&has_patch=0&easy=1&col=id&col=summary&col=status&col=owner&col=type&col=milestone&order=priority
    
  606. __ https://code.djangoproject.com/query?status=new&status=reopened&needs_better_patch=1&easy=1&col=id&col=summary&col=status&col=owner&col=type&col=milestone&order=priority
    
  607. __ https://code.djangoproject.com/query?status=new&status=reopened&needs_tests=1&easy=1&col=id&col=summary&col=status&col=owner&col=type&col=milestone&order=priority
    
  608. 
    
  609. What's next after creating a pull request?
    
  610. ------------------------------------------
    
  611. 
    
  612. After a ticket has a patch, it needs to be reviewed by a second set of eyes.
    
  613. After submitting a pull request, update the ticket metadata by setting the
    
  614. flags on the ticket to say "has patch", "doesn't need tests", etc, so others
    
  615. can find it for review. Contributing doesn't necessarily always mean writing a
    
  616. patch from scratch. Reviewing existing patches is also a very helpful
    
  617. contribution. See :doc:`/internals/contributing/triaging-tickets` for details.