gis.db.models.LineStringField

class LineStringField

Providing initial data for models

It’s sometimes useful to pre-populate your database with hard-coded data when you’re first setting up an app. You can provide initial data via fixtures. Providing initial data with fixtures A fixture is a collection of data that Django knows how to import into a database. The most straightforward way of creating a fixture if you’ve already got some data is to use the manage.py dumpdata command. Or, you can write fixtures by hand; fixtures can be written as JSON, XML or YAML (with PyYAML install

views.generic.list.MultipleObjectMixin.get_context_data()

get_context_data(**kwargs) Returns context data for displaying the list of objects. Context object_list: The list of objects that this view is displaying. If context_object_name is specified, that variable will also be set in the context, with the same value as object_list. is_paginated: A boolean representing whether the results are paginated. Specifically, this is set to False if no page size has been specified, or if the available objects do not span multiple pages. paginator: An insta

db.models.SlugField

class SlugField(max_length=50, **options) [source] Slug is a newspaper term. A slug is a short label for something, containing only letters, numbers, underscores or hyphens. They’re generally used in URLs. Like a CharField, you can specify max_length (read the note about database portability and max_length in that section, too). If max_length is not specified, Django will use a default length of 50. Implies setting Field.db_index to True. It is often useful to automatically prepopulate a Slu

auth.views.logout_then_login()

logout_then_login(request, login_url=None, current_app=None, extra_context=None) Logs a user out, then redirects to the login page. URL name: No default URL provided Optional arguments: login_url: The URL of the login page to redirect to. Defaults to settings.LOGIN_URL if not supplied. current_app: A hint indicating which application contains the current view. See the namespaced URL resolution strategy for more information. extra_context: A dictionary of context data that will be added to

sessions.backends.base.SessionBase.flush()

flush() Deletes the current session data from the session and deletes the session cookie. This is used if you want to ensure that the previous session data can’t be accessed again from the user’s browser (for example, the django.contrib.auth.logout() function calls it).

views.generic.edit.CreateView.object

object When using CreateView you have access to self.object, which is the object being created. If the object hasn’t been created yet, the value will be None. Example myapp/views.py: from django.views.generic.edit import CreateView from myapp.models import Author class AuthorCreate(CreateView): model = Author fields = ['name'] Example myapp/author_form.html: <form action="" method="post">{% csrf_token %} {{ form.as_p }} <input type="submit" value="Save" /> </

utils.feedgenerator.SyndicationFeed

class SyndicationFeed [source] Base class for all syndication feeds. Subclasses should provide write(). __init__(title, link, description, language=None, author_email=None, author_name=None, author_link=None, subtitle=None, categories=None, feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, **kwargs) [source] Initialize the feed with the given dictionary of metadata, which applies to the entire feed. Any extra keyword arguments you pass to __init__ will be stored in self.feed.

sessions.backends.base.SessionBase.set_expiry()

set_expiry(value) Sets the expiration time for the session. You can pass a number of different values: If value is an integer, the session will expire after that many seconds of inactivity. For example, calling request.session.set_expiry(300) would make the session expire in 5 minutes. If value is a datetime or timedelta object, the session will expire at that specific date/time. Note that datetime and timedelta values are only serializable if you are using the PickleSerializer. If value is

auth.authenticate()

authenticate(**credentials) [source] Use authenticate() to verify a set of credentials. It takes credentials as keyword arguments, username and password for the default case, checks them against each authentication backend, and returns a User object if the credentials are valid for a backend. If the credentials aren’t valid for any backend or if a backend raises PermissionDenied, it returns None. For example: from django.contrib.auth import authenticate user = authenticate(username='john', p