示例#1
0
 def _ensure_required_fields(cls):
     """
     Every ``Group`` model requires a foreign key to the ``Subsession``
     model of the same app.
     """
     subsession_model = '{app_label}.Subsession'.format(
         app_label=cls._meta.app_label)
     subsession_field = models.ForeignKey(subsession_model)
     ensure_field(cls, 'subsession', subsession_field)
示例#2
0
    def _ensure_required_fields(cls):
        """
        Every ``Group`` model requires a foreign key to the ``Subsession``
        model of the same app.
        """
        subsession_model = '{app_label}.Subsession'.format(
            app_label=cls._meta.app_label)
        subsession_field = djmodels.ForeignKey(subsession_model,
                                               on_delete=models.CASCADE)
        ensure_field(cls, 'subsession', subsession_field)

        add_field_tracker(cls)
示例#3
0
    def _ensure_required_fields(cls):
        """
        Every ``Player`` model requires a foreign key to the ``Subsession`` and
        ``Group`` model of the same app.
        """
        subsession_model = '{app_label}.Subsession'.format(
            app_label=cls._meta.app_label)
        subsession_field = models.ForeignKey(subsession_model)
        ensure_field(cls, 'subsession', subsession_field)

        group_model = '{app_label}.Group'.format(app_label=cls._meta.app_label)
        group_field = models.ForeignKey(group_model, null=True)
        ensure_field(cls, 'group', group_field)
示例#4
0
    def _ensure_required_fields(cls):
        """
        Every ``Player`` model requires a foreign key to the ``Subsession`` and
        ``Group`` model of the same app.
        """
        subsession_model = '{app_label}.Subsession'.format(
            app_label=cls._meta.app_label)
        subsession_field = models.ForeignKey(subsession_model)
        ensure_field(cls, 'subsession', subsession_field)

        group_model = '{app_label}.Group'.format(
            app_label=cls._meta.app_label)
        group_field = models.ForeignKey(group_model, null=True)
        ensure_field(cls, 'group', group_field)