Commit 94cb4bea authored by Jean Michel Rouly's avatar Jean Michel Rouly
Browse files

Added bid app.

parent 257b6041
from django.contrib import admin
from bids.models import Bid
# Register your models here.
admin.site.register(Bid)
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Bid'
db.create_table(u'bids_bid', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('bidder', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['website.Seller'])),
('listing', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['website.Listing'])),
('date_created', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 12, 16, 0, 0))),
('price', self.gf('django.db.models.fields.IntegerField')()),
('text', self.gf('django.db.models.fields.CharField')(max_length=1000, blank=True)),
))
db.send_create_signal(u'bids', ['Bid'])
def backwards(self, orm):
# Deleting model 'Bid'
db.delete_table(u'bids_bid')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'bids.bid': {
'Meta': {'ordering': "['date_created']", 'object_name': 'Bid'},
'bidder': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['website.Seller']"}),
'date_created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 16, 0, 0)'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'listing': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['website.Listing']"}),
'price': ('django.db.models.fields.IntegerField', [], {}),
'text': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'blank': 'True'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'website.listing': {
'ISBN': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
'Meta': {'ordering': "['sold', '-ISBN']", 'object_name': 'Listing'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'author': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'book_condition': ('django.db.models.fields.CharField', [], {'default': "'Good'", 'max_length': '20'}),
'date_created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 16, 0, 0)'}),
'date_sold': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'edition': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'finalPrice': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'photo': ('django.db.models.fields.files.ImageField', [], {'max_length': '1000'}),
'price': ('django.db.models.fields.IntegerField', [], {}),
'seller': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['website.Seller']"}),
'sold': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
},
u'website.seller': {
'Meta': {'object_name': 'Seller'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'rating': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True'})
}
}
complete_apps = ['bids']
\ No newline at end of file
from django.db import models
from django.utils import timezone
from website.models import Seller, Listing
# Create your models here.
class Bid( models.Model ):
bidder = models.ForeignKey(Seller)
listing = models.ForeignKey(Listing)
date_created = models.DateTimeField( default=timezone.now() )
price = models.IntegerField()
text = models.CharField( blank=True, max_length = 1000 )
def __unicode__(self):
return '%s on %s\'s %s' % (self.bidder,
self.listing.seller,
self.listing)
class Meta:
ordering = ['date_created']
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment