Django

Code

root/django/trunk/docs/contributing.txt

Revision 7294, 38.3 kB (checked in by mtredinnick, 2 months ago)

Added "svn:eol-style native" to every text file in the tree (*.txt, *.html,
*.py, *.xml and AUTHORS, etc). Added "svn:ignore *.pyc" to some directories in
tests/regressiontests/ that were previously missing it.

Fixed #6545, #6801.

  • Property svn:eol-style set to native
Line 
1 ======================
2 Contributing to Django
3 ======================
4
5 If you think working *with* Django is fun, wait until you start working *on* it.
6 We're passionate about helping Django users make the jump to contributing members
7 of the community, so there are many ways you can help Django's development:
8
9     * Blog about Django.  We syndicate all the Django blogs we know about on
10       the `community page`_; contact jacob@jacobian.org if you've got a blog
11       you'd like to see on that page.
12
13     * Report bugs and request features in our `ticket tracker`_.  Please read
14       `Reporting bugs`_, below, for the details on how we like our bug reports
15       served up.
16
17     * Submit patches for new and/or fixed behavior.  Please read `Submitting
18       patches`_, below, for details on how to submit a patch.
19
20     * Join the `django-developers`_ mailing list and share your ideas for how
21       to improve Django.  We're always open to suggestions, although we're
22       likely to be skeptical of large-scale suggestions without some code to
23       back it up.
24
25     * Triage patches that have been submitted by other users. Please read
26       `Ticket triage`_ below, for details on the triage process.
27
28 That's all you need to know if you'd like to join the Django development
29 community. The rest of this document describes the details of how our community
30 works and how it handles bugs, mailing lists, and all the other minutiae of
31 Django development.
32
33 Reporting bugs
34 ==============
35
36 Well-written bug reports are *incredibly* helpful. However, there's a certain
37 amount of overhead involved in working with any bug tracking system, so your
38 help in keeping our ticket tracker as useful as possible is appreciated.  In
39 particular:
40
41     * **Do** read the FAQ_ to see if your issue might be a well-known question.
42
43     * **Do** `search the tracker`_ to see if your issue has already been filed.
44
45     * **Do** ask on `django-users`_ *first* if you're not sure if what you're
46       seeing is a bug.
47
48     * **Do** write complete, reproducible, specific bug reports. Include as
49       much information as you possibly can, complete with code snippets, test
50       cases, etc. This means including a clear, concise description of the
51       problem, and a clear set of instructions for replicating the problem.
52       A minimal example that illustrates the bug in a nice small test case
53       is the best possible bug report.
54
55     * **Don't** use the ticket system to ask support questions.  Use the
56       `django-users`_ list, or the `#django`_ IRC channel for that.
57
58     * **Don't** use the ticket system to make large-scale feature requests.
59       We like to discuss any big changes to Django's core on the `django-developers`_
60       list before actually working on them.
61
62     * **Don't** reopen issues that have been marked "wontfix". This mark means
63       that the decision has been made that we can't or won't fix this particular
64       issue.  If you're not sure why, please ask on `django-developers`_.
65
66     * **Don't** use the ticket tracker for lengthy discussions, because they're
67       likely to get lost. If a particular ticket is controversial, please move
68       discussion to `django-developers`_.
69
70     * **Don't** post to django-developers just to announce that you have filed
71       a bug report. All the tickets are mailed to another list
72       (`django-updates`_), which is tracked by developers and triagers, so we
73       see them as they are filed.
74
75 .. _django-updates: http://groups.google.com/group/django-updates
76
77 Reporting security issues
78 =========================
79
80 Report security issues to security@djangoproject.com. This is a private list
81 only open to long-time, highly trusted Django developers, and its archives are
82 not publicly readable.
83
84 In the event of a confirmed vulnerability in Django itself, we will take the
85 following actions:
86
87     * Acknowledge to the reporter that we've received the report and that a fix
88       is forthcoming. We'll give a rough timeline and ask the reporter to keep
89       the issue confidential until we announce it.
90
91     * Halt all other development as long as is needed to develop a fix, including
92       patches against the current and two previous releases.
93
94     * Determine a go-public date for announcing the vulnerability and the fix.
95       To try to mitigate a possible "arms race" between those applying the patch
96       and those trying to exploit the hole, we will not announce security
97       problems immediately.
98
99     * Pre-notify everyone we know to be running the affected version(s) of
100       Django. We will send these notifications through private e-mail which will
101       include documentation of the vulnerability, links to the relevant patch(es),
102       and a request to keep the vulnerability confidential until the official
103       go-public date.
104
105     * Publicly announce the vulnerability and the fix on the pre-determined
106       go-public date. This will probably mean a new release of Django, but
107       in some cases it may simply be patches against current releases.
108
109 Submitting patches
110 ==================
111
112 We're always grateful for patches to Django's code. Indeed, bug reports with
113 associated patches will get fixed *far* more quickly than those without patches.
114
115 "Claiming" tickets
116 ------------------
117
118 In an open-source project with hundreds of contributors around the world, it's
119 important to manage communication efficiently so that work doesn't get
120 duplicated and contributors can be as effective as possible. Hence, our policy
121 is for contributors to "claim" tickets in order to let other developers know
122 that a particular bug or feature is being worked on.
123
124 If you have identified a contribution you want to make and you're capable of
125 fixing it (as measured by your coding ability, knowledge of Django internals
126 and time availability), claim it by following these steps:
127
128     * `Create an account`_ to use in our ticket system.
129     * If a ticket for this issue doesn't exist yet, create one in our
130       `ticket tracker`_.
131     * If a ticket for this issue already exists, make sure nobody else has
132       claimed it. To do this, look at the "Assigned to" section of the ticket.
133       If it's assigned to "nobody," then it's available to be claimed.
134       Otherwise, somebody else is working on this ticket, and you either find
135       another bug/feature to work on, or contact the developer working on the
136       ticket to offer your help.
137     * Log into your account, if you haven't already, by clicking "Login" in the
138       upper right of the ticket page.
139     * Claim the ticket by clicking the radio button next to "Accept ticket"
140       near the bottom of the page, then clicking "Submit changes."
141
142 .. _Create an account: http://www.djangoproject.com/accounts/register/
143
144 Ticket claimers' responsibility
145 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
146
147 Once you've claimed a ticket, you have a responsibility to work on that ticket
148 in a reasonably timely fashion. If you don't have time to work on it, either
149 unclaim it or don't claim it in the first place!
150
151 Core Django developers go through the list of claimed tickets from time to
152 time, checking whether any progress has been made. If there's no sign of
153 progress on a particular claimed ticket for a week or two after it's been
154 claimed, we will unclaim it for you so that it's no longer monopolized and
155 somebody else can claim it.
156
157 If you've claimed a ticket and it's taking a long time (days or weeks) to code,
158 keep everybody updated by posting comments on the ticket. That way, we'll know
159 not to unclaim it. More communication is better than less communication!
160
161 Which tickets should be claimed?
162 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163
164 Of course, going through the steps of claiming tickets is overkill in some
165 cases. In the case of small changes, such as typos in the documentation or
166 small bugs that will only take a few minutes to fix, you don't need to jump
167 through the hoops of claiming tickets. Just submit your patch and be done with
168 it.
169
170 Patch style
171 -----------
172
173     * Make sure your code matches our `coding style`_.
174
175     * Submit patches in the format returned by the ``svn diff`` command.
176       An exception is for code changes that are described more clearly in plain
177       English than in code. Indentation is the most common example; it's hard to
178       read patches when the only difference in code is that it's indented.
179
180         * When creating patches, always run ``svn diff`` from the top-level
181           ``trunk`` directory -- i.e., the one that contains ``django``, ``docs``,
182           ``tests``, ``AUTHORS``, etc. This makes it easy for other people to apply
183           your patches.
184
185     * Attach patches to a ticket in the `ticket tracker`_, using the "attach file"
186       button. Please *don't* put the patch in the ticket description or comment
187       unless it's a single line patch.
188
189     * Name the patch file with a ``.diff`` extension; this will let the ticket
190       tracker apply correct syntax highlighting, which is quite helpful.
191
192     * Check the "Has patch" box on the ticket details. This will make it
193       obvious that the ticket includes a patch, and it will add the ticket to
194       the `list of tickets with patches`_.
195
196     * The code required to fix a problem or add a feature is an essential part
197       of a patch, but it is not the only part. A good patch should also include
198       a regression test to validate the behavior that has been fixed (and prevent
199       the problem from arising again).
200
201     * If the code associated with a patch adds a new feature, or modifies behavior
202       of an existing feature, the patch should also contain documentation.
203
204 Non-trivial patches
205 -------------------
206
207 A "non-trivial" patch is one that is more than a simple bug fix. It's a patch
208 that introduces Django functionality and makes some sort of design decision.
209
210 If you provide a non-trivial patch, include evidence that alternatives have
211 been discussed on `django-developers`_. If you're not sure whether your patch
212 should be considered non-trivial, just ask.
213
214 Ticket triage
215 =============
216
217 Unfortunately, not all bug reports in the `ticket tracker`_ provide all
218 the `required details`_. A number of tickets have patches, but those patches
219 don't meet all the requirements of a `good patch`_.
220
221 One way to help out is to *triage* bugs that have been reported by other
222 users. A couple of dedicated volunteers work on this regularly, but more help
223 is always appreciated.
224
225 Most of the workflow is based around the concept of a ticket's "triage stage".
226 This stage describes where in its lifetime a given ticket is at any time.
227 Along with a handful of flags, this field easily tells us what and who each
228 ticket is waiting on.
229
230 Since a picture is worth a thousand words, let's start there:
231
232 .. image:: http://media.djangoproject.com/img/doc/djangotickets.png
233    :height: 451
234    :width: 590
235    :alt: Django's ticket workflow
236
237 We've got two roles here:
238
239     * Core developers: people with commit access who make the decisions and
240       write the bulk of the code.
241
242     * Ticket triagers: community members who keep track of tickets, making
243       sure the tickets are always categorized correctly.
244
245 Second, note the five triage stages:
246
247     1. A ticket starts as "Unreviewed", meaning that a triager has yet to
248        examine the ticket and move it along.
249
250     2. "Design decision needed" means "this concept requires a design
251        decision," which should be discussed either in the ticket comments or on
252        django-developers.
253
254     3. Once a ticket is ruled to be approved for fixing, it's moved into the
255        "Accepted" stage. This stage is where all the real work gets done.
256
257     4. In some cases, a ticket might get moved to the "Someday/Maybe" state.
258        This means the ticket is an enhancement request that we might consider
259        adding to the framework if an excellent patch is submitted. These
260        tickets are not a high priority.
261
262     5. If a ticket has an associated patch (see below), a triager will review
263        the patch. If the patch is complete, it'll be marked as "ready for
264        checkin" so that a core developer knows to review and check in the
265        patches.
266
267 The second part of this workflow involves a set of flags the describe what the
268 ticket has or needs in order to be "ready for checkin":
269
270     "Has patch"
271         This means the ticket has an associated patch_. These will be
272         reviewed to see if the patch is "good".
273
274     "Needs documentation"
275         This flag is used for tickets with patches that need associated
276         documentation. Complete documentation of features is a prerequisite
277         before we can check a fix into the codebase.
278
279     "Needs tests"
280         This flags the patch as needing associated unit tests. Again, this is a
281         required part of a valid patch.
282
283     "Patch needs improvement"
284         This flag means that although the ticket *has* a patch, it's not quite
285         ready for checkin. This could mean the patch no longer applies
286         cleanly, or that the code doesn't live up to our standards.
287
288 A ticket can be resolved in a number of ways:
289
290     "fixed"
291         Used by one of the core developers once a patch has been rolled into
292         Django and the issue is fixed.
293
294     "invalid"
295         Used if the ticket is found to be incorrect or a user error.
296
297     "wontfix"
298         Used when a core developer decides that this request is not
299         appropriate for consideration in Django. This is usually chosen after
300         discussion in the ``django-developers`` mailing list, and you should
301         feel free to join in when it's something you care about.
302
303     "duplicate"
304         Used when another ticket covers the same issue. By closing duplicate
305         tickets, we keep all the discussion in one place, which helps everyone.
306
307     "worksforme"
308         Used when the triage team is unable to replicate the original bug.
309
310 If you believe that the ticket was closed in error -- because you're
311 still having the issue, or it's popped up somewhere else, or the triagers have
312 -- made a mistake, please reopen the ticket and tell us why. Please do not
313 reopen tickets that have been marked as "wontfix" by core developers.
314
315 .. _required details: `Reporting bugs`_
316 .. _good patch: `Patch style`_
317 .. _patch: `Submitting patches`_
318
319 Submitting and maintaining translations
320 =======================================
321
322 Various parts of Django, such as the admin site and validator error messages,
323 are internationalized. This means they display different text depending on a
324 user's language setting.
325
326 These translations are contributed by Django users worldwide. If you find an
327 incorrect translation, or if you'd like to add a language that isn't yet
328 translated, here's what to do:
329
330     * Join the `Django i18n mailing list`_ and introduce yourself.
331     * Create translations using the methods described in the
332       `i18n documentation`_.
333     * Create a diff of the ``.po`` file against the current Subversion trunk.
334     * Make sure that `` bin/compile-messages.py -l <lang>`` runs without
335       producing any warnings.
336     * Attach the patch to a ticket in Django's ticket system.
337
338 .. _Django i18n mailing list: http://groups.google.com/group/django-i18n/
339 .. _i18n documentation: ../i18n/
340
341 Coding style
342 ============
343
344 Please follow these coding standards when writing code for inclusion in Django:
345
346     * Unless otherwise specified, follow `PEP 8`_.
347
348       You could use  a tool like `pep8.py`_ to check for some problems in this
349       area, but remember that PEP 8 is only a guide, so respect the style of
350       the surrounding code as a primary goal.
351
352     * Use four spaces for indentation.
353
354     * Use underscores, not camelCase, for variable, function and method names
355       (i.e. ``poll.get_unique_voters()``, not ``poll.getUniqueVoters``).
356
357     * Use ``InitialCaps`` for class names (or for factory functions that
358       return classes).
359
360     * Mark all strings for internationalization; see the `i18n documentation`_
361       for details.
362
363     * In docstrings, use "action words" such as::
364
365           def foo():
366               """
367               Calculates something and returns the result.
368               """
369               pass
370
371       Here's an example of what not to do::
372
373           def foo():
374               """
375               Calculate something and return the result.
376               """
377               pass
378
379     * Please don't put your name in the code you contribute. Our policy is to
380       keep contributors' names in the ``AUTHORS`` file distributed with Django
381       -- not scattered throughout the codebase itself. Feel free to include a
382       change to the ``AUTHORS`` file in your patch if you make more than a
383       single trivial change.
384
385 Template style
386 --------------
387
388     * In Django template code, put one (and only one) space between the curly
389       brackets and the tag contents.
390
391       Do this::
392
393           {{ foo }}
394
395       Don't do this::
396
397           {{foo}}
398
399 View style
400 ----------
401
402     * In Django views, the first parameter in a view function should be called
403       ``request``.
404
405       Do this::
406
407           def my_view(request, foo):
408               # ...
409
410       Don't do this::
411
412           def my_view(req, foo):
413               # ...
414
415 Model style
416 -----------
417
418     * Field names should be all lowercase, using underscores instead of
419       camelCase.
420
421       Do this::
422
423           class Person(models.Model):
424               first_name = models.CharField(max_length=20)
425               last_name = models.CharField(max_length=40)
426
427       Don't do this::
428
429           class Person(models.Model):
430               FirstName = models.CharField(max_length=20)
431               Last_Name = models.CharField(max_length=40)
432
433     * The ``class Meta`` should appear *after* the fields are defined, with
434       a single blank line separating the fields and the class definition.
435
436       Do this::
437
438           class Person(models.Model):
439               first_name = models.CharField(max_length=20)
440               last_name = models.CharField(max_length=40)
441
442               class Meta:
443                   verbose_name_plural = 'people'
444
445       Don't do this::
446
447           class Person(models.Model):
448               first_name = models.CharField(max_length=20)
449               last_name = models.CharField(max_length=40)
450               class Meta:
451                   verbose_name_plural = 'people'
452
453       Don't do this, either::
454
455           class Person(models.Model):
456               class Meta:
457                   verbose_name_plural = 'people'
458
459               first_name = models.CharField(max_length=20)
460               last_name = models.CharField(max_length=40)
461
462     * The order of model inner classes and standard methods should be as
463       follows (noting that these are not all required):
464
465         * All database fields
466         * ``class Meta``
467         * ``class Admin``
468         * ``def __unicode__()``
469         * ``def __str__()``
470         * ``def save()``
471         * ``def get_absolute_url()``
472         * Any custom methods
473
474     * If ``choices`` is defined for a given model field, define the choices as
475       a tuple of tuples, with an all-uppercase name, either near the top of the
476       model module or just above the model class. Example::
477
478           GENDER_CHOICES = (
479               ('M', 'Male'),
480               ('F', 'Female'),
481           )
482
483 Documentation style
484 ===================
485
486 We place a high importance on consistency and readability of documentation.
487 (After all, Django was created in a journalism environment!)
488
489 How to document new features
490 ----------------------------
491
492 We treat our documentation like we treat our code: we aim to improve it as
493 often as possible. This section explains how writers can craft their
494 documentation changes in the most useful and least error-prone ways.
495
496 Documentation changes come in two forms:
497
498     * General improvements -- Typo corrections, error fixes and better
499       explanations through clearer writing and more examples.
500
501     * New features -- Documentation of features that have been added to the
502       framework since the last release.
503
504 Our philosophy is that "general improvements" are something that *all* current
505 Django users should benefit from, including users of trunk *and* users of the
506 latest release. Hence, the documentation section on djangoproject.com points
507 people by default to the newest versions of the docs, because they have the
508 latest and greatest content. (In fact, the Web site pulls directly from the
509 Subversion repository, converting to HTML on the fly.)
510
511 But this decision to feature bleeding-edge documentation has one large caveat:
512 any documentation of *new* features will be seen by Django users who don't
513 necessarily have access to those features yet, because they're only using the
514 latest release. Thus, our policy is:
515
516     **All documentation of new features should be written in a way that clearly
517     designates the features are only available in the Django development
518     version. Assume documentation readers are using the latest release, not the
519     development version.**
520
521 Our traditional way of marking new features is by prefacing the features'
522 documentation with: "New in Django development version." Changes aren't
523 *required* to include this exact text, but all documentation of new features
524 should include the phrase "development version," so we can find and remove
525 those phrases for the next release.
526
527 Guidelines for ReST files
528 -------------------------
529
530 These guidelines regulate the format of our ReST documentation:
531
532     * In section titles, capitalize only initial words and proper nouns.
533
534     * Wrap the documentation at 80 characters wide, unless a code example
535       is significantly less readable when split over two lines, or for another
536       good reason.
537
538 Commonly used terms
539 -------------------
540
541 Here are some style guidelines on commonly used terms throughout the
542 documentation:
543
544     * **Django** -- when referring to the framework, capitalize Django. It is
545       lowercase only in Python code and in the djangoproject.com logo.
546
547     * **e-mail** -- it has a hyphen.
548
549     * **MySQL**
550
551     * **PostgreSQL**
552
553     * **Python** -- when referring to the language, capitalize Python.
554
555     * **realize**, **customize**, **initialize**, etc. -- use the American
556       "ize" suffix, not "ise."
557
558     * **SQLite**
559
560     * **subclass** -- it's a single word without a hyphen, both as a verb
561       ("subclass that model") and as a noun ("create a subclass").
562
563     * **Web**, **World Wide Web**, **the Web** -- note Web is always
564       capitalized when referring to the World Wide Web.
565
566     * **Web site** -- use two words, with Web capitalized.
567
568 Django-specific terminology
569 ---------------------------
570
571     * **model** -- it's not capitalized.
572
573     * **template** -- it's not capitalized.
574
575     * **URLconf** -- use three capitalized letters, with no space before
576       "conf."
577
578     * **view** -- it's not capitalized.
579
580 Committing code
581 ===============
582
583 Please follow these guidelines when committing code to Django's Subversion
584 repository:
585
586     * For any medium-to-big changes, where "medium-to-big" is according to your
587       judgment, please bring things up on the `django-developers`_ mailing list
588       before making the change.
589
590       If you bring something up on `django-developers`_ and nobody responds,
591       please don't take that to mean your idea is great and should be
592       implemented immediately because nobody contested it. Django's lead
593       developers don't have a lot of time to read mailing-list discussions
594       immediately, so you may have to wait a couple of days before getting a
595       response.
596
597     * Write detailed commit messages in the past tense, not present tense.
598
599           * Good: "Fixed Unicode bug in RSS API."
600           * Bad: "Fixes Unicode bug in RSS API."
601           * Bad: "Fixing Unicode bug in RSS API."
602
603     * For commits to a branch, prefix the commit message with the branch name.
604       For example: "magic-removal: Added support for mind reading."
605
606     * Limit commits to the most granular change that makes sense. This means,
607       use frequent small commits rather than infrequent large commits. For
608       example, if implementing feature X requires a small change to library Y,
609       first commit the change to library Y, then commit feature X in a separate
610       commit. This goes a *long way* in helping all core Django developers
611       follow your changes.
612
613     * If your commit closes a ticket in the Django `ticket tracker`_, begin
614       your commit message with the text "Fixed #abc", where "abc" is the number
615       of the ticket your commit fixes. Example: "Fixed #123 -- Added support
616       for foo". We've rigged Subversion and Trac so that any commit message
617       in that format will automatically close the referenced ticket and post a
618       comment to it with the full commit message.
619
620       If your commit closes a ticket and is in a branch, use the branch name
621       first, then the "Fixed #abc." For example:
622       "magic-removal: Fixed #123 -- Added whizbang feature."
623
624       For the curious: We're using a `Trac post-commit hook`_ for this.
625
626       .. _Trac post-commit hook: http://trac.edgewall.org/browser/trunk/contrib/trac-post-commit-hook
627
628     * If your commit references a ticket in the Django `ticket tracker`_ but
629       does *not* close the ticket, include the phrase "Refs #abc", where "abc"
630       is the number of the ticket your commit references. We've rigged
631       Subversion and Trac so that any commit message in that format will
632       automatically post a comment to the appropriate ticket.
633
634 Unit tests
635 ==========
636
637 Django comes with a test suite of its own, in the ``tests`` directory of the
638 Django tarball. It's our policy to make sure all tests pass at all times.
639
640 The tests cover:
641
642     * Models and the database API (``tests/modeltests/``).
643     * The cache system (``tests/regressiontests/cache.py``).
644     * The ``django.utils.dateformat`` module (``tests/regressiontests/dateformat/``).
645     * Database typecasts (``tests/regressiontests/db_typecasts/``).
646     * The template system (``tests/regressiontests/templates/`` and
647       ``tests/regressiontests/defaultfilters/``).
648     * ``QueryDict`` objects (``tests/regressiontests/httpwrappers/``).
649     * Markup template tags (``tests/regressiontests/markup/``).
650
651 We appreciate any and all contributions to the test suite!
652
653 The Django tests all use the testing infrastructure that ships with Django for
654 testing applications. See `Testing Django applications`_ for an explanation of
655 how to write new tests.
656
657 .. _Testing Django applications: ../testing/
658
659 Running the unit tests
660 ----------------------
661
662 To run the tests, ``cd`` to the ``tests/`` directory and type::
663
664     ./runtests.py --settings=path.to.django.settings
665
666 Yes, the unit tests need a settings module, but only for database connection
667 info, with the ``DATABASE_ENGINE`` setting. You'll also need a ``ROOT_URLCONF``
668 setting (its value is ignored; it just needs to be present).
669
670 If you're using the ``sqlite3`` database backend, no further settings are
671 needed. A temporary database will be created in memory when running the tests.
672
673 If you're using another backend:
674
675     * Your ``DATABASE_USER`` setting needs to specify an existing user account
676       for the database engine.
677
678     * The ``DATABASE_NAME`` setting must be the name of an existing database to
679       which the given user has permission to connect. The unit tests will not
680       touch this database; the test runner creates a new database whose name is
681       ``DATABASE_NAME`` prefixed with ``test_``, and this test database is
682       deleted when the tests are finished. This means your user account needs
683       permission to execute ``CREATE DATABASE``.
684
685 To run a subset of the unit tests, append the names of the test modules to the
686 ``runtests.py`` command line. See the list of directories in
687 ``tests/modeltests`` and ``tests/regressiontests`` for module names.
688
689 As an example, if Django is not in your ``PYTHONPATH``, you placed
690 ``settings.py`` in the ``tests/`` directory, and you'd like to only run tests
691 for generic relations and internationalization, type::
692
693     PYTHONPATH=..
694     ./runtests.py --settings=settings generic_relations i18n
695
696 Requesting features
697 ===================
698
699 We're always trying to make Django better, and your feature requests are a key
700 part of that. Here are some tips on how to most effectively make a request:
701
702     * Request the feature on `django-developers`_, not in the ticket tracker;
703       it'll get read more closely if it's on the mailing list.
704
705     * Describe clearly and concisely what the missing feature is and how you'd
706       like to see it implemented. Include example code (non-functional is OK)
707       if possible.
708
709     * Explain *why* you'd like the feature. In some cases this is obvious, but
710       since Django is designed to help real developers get real work done,
711       you'll need to explain it, if it isn't obvious why the feature would be
712       useful.
713
714 As with most open-source projects, code talks. If you are willing to write the
715 code for the feature yourself or if (even better) you've already written it,
716 it's much more likely to be accepted.  If it's a large feature that might need
717 multiple developers we're always happy to give you an experimental branch in
718 our repository; see below.
719
720 Branch policy
721 =============
722
723 In general, most development is confined to the trunk, and the trunk
724 is kept stable. People should be able to run production sites against the
725 trunk at any time.
726
727 Thus, large architectural changes -- that is, changes too large to be
728 encapsulated in a single patch, or changes that need multiple eyes on them --
729 will have dedicated branches. See, for example, the `i18n branch`_. If you
730 have a change of this nature that you'd like to work on, ask on
731 `django-developers`_ for a branch to be created for you. We'll create a branch
732 for pretty much any kind of experimenting you'd like to do.
733
734 We will only branch entire copies of the Django tree, even if work is only
735 happening on part of that tree. This makes it painless to switch to a branch.
736
737 Developers working on a branch should periodically merge changes from the trunk
738 into the branch. Please merge at least once a week. Every time you merge from
739 the trunk, note the merge and revision numbers in the commit message.
740
741 Once the branch is stable and ready to be merged into the trunk, alert
742 `django-developers`_.
743
744 After a branch has been merged, it should be considered "dead"; write access to
745 it will be disabled, and old branches will be periodically "trimmed." To keep
746 our SVN wrangling to a minimum, we won't be merging from a given branch into the
747 trunk more than once.
748
749 Using branches
750 --------------
751
752 To use a branch, you'll need to do two things:
753
754     * Get the branch's code through Subversion.
755
756     * Point your Python ``site-packages`` directory at the branch's version of
757       the ``django`` package rather than the version you already have
758       installed.
759
760 Getting the code from Subversion
761 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
762
763 To get the latest version of a branch's code, check it out using Subversion::
764
765     svn co http://code.djangoproject.com/svn/django/branches/<branch>/
766
767 ...where ``<branch>`` is the branch's name. See the `list of branch names`_.
768
769 Alternatively, you can automatically convert an existing directory of the
770 Django source code as long as you've checked it out via Subversion. To do the
771 conversion, execute this command from within your ``django`` directory::
772
773     svn switch http://code.djangoproject.com/svn/django/branches/<branch>/
774
775 The advantage of using ``svn switch`` instead of ``svn co`` is that the
776 ``switch`` command retains any changes you might have made to your local copy
777 of the code. It attempts to merge those changes into the "switched" code. The
778 disadvantage is that it may cause conflicts with your local changes if the
779 "switched" code has altered the same lines of code.
780
781 (Note that if you use ``svn switch``, you don't need to point Python at the new
782 version, as explained in the next section.)
783
784 .. _list of branch names: http://code.djangoproject.com/browser/django/branches
785
786 Pointing Python at the new Django version
787 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
788
789 Once you've retrieved the branch's code, you'll need to change your Python
790 ``site-packages`` directory so that it points to the branch version of the
791 ``django`` directory. (The ``site-packages`` directory is somewhere such as
792 ``/usr/lib/python2.4/site-packages`` or
793 ``/usr/local/lib/python2.4/site-packages`` or ``C:\Python\site-packages``.)
794
795 The simplest way to do this is by renaming the old ``django`` directory to
796 ``django.OLD`` and moving the trunk version of the code into the directory
797 and calling it ``django``.
798
799 Alternatively, you can use a symlink called ``django`` that points to the
800 location of the branch's ``django`` package. If you want to switch back, just
801 change the symlink to point to the old code.
802
803 A third option is to use a `path file`_ (``<something>.pth``) which should
804 work on all systems (including Windows, which doesn't have symlinks
805 available). First, make sure there are no files, directories or symlinks named
806 ``django`` in your ``site-packages`` directory. Then create a text file named
807 ``django.pth`` and save it to your ``site-packages`` directory. That file
808 should contain a path to your copy of Django on a single line and optional
809 comments. Here is an example that points to multiple branches. Just uncomment
810 the line for the branch you want to use ('Trunk' in this example) and make
811 sure all other lines are commented::
812
813     # Trunk is a svn checkout of:
814     #   http://code.djangoproject.com/svn/django/trunk/
815     #
816     /path/to/trunk
817
818     # <branch> is a svn checkout of:
819     #   http://code.djangoproject.com/svn/django/branches/<branch>/
820     #
821     #/path/to/<branch>
822
823     # On windows a path may look like this:
824     # C:/path/to/<branch>
825
826 If you're using Django 0.95 or earlier and installed it using
827 ``python setup.py install``, you'll have a directory called something like
828 ``Django-0.95-py2.4.egg`` instead of ``django``. In this case, edit the file
829 ``setuptools.pth`` and remove the line that references the Django ``.egg``
830 file. Then copy the branch's version of the ``django`` directory into
831 ``site-packages``.
832
833 .. _path file: http://docs.python.org/lib/module-site.html
834
835 Official releases
836 =================
837
838 Django's release numbering works as follows:
839
840     * Versions are numbered in the form ``A.B`` or ``A.B.C``.
841
842     * ``A`` is the major version number, which is only incremented for major
843       changes to Django, and these changes are not necessarily
844       backwards-compatible. That is, code you wrote for Django 6.0 may break
845       when we release Django 7.0.
846
847     * ``B`` is the minor version number, which is incremented for large yet
848       backwards compatible changes.  Code written for Django 6.4 will continue
849       to work under Django 6.5.
850
851       A minor release may deprecate certain features in previous releases. If a
852       feature in version ``A.B`` is deprecated, it will continue to work in
853       version ``A.B+1``. In version ``A.B+2``, use of the feature will raise a
854       ``PendingDeprecationWarning`` but will continue to work.  Version
855       ``A.B+3`` will remove the feature entirely. Major point releases will
856       always remove deprecated features immediately.
857
858     * ``C`` is the micro version number which, is incremented for bug and
859       security fixes.  A new micro-release will always be 100%
860       backwards-compatible with the previous micro-release.
861
862     * In some cases, we'll make release candidate releases. These are of the
863       form ``A.BrcN``, which means the ``Nth`` candidate release of version
864       ``A.B``.
865
866 An exception to this version numbering scheme is the pre-1.0 Django code.
867 There's no guarantee of backwards-compatibility until the 1.0 release.
868
869 In Subversion, each Django release will be tagged under `tags/releases`_.  If
870 it's necessary to release a bug fix release or a security release that doesn't
871 come from the trunk, we'll copy that tag to ``branches/releases`` to make the
872 bug fix release.
873
874 Deciding on features
875 ====================
876
877 Once a feature's been requested and discussed, eventually we'll have a decision
878 about whether to include the feature or drop it.
879
880 Whenever possible, we strive for a rough consensus. To that end, we'll often
881 have informal votes on `django-developers`_ about a feature. In these votes we
882 follow the voting style invented by Apache and used on Python itself, where
883 votes are given as +1, +0, -0, or -1.  Roughly translated, these votes mean:
884
885     * +1: "I love the idea and I'm strongly committed to it."
886
887     * +0: "Sounds OK to me."
888
889     * -0: "I'm not thrilled, but I won't stand in the way."
890
891     * -1: "I strongly disagree and would be very unhappy to see the idea turn
892       into reality."
893
894 Although these votes on django-developers are informal, they'll be taken very
895 seriously. After a suitable voting period, if an obvious consensus arises
896 we'll follow the votes.
897
898 However, consensus is not always possible.  Tough decisions will be discussed by
899 all full committers and finally decided by the Benevolent Dictators for Life,
900 Adrian and Jacob.
901
902 Commit access
903 =============
904
905 Django has two types of committers:
906
907 Full committers
908     These are people who have a long history of contributions to Django's
909     codebase, a solid track record of being polite and helpful on the mailing
910     lists, and a proven desire to dedicate serious time to Django's development.
911
912     The bar is very high for full commit access. It will only be granted by
913     unanimous approval of all existing full committers, and the decision will err
914     on the side of rejection.
915
916 Partial committers
917     These are people who are "domain experts." They have direct check-in access
918     to the subsystems that fall under their jurisdiction, and they're given a
919     formal vote in questions that involve their subsystems. This type of access
920     is likely to be given to someone who contributes a large subframework to
921     Django and wants to continue to maintain it.
922
923     Like full committers, partial commit access is by unanimous approval of all
924     full committers (and any other partial committers in the same area).
925     However, the bar is set lower; proven expertise in the area in question is
926     likely to be sufficient.
927
928 To request commit access, please contact an existing committer privately. Public
929 requests for commit access are potential flame-war starters, and will be ignored.
930
931 .. _community page: http://www.djangoproject.com/community/
932 .. _ticket tracker: http://code.djangoproject.com/newticket
933 .. _django-developers: http://groups.google.com/group/django-developers
934 .. _FAQ: http://www.djangoproject.com/documentation/faq/
935 .. _search the tracker: http://code.djangoproject.com/search
936 .. _django-users: http://groups.google.com/group/django-users
937 .. _`#django`: irc://irc.freenode.net/django
938 .. _list of tickets with patches: http://code.djangoproject.com/query?status=new&status=assigned&status=reopened&has_patch=1&order=priority
939 .. _PEP 8: http://www.python.org/peps/pep-0008.html
940 .. _pep8.py: http://svn.browsershots.org/trunk/devtools/pep8/pep8.py
941 .. _i18n branch: http://code.djangoproject.com/browser/django/branches/i18n
942 .. _`tags/releases`: http://code.djangoproject.com/browser/django/tags/releases
Note: See TracBrowser for help on using the browser.