+class PokemonForm(TableBase):
+ u"""An individual form of a Pokémon.
+
+ Pokémon that do not have separate forms are still given a single row to
+ represent their single form.
+ """
+ __tablename__ = 'pokemon_forms'
+ __singlename__ = 'pokemon_form'
+ id = Column(Integer, primary_key=True, nullable=False,
+ info=dict(description=u'A unique ID for this form.'))
+ name = Column(Unicode(16), nullable=True,
+ info=dict(description=u"This form's name, e.g. \"Plant\" for Plant Cloak Burmy.", official=True, format='plaintext'))
+ form_base_pokemon_id = Column(Integer, ForeignKey('pokemon.id'), nullable=False, autoincrement=False,
+ info=dict(description=u'The ID of the base Pokémon for this form.'))
+ unique_pokemon_id = Column(Integer, ForeignKey('pokemon.id'), autoincrement=False,
+ info=dict(description=u'The ID of a Pokémon that represents specifically this form, for Pokémon with functionally-different forms like Wormadam.'))
+ introduced_in_version_group_id = Column(Integer, ForeignKey('version_groups.id'), autoincrement=False,
+ info=dict(description=u'The ID of the version group in which this form first appeared.'))
+ is_default = Column(Boolean, nullable=False,
+ info=dict(description=u'Set for exactly one form used as the default for each species.'))
+ order = Column(Integer, nullable=False, autoincrement=False,
+ info=dict(description=u'The order in which forms should be sorted. Multiple forms may have equal order, in which case they should fall back on sorting by name.'))
+
+ @property
+ def full_name(self):
+ u"""Returns the full name of this form, e.g. "Plant Cloak"."""
+
+ if not self.name:
+ return None
+ elif self.form_group and self.form_group.term:
+ return '{0} {1}'.format(self.name, self.form_group.term)
+ else:
+ return self.name
+
+ @property
+ def pokemon_name(self):
+ u"""Returns the name of this Pokémon with this form, e.g. "Plant
+ Burmy".
+ """
+
+ if self.name:
+ return '{0} {1}'.format(self.name, self.form_base_pokemon.name)
+ else:
+ return self.form_base_pokemon.name
+