Friend networks are very important in helping users to socialize and share interests together. These features are common in Web 2.0 applications, and now users are able to incorporate them into any Django web site.
Here is a quick summary of the Django features covered in this tutorial:
- To manually specify a name for the related attribute in a data model, pass a keyword argument called related_name to the field that creates the relationship between models.
- One can specify several options for data models by defining a class called Meta inside the data model. Some of the possible attributes in this class are: db_table, ordering, permissions, and unique_together.
- To send an email in Django, use the send_mail function. It's available from
the django.core.mail package.
- The Django session framework provides a convenient way to store and retrieve user data across requests. The request.session object provides a dictionary-like interface to interact with session data.
- To create a message, use the following method call: request.user.message_set.create.
- To display messages in a template, use the template variable messages.