Module polls.models

Classes

class Choice (*args, **kwargs)

回答の選択肢のクラス。

Ancestors

  • django.db.models.base.Model
  • django.db.models.utils.AltersData

Class variables

var DoesNotExist

The requested object does not exist

var MultipleObjectsReturned

The query returned multiple objects when only one was expected.

var NotUpdated

The updated object no longer exists.

var objects

The type of the None singleton.

Instance variables

var choice_text : str

str: 選択肢の文言。

var id

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

var question

選択肢に関連する質問。

var question_id
var votes

int: 選択肢に対する投票数。

class Question (*args, **kwargs)

質問クラス。

Ancestors

  • django.db.models.base.Model
  • django.db.models.utils.AltersData

Class variables

var DoesNotExist

The requested object does not exist

var MultipleObjectsReturned

The query returned multiple objects when only one was expected.

var NotUpdated

The updated object no longer exists.

var objects

The type of the None singleton.

Instance variables

var choice_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example::

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_reverse_many_to_one_manager() defined below.

var id

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

var pub_date

質問の公開日

var question_text : str

質問内容

Methods

def get_next_by_pub_date(self,
*,
field=<django.db.models.fields.DateTimeField: pub_date>,
is_next=True,
**kwargs)
def get_previous_by_pub_date(self,
*,
field=<django.db.models.fields.DateTimeField: pub_date>,
is_next=False,
**kwargs)
def was_published_recently(self)

質問の公開日が過去1日以内かを判定する。

Returns

boolean
質問の公開日が過去1日いないの場合はTrue、そうでない

場合はFalseを返す。