Patrick Samson avatar Patrick Samson committed 03bb625

formatting

Comments (0)

Files changed (8)

 Example:
 {{{
 #!html+django
-    <a href="{% url postman_write username %}">write to {{ username }}</a>
+<a href="{% url postman_write username %}">write to {{ username }}</a>
 }}}
 Separate multiple usernames with a {{{:}}} character.
 
 Example:
 {{{
 #!html+django
-    <a href="{% url postman_write 'adm1:adm2:adm3' %}">write to admins</a>
+<a href="{% url postman_write 'adm1:adm2:adm3' %}">write to admins</a>
 }}}
 
 === Prefilled fields ===
 Example:
 {{{
 #!html+django
-    <a href="{% url postman_write %}?subject=details request&body=give me details about ...">
-    ask for details
-    </a>
+<a href="{% url postman_write %}?subject=details request&body=give me details about ...">
+ask for details
+</a>
 }}}
 
 === Recipients Min/Max ===
 Example:
 {{{
 #!python
+
     urlpatterns = patterns('postman.views',
         # ...
         url(r'^write/(?:(?P<recipients>[\w.@+-:]+)/)?$', 'write',
 For example:
 {{{
 #!python
-    from postman.forms import WriteForm
-    class MyWriteForm(WriteForm):
-        recipients = CommaSeparatedUserField(label="Recipients", min=2, max=5)
+
+from postman.forms import WriteForm
+class MyWriteForm(WriteForm):
+    recipients = CommaSeparatedUserField(label="Recipients", min=2, max=5)
 }}}
 
 If you do not want the fixed {{{max}}} parameter of the recipients field in your custom form,
 For example:
 {{{
 #!python
-    class MyThreeAnonymousWriteForm(MyBaseAnonymousWriteForm):
-        can_overwrite_limits = False
-        recipients = CommaSeparatedUserField(label="Recipients", max=3)
+
+class MyThreeAnonymousWriteForm(MyBaseAnonymousWriteForm):
+    can_overwrite_limits = False
+    recipients = CommaSeparatedUserField(label="Recipients", max=3)
 }}}
 
 See also:
 Example:
 {{{
 #!python
-    def my_user_filter(user):
-        if user.get_profile().is_absent:
-            return "is away"
-        return None
 
-    urlpatterns = patterns('postman.views',
-        # ...
-        url(r'^write/(?:(?P<recipients>[\w.@+-:]+)/)?$', 'write',
-            {'user_filter': my_user_filter}, name='postman_write'),
-        # ...
-    )
+def my_user_filter(user):
+    if user.get_profile().is_absent:
+        return "is away"
+    return None
+
+urlpatterns = patterns('postman.views',
+    # ...
+    url(r'^write/(?:(?P<recipients>[\w.@+-:]+)/)?$', 'write',
+        {'user_filter': my_user_filter}, name='postman_write'),
+    # ...
+)
 }}}
 
 The filter will be called for each recipient, for validation.
 
 * return {{{False}}} or {{{''}}}, if you do not want to give a reason for the refusal.
   The error message will be: "Some usernames are rejected: foo, bar."
-
 * return a string, as a reason for the refusal.
   The error message will be: "Some usernames are rejected: foo (reason), bar (reason)."
-
 * raise a {{{ValidationError}}} with an error message to your liking.
 
 ==== Advanced usage ====
 For example:
 {{{
 #!python
-    def my_user_filter(user):
-        # ...
-        return None
 
-    from postman.forms import WriteForm
-    class MyWriteForm(WriteForm):
-        recipients = CommaSeparatedUserField(label="Recipients", user_filter=my_user_filter)
+def my_user_filter(user):
+    # ...
+    return None
+
+from postman.forms import WriteForm
+class MyWriteForm(WriteForm):
+    recipients = CommaSeparatedUserField(label="Recipients", user_filter=my_user_filter)
 }}}
 
 === Exchange filter ===
 An example, with the django-relationships application:
 {{{
 #!python
-    def my_exchange_filter(sender, recipient, recipients_list):
-        if recipient.relationships.exists(sender, RelationshipStatus.objects.blocking()):
-            return "has blacklisted you"
-        return None
 
-    urlpatterns = patterns('postman.views',
-        # ...
-        url(r'^write/(?:(?P<recipients>[\w.@+-:]+)/)?$', 'write',
-            {'exchange_filter': my_exchange_filter}, name='postman_write'),
-        # ...
-    )
+def my_exchange_filter(sender, recipient, recipients_list):
+    if recipient.relationships.exists(sender, RelationshipStatus.objects.blocking()):
+        return "has blacklisted you"
+    return None
+
+urlpatterns = patterns('postman.views',
+    # ...
+    url(r'^write/(?:(?P<recipients>[\w.@+-:]+)/)?$', 'write',
+        {'exchange_filter': my_exchange_filter}, name='postman_write'),
+    # ...
+)
 }}}
 
 The filter will be called for each couple, to validate that the exchange is possible.
 
 * return {{{False}}} or {{{''}}}, if you do not want to give a reason for the refusal.
   The error message will be: "Writing to some users is not possible: foo, bar."
-
 * return a string, as a reason for the refusal.
   The error message will be: "Writing to some users is not possible: foo (reason), bar (reason)."
-
 * raise a {{{ValidationError}}} with an error message to your liking.
 
 ==== Advanced usage ====
 For example:
 {{{
 #!python
-    def my_exchange_filter(sender, recipient, recipients_list):
-        # ...
-        return None
 
-    from postman.forms import WriteForm
-    class MyWriteForm(WriteForm):
-        exchange_filter = staticmethod(my_exchange_filter)
+def my_exchange_filter(sender, recipient, recipients_list):
+    # ...
+    return None
+
+from postman.forms import WriteForm
+class MyWriteForm(WriteForm):
+    exchange_filter = staticmethod(my_exchange_filter)
 }}}
 
 == Auto-complete field ===
 Example:
 {{{
 #!python
-    AJAX_LOOKUP_CHANNELS = {
-        'postman_users': dict(model='auth.user', search_field='username'),
-    }
-    POSTMAN_AUTOCOMPLETER_APP = {
-        'arg_default': 'postman_users',
-    }
+
+AJAX_LOOKUP_CHANNELS = {
+    'postman_users': dict(model='auth.user', search_field='username'),
+}
+POSTMAN_AUTOCOMPLETER_APP = {
+    'arg_default': 'postman_users',
+}
 }}}
 
 Support for multiple recipients is not turned on by default by django-ajax-selects.
 Example:
 {{{
 #!python
-    urlpatterns = patterns('postman.views',
-        # ...
-        url(r'^write/(?:(?P<recipients>[\w.@+-:]+)/)?$', 'write',
-            {'autocomplete_channels': (None,'anonymous_ac')}, name='postman_write'),
-        url(r'^reply/(?P<message_id>[\d]+)/$', 'reply',
-            {'autocomplete_channel': 'reply_ac'}, name='postman_reply'),
-        # ...
-    )
+
+urlpatterns = patterns('postman.views',
+    # ...
+    url(r'^write/(?:(?P<recipients>[\w.@+-:]+)/)?$', 'write',
+        {'autocomplete_channels': (None,'anonymous_ac')}, name='postman_write'),
+    url(r'^reply/(?P<message_id>[\d]+)/$', 'reply',
+        {'autocomplete_channel': 'reply_ac'}, name='postman_reply'),
+    # ...
+)
 }}}
 
 Example:
 {{{
 #!python
-    urlpatterns = patterns('postman.views',
-        # ...
-        url(r'^write/(?:(?P<recipients>[\w.@+-:]+)/)?$', 'write',
-            {'autocomplete_channels': 'write_ac'}, name='postman_write'),
-        # ...
-    )
+
+urlpatterns = patterns('postman.views',
+    # ...
+    url(r'^write/(?:(?P<recipients>[\w.@+-:]+)/)?$', 'write',
+        {'autocomplete_channels': 'write_ac'}, name='postman_write'),
+    # ...
+)
 }}}
 
 ==== Advanced usage ====
 For example:
 {{{
 #!python
-    from postman.forms import WriteForm
-    class MyWriteForm(WriteForm):
-        recipients = CommaSeparatedUserField(label="Recipients", channel='my_channel')
+
+from postman.forms import WriteForm
+class MyWriteForm(WriteForm):
+    recipients = CommaSeparatedUserField(label="Recipients", channel='my_channel')
 }}}
 
 ----

Frequently_Asked_Questions.wiki

 
 {{{
 #!python
-    POSTMAN_AUTO_MODERATE_AS = True
+POSTMAN_AUTO_MODERATE_AS = True
 }}}
 
+
 ----
 <-//[[Management Commands|Previous]]// //[[Home]]//
 This is an application for [[http://www.djangoproject.com|Django]]-powered websites.
 
 Available translations are:
-* French - fr
-* German - de (45%)
-* Italian - it (54%)
-* Spanish - es (45%)
+* Dutch - nl (51%)
+* French - fr (100%)
+* German - de (57%)
+* Italian - it (64%)
+* Spanish - es (52%)
 
 Your contribution to the translations is welcomed at: http://www.transifex.net/projects/p/django-postman/
 
 Example:
 {{{
 #!python
-    def mod1(message):
-        # ...
-        return None
+def mod1(message):
+    # ...
+    return None
 
-    def mod2(message):
-        # ...
-        return None
-    mod2.default_reason = 'mod2 default reason'
+def mod2(message):
+    # ...
+    return None
+mod2.default_reason = 'mod2 default reason'
 
-    urlpatterns = patterns('postman.views',
-        # ...
-        url(r'^write/(?:(?P<recipients>[\w.@+-:]+)/)?$', 'write',
-            {'auto_moderators': (mod1, mod2)}, name='postman_write'),
-        url(r'^reply/(?P<message_id>[\d]+)/$', 'reply',
-            {'auto_moderators': mod1}, name='postman_reply'),
-        # ...
-    )
+urlpatterns = patterns('postman.views',
+    # ...
+    url(r'^write/(?:(?P<recipients>[\w.@+-:]+)/)?$', 'write',
+        {'auto_moderators': (mod1, mod2)}, name='postman_write'),
+    url(r'^reply/(?P<message_id>[\d]+)/$', 'reply',
+        {'auto_moderators': mod1}, name='postman_reply'),
+    # ...
+)
 }}}
 
 Each auto-moderator function will be called for the message to moderate,
    coming from moderators having returned a rating lesser than 50.
 
 ----
-<-//[[Quick Start Guide|Previous]]// //[[Home]]// //[[Views|Next]]//->
+<-//[[Quick Start Guide|Previous]]// //[[Home]]// //[[Notification|Next]]//->

Notification.wiki

 * {{{postman/email_user.txt}}} for the body
 
 The information about context variables and templates is the same as in the {{{For visitors}}} section above.
+
+----
+<-//[[Moderation|Previous]]// //[[Home]]// //[[Views|Next]]//->

Quick_Start_Guide.wiki

 
 Add {{{postman}}} to the {{{INSTALLED_APPS}}} setting of your project.
 
-Run a {{{manage.py syncdb}}}.
+Run a {{{manage.py syncdb}}}
 
 Include the URLconf {{{postman.urls}}} in your project's root URL configuration.
 
 A CSS file is provided with the application, for the Admin site: {{{postman/css/admin.css}}}.
 It is not mandatory but makes the display more confortable.
 
-The file is provided under ``postman/medias/``. It's up to you to make it visible to the URL resolver.
+The file is provided under {{{postman/medias/}}}. It's up to you to make it visible to the URL resolver.
 
 For example:
 
 * In a development environment (django's runserver), you can put in the URLconf, something like:
 {{{
 #!python
-    ('^' + settings.MEDIA_URL.strip('/') + r'/(?P<path>postman/.*)$', 'django.views.static.serve',
-        {'document_root': os.path.join(imp.find_module('postman')[1], 'medias')}),
+('^' + settings.MEDIA_URL.strip('/') + r'/(?P<path>postman/.*)$', 'django.views.static.serve',
+    {'document_root': os.path.join(imp.find_module('postman')[1], 'medias')}),
 }}}
 
 See also [[Views]] for the stylesheets of views.
 {{{settings.py}}}:
 {{{
 #!python
-    INSTALLED_APPS = (
-        # ...
-        'postman',
-        # ...
-        # 'pagination'
-        # 'ajax_select'
-        # 'notification'
-        # 'mailer'
-    )
-    # POSTMAN_DISALLOW_ANONYMOUS = True # default is False
-    # POSTMAN_DISALLOW_MULTIRECIPIENTS = True # default is False
-    # POSTMAN_DISALLOW_COPIES_ON_REPLY = True # default is False
-    # POSTMAN_AUTO_MODERATE_AS = True # default is None
-    # POSTMAN_NOTIFIER_APP = None # default is 'notification'
-    # POSTMAN_MAILER_APP = None # default is 'mailer'
-    # POSTMAN_AUTOCOMPLETER_APP = {
-        # 'name': '', # default is 'ajax_select'
-        # 'field': '', # default is 'AutoCompleteField'
-        # 'arg_name': '', # default is 'channel'
-        # 'arg_default': 'postman_friends', # no default, mandatory to enable the feature
-    # } # default is {}
+
+INSTALLED_APPS = (
+    # ...
+    'postman',
+    # ...
+    # 'pagination'
+    # 'ajax_select'
+    # 'notification'
+    # 'mailer'
+)
+# POSTMAN_DISALLOW_ANONYMOUS = True # default is False
+# POSTMAN_DISALLOW_MULTIRECIPIENTS = True # default is False
+# POSTMAN_DISALLOW_COPIES_ON_REPLY = True # default is False
+# POSTMAN_AUTO_MODERATE_AS = True # default is None
+# POSTMAN_NOTIFIER_APP = None # default is 'notification'
+# POSTMAN_MAILER_APP = None # default is 'mailer'
+# POSTMAN_AUTOCOMPLETER_APP = {
+    # 'name': '', # default is 'ajax_select'
+    # 'field': '', # default is 'AutoCompleteField'
+    # 'arg_name': '', # default is 'channel'
+    # 'arg_default': 'postman_friends', # no default, mandatory to enable the feature
+# } # default is {}
 }}}
 
 {{{urls.py}}}:
 {{{
 #!python
-    (r'^messages/', include('postman.urls')),
+(r'^messages/', include('postman.urls')),
 }}}
 
 ----

Tags_and_Filters.wiki

 The following tags and filters are available to your templates by loading the library:
 {{{
 #!html+django
-    {% load postman_tags %}
+{% load postman_tags %}
 }}}
 Here are the other special libraries in the {{{postman/templatetags/}}} directory,
 that are not intended for your site design:
 
 * {{{postman_admin_modify.py}}}: a library exclusively designed for a customized change_form
   template used in the Admin site for the moderation of pending messages.
-
 * {{{pagination_tags_for_tests.py}}}: a mock of the django-pagination application template tags,
   only usable for the test suite in case the real application is not installed.
   To rename to {{{pagination_tags.py}}} during the test session.
 Storing the count in a variable for further processing is advised, such as:
 {{{
 #!html+django
-    {% postman_unread as unread_count %}
-    ...
-    {% if unread_count %}
-        You have <strong>{{ unread_count }}</strong> unread messages.
-    {% endif %}
+
+{% postman_unread as unread_count %}
+...
+{% if unread_count %}
+    You have <strong>{{ unread_count }}</strong> unread messages.
+{% endif %}
 }}}
 
 ==== postman_order_by ====
 Example:
 {{{
 #!html+django
-    <a href="{% postman_order_by subject %}">...</a>
+<a href="{% postman_order_by subject %}">...</a>
 }}}
 
 === Filters ===
 For example, if we have:
 {{{
 #!html+django
-    {{ message.obfuscated_sender|or_me:user }}
+{{ message.obfuscated_sender|or_me:user }}
 }}}
 and the sender is the currently logged-in user, the output is compacted to show only
 the simple pattern '<me>'.
 For example:
 {{{
 #!html+django
-    {{ message.sent_at|compact_date:_("g:i A,M j,n/j/y") }}
+{{ message.sent_at|compact_date:_("g:i A,M j,n/j/y") }}
 }}}
 With a message sent on "5 dec 2010, 09:21:58":
 
 |6 dec 2010    |Dec 5
 |1 jan 2011    |12/5/10
 
+
 ----
 <-//[[Features|Previous]]// //[[Home]]// //[[Management Commands|Next]]//->
 Here is a sample of some CSS rules, usable for {{{postman/views.html}}}:
 {{{
 #!css
-    .pm_message.pm_deleted             { text-decoration: line-through; }
-    .pm_message.pm_deleted .pm_body    { display: none; }
-    .pm_message.pm_archived            { font-style: italic; color: grey; }
-    .pm_message.pm_unread .pm_subject  { font-weight: bolder; }
-    .pm_message.pm_pending .pm_header  { background-color: #FFC; }
-    .pm_message.pm_rejected .pm_header { background-color: #FDD; }
+.pm_message.pm_deleted             { text-decoration: line-through; }
+.pm_message.pm_deleted .pm_body    { display: none; }
+.pm_message.pm_archived            { font-style: italic; color: grey; }
+.pm_message.pm_unread .pm_subject  { font-weight: bolder; }
+.pm_message.pm_pending .pm_header  { background-color: #FFC; }
+.pm_message.pm_rejected .pm_header { background-color: #FDD; }
 }}}
 === forms ===
 
 Examples:
 {{{
 #!python
-    urlpatterns = patterns('postman.views',
-        # ...
-        url(r'^write/(?:(?P<recipients>[\w.@+-:]+)/)?$', 'write',
-            {'form_classes': (MyCustomWriteForm, MyCustomAnonymousWriteForm)}, name='postman_write'),
-        url(r'^reply/(?P<message_id>[\d]+)/$', 'reply',
-            {'form_class': MyCustomFullReplyForm}, name='postman_reply'),
-        url(r'^view/(?P<message_id>[\d]+)/$', 'view',
-            {'form_class': MyCustomQuickReplyForm}, name='postman_view'),
-        # ...
-    )
+urlpatterns = patterns('postman.views',
+    # ...
+    url(r'^write/(?:(?P<recipients>[\w.@+-:]+)/)?$', 'write',
+        {'form_classes': (MyCustomWriteForm, MyCustomAnonymousWriteForm)}, name='postman_write'),
+    url(r'^reply/(?P<message_id>[\d]+)/$', 'reply',
+        {'form_class': MyCustomFullReplyForm}, name='postman_reply'),
+    url(r'^view/(?P<message_id>[\d]+)/$', 'view',
+        {'form_class': MyCustomQuickReplyForm}, name='postman_view'),
+    # ...
+)
 }}}
 
 === templates ===
 Example:
 {{{
 #!python
-    urlpatterns = patterns('postman.views',
-        # ...
-        url(r'^view/(?P<message_id>[\d]+)/$', 'view',
-            {'template_name': 'my_custom_view.html'}, name='postman_view'),
-        # ...
-    )
+urlpatterns = patterns('postman.views',
+    # ...
+    url(r'^view/(?P<message_id>[\d]+)/$', 'view',
+        {'template_name': 'my_custom_view.html'}, name='postman_view'),
+    # ...
+)
 }}}
 
 === after submission ===
 Example:
 {{{
 #!python
-    urlpatterns = patterns('postman.views',
-        # ...
-        url(r'^reply/(?P<message_id>[\d]+)/$', 'reply',
-            {'success_url': 'postman_inbox'}, name='postman_reply'),
-        # ...
-    )
+urlpatterns = patterns('postman.views',
+    # ...
+    url(r'^reply/(?P<message_id>[\d]+)/$', 'reply',
+        {'success_url': 'postman_inbox'}, name='postman_reply'),
+    # ...
+)
 }}}
 
 Example:
 {{{
 #!html+django
-    <a href="{% url postman_reply reply_to_pk %}?next={{ next_url|urlencode }}">Reply</a>
+<a href="{% url postman_reply reply_to_pk %}?next={{ next_url|urlencode }}">Reply</a>
 }}}
 
 === reply formatters ===
 Examples:
 {{{
 #!python
-    def format_subject(subject):
-        return "Re_ " + subject
+def format_subject(subject):
+    return "Re_ " + subject
 
-    def format_body(sender, body):
-        return "{0} _ {1}".format(sender, body)
+def format_body(sender, body):
+    return "{0} _ {1}".format(sender, body)
 
-    urlpatterns = patterns('postman.views',
-        # ...
-        url(r'^reply/(?P<message_id>[\d]+)/$', 'reply',
-            {'formatters': (format_subject,format_body)}, name='postman_reply'),
-        url(r'^view/(?P<message_id>[\d]+)/$', 'view',
-            {'formatters': (format_subject,format_body)}, name='postman_view'),
-        # ...
-    )
+urlpatterns = patterns('postman.views',
+    # ...
+    url(r'^reply/(?P<message_id>[\d]+)/$', 'reply',
+        {'formatters': (format_subject,format_body)}, name='postman_reply'),
+    url(r'^view/(?P<message_id>[\d]+)/$', 'view',
+        {'formatters': (format_subject,format_body)}, name='postman_view'),
+    # ...
+)
 }}}
 
 ----
-<-//[[Moderation|Previous]]// //[[Home]]// //[[Features|Next]]//->
+<-//[[Notification|Previous]]// //[[Home]]// //[[Features|Next]]//->
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.