notices package

Submodules

notices.apps module

class notices.apps.NoticesConfig(app_name, app_module)

Bases: django.apps.config.AppConfig

name = 'notices'

notices.models module

class notices.models.Notice(*args, **kwargs)

Bases: django.db.models.base.Model

Notice model represents the notice uploaded by the college admin.

Each notice should have a unique heading/title.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

author

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

body

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date_posted

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_absolute_url()
Returns:url of the corresponding notice on basis of heading as notices/{heading}
get_next_by_date_posted(*, field=<django.db.models.fields.DateTimeField: date_posted>, is_next=True, **kwargs)
static get_notice(heading)
Parameters:heading (string) – heading/title of notice
Returns:notice object with the heading passed as parameter
static get_notices_by_date()
Returns:list of notices in descending order of date_posted (latest notice first)
get_previous_by_date_posted(*, field=<django.db.models.fields.DateTimeField: date_posted>, is_next=False, **kwargs)
heading

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

image

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

objects = <django.db.models.manager.Manager object>

notices.views module

notices.views.notice(request)
Parameters:request (HTTPRequest) – carries request info

-> All the notices from the database are paginated with 8 notice objects in a page. -> Page number is specified as the query parameter, notices?page=4. -> If page number is not given, default is 1. -> All the notices of the specified page number is passed to notices-list.html.

Returns:renders notices-list.html with all the notices of specified page number
notices.views.single_notice(request, heading)
Parameters:
  • request (HTTPRequest) – carries request info
  • heading (string) – heading/title of notice
Returns:

renders notice.html with notice of given heading