Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Python by registered user vlad_areva ( 9 years ago )
class Station:
    name = models.CharField()


class TransportNode:
    start_point = models.ForeignKey(Station)
    end_point = models.ForeignKey(Station)
    # some meta fields e.g. price_coefficient, time and others
    price = models.DecimalField()
    weight = models.FloatField()


class Route:
    name = models.CharField()
    transport_nodes = models.ManyToManyField(TransportNode)


class Train:
    name = models.CharField()
    route = models.ForeignKey(Route)
    price_coefficient = models.DecimalField()


class Place:
    train = models.ForeignKey(Train)
    place_type = models.ForeignKey(PlaceType)


class PlaceType:
    name = models.CharField()
    price_coefficient = models.DecimalField()


class Ticket:
    place = models.ForeignKey(Place)
    user = models.ForeignKey('User')
    transaction = models.ForeignKey(Transaction)


class Balance:
    user = models.ForeignKey('User')
    balance = models.DecimalField


class Transaction:
    user = models.ForeignKey('User')

 

Revise this Paste

Parent: 87373
Your Name: Code Language: