Sophie

Sophie

distrib > Fedora > 17 > x86_64 > by-pkgid > b6f82ea76d5134c5709ffcc9dc9e29c5 > files > 378

Django-doc-1.4.5-1.fc17.noarch.rpm


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Submitting patches &mdash; Django 1.4.5 documentation</title>
    
    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../../',
        VERSION:     '1.4.5',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <link rel="top" title="Django 1.4.5 documentation" href="../../../index.html" />
    <link rel="up" title="Writing code" href="index.html" />
    <link rel="next" title="Branch policy" href="branch-policy.html" />
    <link rel="prev" title="Unit tests" href="unit-tests.html" />
 
<script type="text/javascript" src="../../../templatebuiltins.js"></script>
<script type="text/javascript">
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "../../../ref/templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);
</script>

  </head>
  <body>

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../../../index.html">Django 1.4.5 documentation</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../../../index.html">Home</a>  |
        <a title="Table of contents" href="../../../contents.html">Table of contents</a>  |
        <a title="Global index" href="../../../genindex.html">Index</a>  |
        <a title="Module index" href="../../../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="unit-tests.html" title="Unit tests">previous</a> 
     |
    <a href="../../index.html" title="Django internals" accesskey="U">up</a>
   |
    <a href="branch-policy.html" title="Branch policy">next</a> &raquo;</div>
    </div>
    
    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="internals-contributing-writing-code-submitting-patches">
            
  <div class="section" id="s-submitting-patches">
<span id="submitting-patches"></span><h1>Submitting patches<a class="headerlink" href="#submitting-patches" title="Permalink to this headline">¶</a></h1>
<p>We&#8217;re always grateful for patches to Django&#8217;s code. Indeed, bug reports
with associated patches will get fixed <em>far</em> more quickly than those
without patches.</p>
<div class="section" id="s-claiming-tickets">
<span id="claiming-tickets"></span><h2>&#8220;Claiming&#8221; tickets<a class="headerlink" href="#claiming-tickets" title="Permalink to this headline">¶</a></h2>
<p>In an open-source project with hundreds of contributors around the world, it&#8217;s
important to manage communication efficiently so that work doesn&#8217;t get
duplicated and contributors can be as effective as possible. Hence, our policy
is for contributors to &#8220;claim&#8221; tickets in order to let other developers know
that a particular bug or feature is being worked on.</p>
<p>If you have identified a contribution you want to make and you&#8217;re capable of
fixing it (as measured by your coding ability, knowledge of Django internals
and time availability), claim it by following these steps:</p>
<ul class="simple">
<li><a class="reference external" href="https://www.djangoproject.com/accounts/register/">Create an account</a> to use in our ticket system. If you have an account
but have forgotten your password, you can reset it using the
<a class="reference external" href="https://www.djangoproject.com/accounts/password/reset/">password reset page</a>.</li>
<li>If a ticket for this issue doesn&#8217;t exist yet, create one in our
<a class="reference external" href="https://code.djangoproject.com/newticket">ticket tracker</a>.</li>
<li>If a ticket for this issue already exists, make sure nobody else has
claimed it. To do this, look at the &#8220;Assigned to&#8221; section of the ticket.
If it&#8217;s assigned to &#8220;nobody,&#8221; then it&#8217;s available to be claimed.
Otherwise, somebody else is working on this ticket, and you either find
another bug/feature to work on, or contact the developer working on the
ticket to offer your help.</li>
<li>Log into your account, if you haven&#8217;t already, by clicking &#8220;Login&#8221; in
the upper right of the ticket page.</li>
<li>Claim the ticket:<ol class="arabic">
<li>click the &#8220;accept&#8221; radio button under &#8220;Action&#8221; near the bottom of the
page,</li>
<li>then click &#8220;Submit changes.&#8221;</li>
</ol>
</li>
</ul>
<div class="section" id="s-ticket-claimers-responsibility">
<span id="ticket-claimers-responsibility"></span><h3>Ticket claimers&#8217; responsibility<a class="headerlink" href="#ticket-claimers-responsibility" title="Permalink to this headline">¶</a></h3>
<p>Once you&#8217;ve claimed a ticket, you have a responsibility to work on that ticket
in a reasonably timely fashion. If you don&#8217;t have time to work on it, either
unclaim it or don&#8217;t claim it in the first place!</p>
<p>If there&#8217;s no sign of progress on a particular claimed ticket for a week or
two, another developer may ask you to relinquish the ticket claim so that it&#8217;s
no longer monopolized and somebody else can claim it.</p>
<p>If you&#8217;ve claimed a ticket and it&#8217;s taking a long time (days or weeks) to code,
keep everybody updated by posting comments on the ticket. If you don&#8217;t provide
regular updates, and you don&#8217;t respond to a request for a progress report,
your claim on the ticket may be revoked. As always, more communication is
better than less communication!</p>
</div>
<div class="section" id="s-which-tickets-should-be-claimed">
<span id="which-tickets-should-be-claimed"></span><h3>Which tickets should be claimed?<a class="headerlink" href="#which-tickets-should-be-claimed" title="Permalink to this headline">¶</a></h3>
<p>Of course, going through the steps of claiming tickets is overkill in some
cases. In the case of small changes, such as typos in the documentation or
small bugs that will only take a few minutes to fix, you don&#8217;t need to jump
through the hoops of claiming tickets. Just submit your patch and be done with
it.</p>
</div>
</div>
<div class="section" id="s-patch-style">
<span id="s-id1"></span><span id="patch-style"></span><span id="id1"></span><h2>Patch style<a class="headerlink" href="#patch-style" title="Permalink to this headline">¶</a></h2>
<ul>
<li><p class="first">Make sure your code matches our <a class="reference internal" href="coding-style.html"><em>Coding style</em></a>.</p>
</li>
<li><p class="first">Submit patches in the format returned by the <tt class="docutils literal"><span class="pre">svn</span> <span class="pre">diff</span></tt> command.
An exception is for code changes that are described more clearly in
plain English than in code. Indentation is the most common example; it&#8217;s
hard to read patches when the only difference in code is that it&#8217;s
indented.</p>
<p>Patches in <tt class="docutils literal"><span class="pre">git</span> <span class="pre">diff</span></tt> format are also acceptable.</p>
</li>
<li><p class="first">When creating patches, always run <tt class="docutils literal"><span class="pre">svn</span> <span class="pre">diff</span></tt> from the top-level
<tt class="docutils literal"><span class="pre">trunk</span></tt> directory &#8211; i.e. the one that contains <tt class="docutils literal"><span class="pre">django</span></tt>, <tt class="docutils literal"><span class="pre">docs</span></tt>,
<tt class="docutils literal"><span class="pre">tests</span></tt>, <tt class="docutils literal"><span class="pre">AUTHORS</span></tt>, etc. This makes it easy for other people to
apply your patches.</p>
</li>
<li><p class="first">Attach patches to a ticket in the <a class="reference external" href="https://code.djangoproject.com/newticket">ticket tracker</a>, using the &#8220;attach
file&#8221; button. Please <em>don&#8217;t</em> put the patch in the ticket description
or comment unless it&#8217;s a single line patch.</p>
</li>
<li><p class="first">Name the patch file with a <tt class="docutils literal"><span class="pre">.diff</span></tt> extension; this will let the ticket
tracker apply correct syntax highlighting, which is quite helpful.</p>
</li>
<li><p class="first">Check the &#8220;Has patch&#8221; box on the ticket details. This will make it
obvious that the ticket includes a patch, and it will add the ticket to
the <a class="reference external" href="https://code.djangoproject.com/query?status=new&amp;status=assigned&amp;status=reopened&amp;has_patch=1&amp;order=priority">list of tickets with patches</a>.</p>
</li>
<li><p class="first">The code required to fix a problem or add a feature is an essential part
of a patch, but it is not the only part. A good patch should also
include a regression test to validate the behavior that has been fixed
and to prevent the problem from arising again. Also, if some tickets are
relevant to the code that you&#8217;ve written, mention the ticket numbers in
some comments in the test so that one can easily trace back the relevant
discussions after your patch gets committed and the tickets get closed.</p>
</li>
<li><p class="first">If the code associated with a patch adds a new feature, or modifies
behavior of an existing feature, the patch should also contain
documentation.</p>
</li>
</ul>
</div>
<div class="section" id="s-non-trivial-patches">
<span id="non-trivial-patches"></span><h2>Non-trivial patches<a class="headerlink" href="#non-trivial-patches" title="Permalink to this headline">¶</a></h2>
<p>A &#8220;non-trivial&#8221; patch is one that is more than a simple bug fix. It&#8217;s a patch
that introduces Django functionality and makes some sort of design decision.</p>
<p>If you provide a non-trivial patch, include evidence that alternatives have
been discussed on <a class="reference external" href="http://groups.google.com/group/django-developers">django-developers</a>. If you&#8217;re not sure whether your patch
should be considered non-trivial, just ask.</p>
</div>
<div class="section" id="s-javascript-patches">
<span id="javascript-patches"></span><h2>Javascript patches<a class="headerlink" href="#javascript-patches" title="Permalink to this headline">¶</a></h2>
<div class="versionadded">
<span class="title">New in Django 1.2:</span> <a class="reference internal" href="../../../releases/1.2.html"><em>Please see the release notes</em></a></div>
<p>Django&#8217;s admin system leverages the jQuery framework to increase the
capabilities of the admin interface. In conjunction, there is an emphasis on
admin javascript performance and minimizing overall admin media file size.
Serving compressed or &#8220;minified&#8221; versions of javascript files is considered
best practice in this regard.</p>
<p>To that end, patches for javascript files should include both the original
code for future development (e.g. <tt class="docutils literal"><span class="pre">foo.js</span></tt>), and a compressed version for
production use (e.g. <tt class="docutils literal"><span class="pre">foo.min.js</span></tt>). Any links to the file in the codebase
should point to the compressed version.</p>
<p>To simplify the process of providing optimized javascript code, Django
includes a handy script which should be used to create a &#8220;minified&#8221; version.
This script is located at <tt class="docutils literal"><span class="pre">django/contrib/admin/static/js/compress.py</span></tt>.</p>
<p>Behind the scenes, <tt class="docutils literal"><span class="pre">compress.py</span></tt> is a front-end for Google&#8217;s
<a class="reference external" href="https://developers.google.com/closure/compiler/">Closure Compiler</a> which is written in Java. However, the Closure Compiler
library is not bundled with Django directly, so those wishing to contribute
complete javascript patches will need to download and install the library
independently.</p>
<p>The Closure Compiler library requires Java version 6 or higher (Java 1.6 or
higher on Mac OS X). Note that Mac OS X 10.5 and earlier did not ship with
Java 1.6 by default, so it may be necessary to upgrade your Java installation
before the tool will be functional. Also note that even after upgrading Java,
the default <tt class="docutils literal"><span class="pre">/usr/bin/java</span></tt> command may remain linked to the previous Java
binary, so relinking that command may be necessary as well.</p>
<p>Please don&#8217;t forget to run <tt class="docutils literal"><span class="pre">compress.py</span></tt> and include the <tt class="docutils literal"><span class="pre">diff</span></tt> of the
minified scripts when submitting patches for Django&#8217;s javascript.</p>
</div>
</div>


          </div>         
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Submitting patches</a><ul>
<li><a class="reference internal" href="#claiming-tickets">&#8220;Claiming&#8221; tickets</a><ul>
<li><a class="reference internal" href="#ticket-claimers-responsibility">Ticket claimers&#8217; responsibility</a></li>
<li><a class="reference internal" href="#which-tickets-should-be-claimed">Which tickets should be claimed?</a></li>
</ul>
</li>
<li><a class="reference internal" href="#patch-style">Patch style</a></li>
<li><a class="reference internal" href="#non-trivial-patches">Non-trivial patches</a></li>
<li><a class="reference internal" href="#javascript-patches">Javascript patches</a></li>
</ul>
</li>
</ul>

  <h3>Browse</h3>
  <ul>
    
      <li>Prev: <a href="unit-tests.html">Unit tests</a></li>
    
    
      <li>Next: <a href="branch-policy.html">Branch policy</a></li>
    
  </ul>
  <h3>You are here:</h3>
  <ul>
      <li>
        <a href="../../../index.html">Django 1.4.5 documentation</a>
        
          <ul><li><a href="../../index.html">Django internals</a>
        
          <ul><li><a href="../index.html">Contributing to Django</a>
        
          <ul><li><a href="index.html">Writing code</a>
        
        <ul><li>Submitting patches</li></ul>
        </li></ul></li></ul></li></ul>
      </li>
  </ul>  

  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../../_sources/internals/contributing/writing-code/submitting-patches.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
              <h3>Last update:</h3>
              <p class="topless">Feb 21, 2013</p>
          </div> 
        
      
    </div>
    
    <div id="ft">
      <div class="nav">
    &laquo; <a href="unit-tests.html" title="Unit tests">previous</a> 
     |
    <a href="../../index.html" title="Django internals" accesskey="U">up</a>
   |
    <a href="branch-policy.html" title="Branch policy">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>