Пример #1
0
class OpenCallFeedback(db.Entity):
    id = PrimaryKey(int, auto=True)
    text = Required(str)
    user = Required('User')
    opencall = Required('OpenCall')
    created_at = Required(datetime.datetime, default=datetime.datetime.utcnow)

    @db_session
    def to_dict(self):
        return {
            'id': self.id,
            'user': self.user.id,
            'opencall': self.opencall.id,
            'text': self.text,
            'created_at': self.created_at.isoformat()
        }
Пример #2
0
    class Conditions(db.Entity, UserMixin):
        _table_ = '%s_conditions' % schema if DEBUG else (schema, 'conditions')
        id = PrimaryKey(int, auto=True)
        date = Required(datetime)
        user_id = Required(int)
        data = Required(Json)
        reaction = Required('Reaction')

        def __init__(self, data, reaction, user, date=None):
            if date is None:
                date = datetime.utcnow()
            db.Entity.__init__(self,
                               user_id=user.id,
                               date=date,
                               reaction=reaction,
                               data=data)
Пример #3
0
    class Task(db.Entity):
        _table_ = '%s_task' % schema if DEBUG else (schema, 'task')
        id = PrimaryKey(int, auto=True)
        task = Required(str, unique=True, sql_type='CHARACTER(36)')
        date = Required(datetime, default=datetime.utcnow)
        _type = Required(int, column='type')
        user = Required('User')
        data = Required(Json, lazy=True)

        def __init__(self, data, **kwargs):
            _type = kwargs.pop('type', TaskType.MODELING).value
            super().__init__(_type=_type, data=data, **kwargs)

        @property
        def type(self):
            return TaskType(self._type)
Пример #4
0
class Switcharoo(db.Entity):
    id = PrimaryKey(int, auto=True)
    time = Required(datetime)
    submission_id = Optional(str, unique=True, nullable=True)
    thread_id = Optional(str)
    comment_id = Optional(str)
    context = Optional(int)
    link_post = Required(bool)
    user = Optional(str, max_len=21)
    subreddit = Optional(str, max_len=21)
    issues = Set('Issues')
    requests = Optional('FixRequests', cascade_delete=True)

    def _link_reddit(self, reddit):
        self.reddit = reddit
        self._submission = None
        self._comment = None

    @property
    def submission(self):
        if not self.submission_id:
            return None
        if not self._submission:
            self._submission = self.reddit.submission(self.submission_id)
        return self._submission

    @property
    def comment(self):
        if not self.comment_id:
            return None
        if not self._comment:
            self._comment = self.reddit.comment(self.comment_id)
        return self._comment

    def print(self):
        try:
            if self.submission_id:
                print(
                    f"Roo {self.id}: {self.submission.title} by {self.submission.author}"
                    f" {datetime.fromtimestamp(self.submission.created_utc)}")
            else:
                print(
                    f"Roo {self.id}: {self.comment.author if self.comment.author else ''}"
                    f" {datetime.fromtimestamp(self.comment.created_utc if self.comment.author else '')}"
                )
        except praw.exceptions.ClientException:
            print(f"Roo {self.id}")
Пример #5
0
class User(db.Entity):
    _table_ = 'user'

    id = PrimaryKey(int, auto=True)
    uid = Required(uuid.UUID, default=uuid.uuid1, unique=True, index=True)
    create_at = Required(datetime.datetime,
                         default=datetime.datetime.utcnow(),
                         index=True)
    update_at = Required(datetime.datetime,
                         default=datetime.datetime.utcnow(),
                         index=True)
    delete_at = Optional(datetime.datetime, nullable=True)
    username = Required(str)
    password = Required(str)
    info = Optional(str)

    @classmethod
    @db_session
    def register(cls, username, password):
        obj = get(n for n in User if n.username == username)
        if obj:
            raise IsExist(title='此用户已经存在',
                          detail=f'用户名{username}已经存在',
                          type='LoginError')
        else:
            User(username=username, password=password)

    @classmethod
    @db_session
    def login(cls, username, password):
        obj = get(n for n in User
                  if n.username == username and n.password == password)
        if not obj:
            raise DefalutError(title=f'用户名密码不正确', detail=f'用户名密码不正确')
        return obj.uid

    @classmethod
    @db_session
    def user_is_valid(cls, username, uid):
        obj = get(n for n in User if n.username == username and n.uid == uid)
        if obj:
            return True
        else:
            raise DefalutError(title=f'token已失效',
                               detail=f'token已失效',
                               status=401,
                               type='AuthError')
Пример #6
0
class Task(db.Entity):
    def __str__(self):
        return self.title and (str(self.id) + ' ' + self.title + ' ' +
                               self.text + ' ' + str(self.status) + ' ' +
                               self.tags + ' ' + datetime_to_str(self.date))

    id = PrimaryKey(int, auto=True)
    creator = Required(int)
    title = Required(str)
    text = Required(str)
    status = Required(int)
    tags = Optional(str)
    date = Optional(datetime)
    parent_id = Optional(int)
    comment = Set('Comment', cascade_delete=True)
    periodic_task_id = Optional(int)
    users = Required(Json)
Пример #7
0
class Item(db.Entity):
    id = PrimaryKey(int, auto=True)
    signal = Optional(Signal)
    tags = Set(Tag)
    price_item = Optional('PriceItem')
    argument = Optional('Argument')
    data_item = Optional('DataItem')
    symbol = Optional(Symbol)

    def add_tags(self, tags):
        """Add multiple tags to item object

        Arguments:
            tags {list} -- list of Tags
        """
        for tag in tags:
            self.tags.add(tag)
Пример #8
0
    class Matiere(db.Entity, ColorMixin, PositionMixin):
        referent_attribute_name = "groupe"

        id = PrimaryKey(UUID, auto=True, default=uuid4)
        nom = Required(str)
        groupe = Required("GroupeMatiere")
        _position = Required(int)
        _fgColor = Required(int, size=32, unsigned=True, default=4278190080)
        _bgColor = Optional(int, size=32, unsigned=True, default=4294967295)
        activites = Set("Activite")

        def __init__(
            self, bgColor=None, fgColor=None, groupe=None, position=None, **kwargs
        ):
            kwargs = self.adjust_kwargs_color(bgColor, fgColor, kwargs)
            with self.init_position(position, groupe) as _position:
                super().__init__(groupe=groupe, _position=_position, **kwargs)

        def __repr__(self):
            return f"Matiere[{self.nom}]"

        @property
        def activites_list(self):
            return self.to_dict()["activites"]

        def to_dict(self):
            dico = super().to_dict(exclude=["_fgColor", "_bgColor", "_position"])
            dico.update(
                {
                    "id": str(self.id),
                    "groupe": str(self.groupe.id),
                    "fgColor": self.fgColor,
                    "bgColor": self.bgColor,
                    "position": self.position,
                    "activites": [
                        str(x.id) for x in self.activites.order_by(lambda x: x.position)
                    ],
                }
            )
            return dico

        def before_delete(self):
            self.before_delete_position()

        def after_delete(self):
            self.after_delete_position()
Пример #9
0
class Attribute(db.Entity):
    """Database attribute, linked to any object."""

    subset = Required(str)
    object_class = Required(str)
    object_id = Required(int)
    name = Required(str)
    PrimaryKey(subset, object_class, object_id, name)
    pickled = Required(bytes)

    @property
    def value(self):
        """Return the unpickled value."""
        return pickle.loads(self.pickled)

    def __repr__(self):
        return f"<Attribute {self.name!r}>"
Пример #10
0
class Session(PicklableEntity, db.Entity):
    """
    Session entity.

    A session is an object identifying a live connection.  Each time
    a user connects, a session is created with a different identifier
    (UUID).  Each time this connection is broken, the session is destroyed.
    Connections can store data (through the option handler and the
    attributes handler).

    Note: if a user connects to the portal, a session is created in the
    game database.  Should the connection remain live but the game be
    restarted, the connection is maintained and the session information
    is retrieved from the database.

    Web sessions, created by the webserver to keep persistent data,
    are stored in the WebSession entity (see web.session.WebSession).

    """

    uuid = PrimaryKey(UUID, default=uuid4)
    context_path = Required(str)
    account = Optional("Account")
    character = Optional("Character")
    binary_options = Required(bytes, default=pickle.dumps({}))

    @lazy_property
    def context(self):
        """Find the context."""
        Context = CONTEXTS[self.context_path]
        return Context(self)

    @context.setter
    def context(self, context):
        """Change the session's context."""
        self.context_path = context.pyname

    @property
    def focused_context(self):
        """Return the focused context."""
        # If there's a character, return the character's active context.
        if (character := self.character):
            return character.context_stack.active_context

        # Otherwise, return the session context
        return self.context
Пример #11
0
class Album(db.Entity):
    _table_ = "album"

    id = PrimaryKey(UUID, default=uuid4)
    name = Required(str)
    artist = Required(Artist, column="artist_id")
    tracks = Set(lambda: Track)

    stars = Set(lambda: StarredAlbum)

    def as_subsonic_album(self, user):
        info = dict(
            id=str(self.id),
            name=self.name,
            artist=self.artist.name,
            artistId=str(self.artist.id),
            songCount=self.tracks.count(),
            duration=sum(self.tracks.duration),
            created=min(self.tracks.created).isoformat(),
        )

        track_with_cover = self.tracks.select(
            lambda t: t.folder.cover_art is not None).first()
        if track_with_cover is not None:
            info["coverArt"] = str(track_with_cover.folder.id)
        else:
            track_with_cover = self.tracks.select(lambda t: t.has_art).first()
            if track_with_cover is not None:
                info["coverArt"] = str(track_with_cover.id)

        try:
            starred = StarredAlbum[user.id, self.id]
            info["starred"] = starred.date.isoformat()
        except ObjectNotFound:
            pass

        return info

    def sort_key(self):
        year = min(map(lambda t: t.year if t.year else 9999, self.tracks))
        return "%i%s" % (year, self.name.lower())

    @classmethod
    def prune(cls):
        return cls.select(lambda self: not exists(
            t for t in Track if t.album == self)).delete()
Пример #12
0
class Tag(db.Entity):
    YAO = 'yahoo'
    GOG = 'google'
    USD = 'USD'
    EUR = 'EUR'
    IDX = 'index'
    ICA = 'incomeanalysis'
    ICF = 'incomefacts'
    REC = 'recommendation'
    ICO = 'income'
    BLE = 'balance'
    CSH = 'cash'

    id = PrimaryKey(int, auto=True)
    name = Optional(str)
    items = Set('Item')
    type = Required('Type')
Пример #13
0
class WorkUnit(database.Entity):
    part_id = PrimaryKey(int, auto=True)
    batch_id = Required(int)
    timestamp = Required(datetime)
    tool_id = Required(str)
    cup_pressure = Required(float)
    lower_cup_pressure = Required(float)
    upper_cup_pressure = Required(float)
    air_pressure = Required(float)
    lower_air_pressure = Required(float)
    upper_air_pressure = Required(float)
    error = Optional("PressureError")

    @property
    def error_code(self) -> int:
        return 0 if self.lower_cup_pressure < self.cup_pressure < self.upper_cup_pressure else 1 + 0 \
            if self.lower_air_pressure < self.air_pressure < self.upper_air_pressure else 2
Пример #14
0
class Persoon(db.Entity):
    id = PrimaryKey(int, auto=True)
    naam = Required(str)
    geboortedatum = Required(date)
    cadeaus = Set('Cadeau')

    def __init__(self, naam, geboortedatum):
        self.naam = naam
        self.geboortedatum = geboortedatum

    def geef_cadeau(self, aanleiding: str, omschrijving: str) -> Cadeau:
        datum = datetime.today()
        cadeau = Cadeau(ontvanger=self,
                        aanleiding=aanleiding,
                        omschrijving=omschrijving,
                        datum=datum)
        return cadeau
Пример #15
0
class RadioStation(db.Entity):
    _table_ = "radio_station"

    id = PrimaryKey(UUID, default=uuid4)
    stream_url = Required(str)
    name = Required(str)
    homepage_url = Optional(str, nullable=True)
    created = Required(datetime, precision=0, default=now)

    def as_subsonic_station(self):
        info = dict(
            id=str(self.id),
            streamUrl=self.stream_url,
            name=self.name,
            homePageUrl=self.homepage_url,
        )
        return info
Пример #16
0
class IssueCaptureStaticSprint(db.Entity):
    """
    Capture Static Data for Sprint
    """
    _table_ = 'issue_capture_static_sprint'
    uuid = PrimaryKey(uuid.UUID, default=uuid.uuid4)
    capture_time = Required(datetime, default=datetime.now())
    sprint = Required(Sprint)
    in_rc = Required(Json, default={})
    found_since = Required(Json,
                           default={
                               "newfeature": 0,
                               "improve": 0,
                               "qamissed": 0,
                               "others": 0
                           })
    in_req = Required(Json, default={})
Пример #17
0
class User(db.Entity):
    id = PrimaryKey(int, auto=True)
    user_id = Required(int, size=64, unique=True)
    name = Required(str)
    roadblocks_count = Required(int, sql_default='0')
    admin = Required(bool, sql_default='FALSE')
    banned = Required(bool, sql_default='FALSE')
    subscribed = Required(bool, sql_default='FALSE')

    def is_subscribed(self) -> bool:
        return self.subscribed

    def is_admin(self) -> bool:
        return self.admin

    def is_banned(self) -> bool:
        return self.banned
Пример #18
0
 class Result(db.Entity):
     _table_ = '%s_result' % schema if DEBUG else (schema, 'result')
     id = PrimaryKey(int, auto=True)
     key = Required(str)
     model = Required('Model')
     result_type = Required(int)
     structure = Required('Structure')
     value = Required(str)
 
     def __init__(self, **kwargs):
         _type = kwargs.pop('type', ResultType.TEXT).value
         _model = db.Model[kwargs.pop('model')]
         super(Result, self).__init__(result_type=_type, model=_model, **kwargs)
 
     @property
     def type(self):
         return ResultType(self.result_type)
Пример #19
0
class Helper(db.Entity):
    phone = PrimaryKey(str)
    first_name = Required(str)
    last_name = Required(str)
    email = Required(str)
    lon = Required(float)
    lat = Required(float)
    zip_code = Required(str)
    location_name = Required(str)
    is_active = Required(bool)
    verified = Required(bool, default=False)
    last_called = Required(datetime.datetime, hidden=True)
    verify_code = Optional(str, nullable=True, hidden=True)

    def to_dict(self):
        return super(Helper,
                     self).to_dict(exclude=["last_called", "verify_code"])
Пример #20
0
    class BandwidthTransaction(db.Entity):
        """
        This class describes a bandwidth transaction that resides in the database.
        """
        sequence_number = Required(int)
        public_key_a = Required(bytes, index=True)
        public_key_b = Required(bytes, index=True)
        signature_a = Required(bytes)
        signature_b = Required(bytes)
        amount = Required(int, size=64)
        timestamp = Required(int, size=64)
        PrimaryKey(sequence_number, public_key_a, public_key_b)

        @classmethod
        @db_session(optimistic=False)
        def insert(cls, transaction: BandwidthTransaction) -> None:
            """
            Insert a BandwidthTransaction object in the database.
            Remove the last transaction with that specific counterparty while doing so.
            :param transaction: The transaction to insert in the database.
            """
            if not bandwidth_database.store_all_transactions:
                # Make sure to only store the latest pairwise transaction.
                for tx in cls.select(
                        lambda c: c.public_key_a == transaction.public_key_a
                        and c.public_key_b == transaction.public_key_b):
                    tx.delete()
                db.commit()
                cls(**transaction.get_db_kwargs())
            elif not bandwidth_database.has_transaction(transaction):
                # We store all transactions and it does not exist yet - insert it.
                cls(**transaction.get_db_kwargs())

            if transaction.public_key_a == bandwidth_database.my_pub_key or \
                    transaction.public_key_b == bandwidth_database.my_pub_key:
                # Update the balance history
                timestamp = int(round(time.time() * 1000))
                db.BandwidthHistory(
                    timestamp=timestamp,
                    balance=bandwidth_database.get_my_balance())
                num_entries = db.BandwidthHistory.select().count()
                if num_entries > bandwidth_database.MAX_HISTORY_ITEMS:
                    # Delete the entry with the lowest timestamp
                    entry = list(db.BandwidthHistory.select().order_by(
                        db.BandwidthHistory.timestamp))[0]
                    entry.delete()
Пример #21
0
class User(db.Entity):
    _table_ = "user"

    id = PrimaryKey(UUID, default=uuid4)
    name = Required(str, 64)  # unique
    mail = Optional(str)
    password = Required(str, 40)
    salt = Required(str, 6)
    admin = Required(bool, default=False)
    lastfm_session = Optional(str, 32, nullable=True)
    lastfm_status = Required(
        bool, default=True)  # True: ok/unlinked, False: invalid session

    last_play = Optional(Track, column="last_play_id")
    last_play_date = Optional(datetime, precision=0)

    clients = Set(lambda: ClientPrefs)
    playlists = Set(lambda: Playlist)
    __messages = Set(lambda: ChatMessage, lazy=True)  # Never used, hide it

    starred_folders = Set(lambda: StarredFolder, lazy=True)
    starred_artists = Set(lambda: StarredArtist, lazy=True)
    starred_albums = Set(lambda: StarredAlbum, lazy=True)
    starred_tracks = Set(lambda: StarredTrack, lazy=True)
    folder_ratings = Set(lambda: RatingFolder, lazy=True)
    track_ratings = Set(lambda: RatingTrack, lazy=True)

    def as_subsonic_user(self):
        return dict(
            username=self.name,
            email=self.mail,
            scrobblingEnabled=self.lastfm_session is not None
            and self.lastfm_status,
            adminRole=self.admin,
            settingsRole=True,
            downloadRole=True,
            uploadRole=False,
            playlistRole=True,
            coverArtRole=False,
            commentRole=False,
            podcastRole=False,
            streamRole=True,
            jukeboxRole=False,
            shareRole=False,
        )
Пример #22
0
class Conversation(db.Entity):
    """
    https://api.slack.com/types/conversation
    """
    id = PrimaryKey(str, auto=False)
    name = Optional(str)
    normalized_name = Optional(str)
    purpose = Optional(str)
    is_channel = Optional(bool)
    is_im = Optional(bool)
    is_archived = Optional(bool)
    is_general = Optional(bool)
    is_shared = Optional(bool)
    is_member = Optional(bool)
    is_private = Optional(bool)
    is_mpim = Optional(bool)
    created = Required(int)
    scanned_ranges = Optional(Json, default=[])
    messages_processed = Required(int)
    reached_end = Required(bool, default=False)
    latest_ts = Optional(str)
    reached_now = Optional(bool, default=False)

    @staticmethod
    def from_dict(convo):
        Conversation(
            id=convo.get('id'),
            name=convo.get('name', 'N/A'),
            normalized_name=convo.get('normalized_name', 'N/A'),
            purpose=convo.get('purpose', {}).get('value', ''),
            is_channel=convo.get('is_channel', False),
            is_im=convo.get('is_im', False),
            is_archived=convo.get('is_archived', False),
            is_general=convo.get('is_general', False),
            is_shared=convo.get('is_shared', False),
            is_member=convo.get('is_member', False),
            is_private=convo.get('is_private', False),
            is_mpim=convo.get('pyis_mpim', False),
            created=int(convo.get('created')),
            scanned_ranges=convo.get('scanned_ranges', []),
            messages_processed=int(convo.get('messages_processed', 0)),
            reached_end=convo.get('reached_end', False),
            reached_now=convo.get('reached_now', False),
            latest_ts=convo.get('latest_ts', '')
        )
class Course(db.Entity):
    """
    A class to represent a course
    """
    id = PrimaryKey(int, auto=False)
    title = Required(str, unique=True)
    url = Optional(str, unique=True)
    thumbnail = Optional(str)
    processed = Optional(bool, default=False)

    @staticmethod
    @db_session
    def new(id, title, url='', thumbnail='', processed=False):
        """Return a Course either new or from database"""
        course = select(c for c in Course if c.title == title)[:]
        if course:
            return course[0]
        return Course(id=id, title=title, url=url, thumbnail=thumbnail, processed=processed)

    @staticmethod
    @db_session
    def is_course_new(course):
        """
        Check if the course is new or already in db
        """
        return not course.processed

    @staticmethod
    @db_session
    def add_course(course):
        """Add a course to the database"""
        course.processed = True
        commit()

    @staticmethod
    @db_session
    def count():
        """Get total courses in the database"""
        return len(select(c for c in Course)[:])

    @staticmethod
    @db_session
    def delete_all():
        """Delete all information from the table"""
        delete(c for c in Course)
Пример #24
0
class Flows(flows.get_database().Entity):
    _table_ = "flows"
    id = PrimaryKey(int, auto=True)
    in_port = Optional(str, nullable=True)
    eth_dst = Optional(str, nullable=True)
    eth_src = Optional(str, nullable=True)
    eth_type = Optional(str, nullable=True)
    ipv6_src = Optional(str, nullable=True)
    ipv6_dst = Optional(str, nullable=True)
    layer4_protocol = Optional(str, nullable=True)
    tcp_src = Optional(str, nullable=True)
    tcp_dst = Optional(str, nullable=True)
    udp_src = Optional(str, nullable=True)
    udp_dst = Optional(str, nullable=True)
    icmpv6_type = Optional(str, nullable=True)
    icmpv6_code = Optional(str, nullable=True)
    action = Optional(str, nullable=True)
    expiration_time = Optional(datetime, 6)
Пример #25
0
 class Document(_db.Entity):
     id = PrimaryKey(int, auto=True)
     html = Optional(str)
     brand = Optional(str)
     gtin13 = Optional(str)
     ean = Optional(str)
     asin = Optional(str)
     sku = Optional(str)
     price = Optional(float)
     currency = Optional(str)
     vendor = Optional(str)
     language = Optional(str)
     tokens = Optional(bytes)
     brand_bio_labels = Optional(bytes)
     ean_bio_labels = Optional(bytes)
     windows_5 = Optional(bytes)
     windows_11 = Optional(bytes)
     windows_21 = Optional(bytes)
Пример #26
0
Файл: db.py Проект: alin23/spfy
class SpotifyUser(db.Entity):
    _table_ = "spotify_users"
    id = PrimaryKey(str)  # pylint: disable=redefined-builtin
    name = Optional(str, sql_default="''")
    user = Optional("User")
    playlists = Set("Playlist")

    @property
    def uri(self):
        return f"spotify:user:{self.id}"

    @property
    def href(self):
        return f"https://api.spotify.com/v1/users/{self.id}"

    @property
    def external_url(self):
        return f"http://open.spotify.com/user/{self.id}"
Пример #27
0
class MediaFile(db.Entity):
    """Class containing a media-file."""

    id = PrimaryKey(int, auto=True)
    """Unique id."""
    type = Required(str)
    """File type, e.g. "mp3", "jpg", "png", etc. ..."""
    field_key = Required(str)
    """Name of the field of the card which the content belongs to."""
    content = Required(buffer)
    """Bytes object with media-file."""
    card = Required(Card)
    """Relation to :class:`Card` object."""
    @db_session
    def update(self, **kwargs):
        """Update attributes by ``*kwargs``."""
        for key, val in kwargs.items():
            setattr(self, key, val)
Пример #28
0
class PrivatedSubs(db.Entity):
    subreddit = PrimaryKey(str, max_len=21)
    allowed = Optional(bool)
    expiration = Optional(datetime)
    update_requested = Required(bool)

    def is_expired(self):
        if self.expiration:
            return datetime.now() > self.expiration
        else:
            # If this has no expiration set, it never expires
            return False

    def reset(self):
        with db_session:
            p = PrivatedSubs[self.subreddit]
            p.delete()
        return None
Пример #29
0
    class Model(db.Entity):
        _table_ = '%s_model' % schema if DEBUG else (schema, 'model')
        id = PrimaryKey(int, auto=True)
        description = Optional(str)
        destinations = Set('Destination')
        example = Optional(str)
        model_type = Required(int)
        name = Required(str, unique=True)
        results = Set('Result')

        def __init__(self, **kwargs):
            _type = kwargs.pop('type', ModelType.MOLECULE_MODELING).value
            super(Model, self).__init__(model_type=_type,
                                        **filter_kwargs(kwargs))

        @property
        def type(self):
            return ModelType(self.model_type)
Пример #30
0
class Otazka(db.Entity):
    """Obecná otázka:
    * V obecne_zadani se dá specifikovat rozsah náhodného čísla.
    * typ_otazky: Otevřená, Uzavřená, Hodnota, Vzorec"""
    _table_ = "otazka"
    id = PrimaryKey(int, column="id_otazka", auto=True)
    ucitel = Required("Ucitel")
    jmeno = Required(unicode, 80)
    typ_otazky = Required(str, 1, sql_type="char")
    obecne_zadani = Required(unicode)
    spravna_odpoved = Optional(unicode, 512)
    spatna_odpoved1 = Optional(unicode, 512)
    spatna_odpoved2 = Optional(unicode, 512)
    spatna_odpoved3 = Optional(unicode, 512)
    spatna_odpoved4 = Optional(unicode, 512)
    spatna_odpoved5 = Optional(unicode, 512)
    spatna_odpoved6 = Optional(unicode, 512)
    otazky_testuu = Set("Otazka_testu")