diff --git a/djangoproject/core/migrations/0064_auto__add_field_actionlog_payment.py b/djangoproject/core/migrations/0064_auto__add_field_actionlog_payment.py new file mode 100644 index 00000000..ba37f05a --- /dev/null +++ b/djangoproject/core/migrations/0064_auto__add_field_actionlog_payment.py @@ -0,0 +1,255 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'ActionLog.payment' + db.add_column('core_actionlog', 'payment', + self.gf('django.db.models.fields.related.ForeignKey')(to=orm['core.Payment'], null=True), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'ActionLog.payment' + db.delete_column('core_actionlog', 'payment_id') + + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + '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', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'bitcoin_frespo.moneysent': { + 'Meta': {'object_name': 'MoneySent'}, + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'from_address': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastChangeDate': ('django.db.models.fields.DateTimeField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'to_address': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'transaction_hash': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '16', 'decimal_places': '8'}) + }, + 'bitcoin_frespo.receiveaddress': { + 'Meta': {'object_name': 'ReceiveAddress'}, + 'address': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + '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'}), + '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'}) + }, + 'core.actionlog': { + 'Meta': {'object_name': 'ActionLog'}, + 'action': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'entity': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']", 'null': 'True'}), + 'issue_comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.IssueComment']", 'null': 'True'}), + 'new_json': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Offer']", 'null': 'True'}), + 'old_json': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'payment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Payment']", 'null': 'True'}), + 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Project']", 'null': 'True'}), + 'solution': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Solution']", 'null': 'True'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}) + }, + 'core.issue': { + 'Meta': {'object_name': 'Issue'}, + 'createdByUser': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_feedback': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_public_suggestion': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Project']", 'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '400'}), + 'trackerURL': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'trackerURL_noprotocol': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'updatedDate': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}) + }, + 'core.issuecomment': { + 'Meta': {'object_name': 'IssueComment'}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']"}) + }, + 'core.issuecommenthistevent': { + 'Meta': {'object_name': 'IssueCommentHistEvent'}, + 'comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.IssueComment']"}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'event': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'eventDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + 'core.offer': { + 'Meta': {'object_name': 'Offer'}, + 'acceptanceCriteria': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'currency': ('django.db.models.fields.CharField', [], {'max_length': '10'}), + 'expirationDate': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']"}), + 'lastChangeDate': ('django.db.models.fields.DateTimeField', [], {}), + 'no_forking': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '9', 'decimal_places': '2'}), + 'require_release': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'sponsor': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'core.offercomment': { + 'Meta': {'object_name': 'OfferComment'}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Offer']"}) + }, + 'core.offercommenthistevent': { + 'Meta': {'object_name': 'OfferCommentHistEvent'}, + 'comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.OfferComment']"}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'event': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'eventDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + 'core.payment': { + 'Meta': {'object_name': 'Payment'}, + 'bitcoin_fee': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '16', 'decimal_places': '8'}), + 'bitcoin_receive_address': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bitcoin_frespo.ReceiveAddress']", 'null': 'True'}), + 'bitcoin_transaction_hash': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'confirm_key': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'currency': ('django.db.models.fields.CharField', [], {'max_length': '10'}), + 'fee': ('django.db.models.fields.DecimalField', [], {'max_digits': '16', 'decimal_places': '8'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastChangeDate': ('django.db.models.fields.DateTimeField', [], {}), + 'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Offer']"}), + 'offer2payment_suggested_rate': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '16', 'decimal_places': '8'}), + 'offer_currency': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True'}), + 'paykey': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'total': ('django.db.models.fields.DecimalField', [], {'max_digits': '16', 'decimal_places': '8'}), + 'total_bitcoin_received': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '16', 'decimal_places': '8'}), + 'usd2payment_rate': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '16', 'decimal_places': '8'}) + }, + 'core.paymenthistevent': { + 'Meta': {'object_name': 'PaymentHistEvent'}, + 'event': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'eventDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'payment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Payment']"}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'core.paymentpart': { + 'Meta': {'object_name': 'PaymentPart'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'money_sent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bitcoin_frespo.MoneySent']", 'null': 'True'}), + 'payment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Payment']"}), + 'paypalEmail': ('django.db.models.fields.EmailField', [], {'max_length': '256', 'null': 'True'}), + 'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '16', 'decimal_places': '8'}), + 'programmer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'solution': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Solution']"}) + }, + 'core.project': { + 'Meta': {'object_name': 'Project'}, + 'createdByUser': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'homeURL': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image3x1': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}), + 'trackerURL': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}) + }, + 'core.solution': { + 'Meta': {'object_name': 'Solution'}, + 'accepting_payments': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']"}), + 'lastChangeDate': ('django.db.models.fields.DateTimeField', [], {}), + 'programmer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'core.tag': { + 'Meta': {'object_name': 'Tag'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}), + 'objid': ('django.db.models.fields.IntegerField', [], {}), + 'objtype': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'core.userinfo': { + 'Meta': {'object_name': 'UserInfo'}, + 'about': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'bitcoin_receive_address': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}), + 'brazilianPaypal': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'hide_from_userlist': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_paypal_email_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_primary_email_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'paypalEmail': ('django.db.models.fields.EmailField', [], {'max_length': '256'}), + 'paypal_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'preferred_language_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'realName': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'receiveAllEmail': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_announcements': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_issue_comments': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_issue_offer': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_issue_payment': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_issue_work': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'screenName': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'website': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}) + }, + 'core.watch': { + 'Meta': {'object_name': 'Watch'}, + 'entity': ('django.db.models.fields.CharField', [], {'max_length': '60'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']", 'null': 'True'}), + 'objid': ('django.db.models.fields.IntegerField', [], {}), + 'reason': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + } + } + + complete_apps = ['core'] \ No newline at end of file diff --git a/djangoproject/core/migrations/0065_delete_pay_actionlogs.py b/djangoproject/core/migrations/0065_delete_pay_actionlogs.py new file mode 100644 index 00000000..8c731808 --- /dev/null +++ b/djangoproject/core/migrations/0065_delete_pay_actionlogs.py @@ -0,0 +1,249 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import DataMigration +from django.db import models + +class Migration(DataMigration): + + def forwards(self, orm): + orm.ActionLog.objects.filter(action='PAY').delete() + + def backwards(self, orm): + pass + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + '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', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'bitcoin_frespo.moneysent': { + 'Meta': {'object_name': 'MoneySent'}, + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'from_address': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastChangeDate': ('django.db.models.fields.DateTimeField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'to_address': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'transaction_hash': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '16', 'decimal_places': '8'}) + }, + 'bitcoin_frespo.receiveaddress': { + 'Meta': {'object_name': 'ReceiveAddress'}, + 'address': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + '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'}), + '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'}) + }, + 'core.actionlog': { + 'Meta': {'object_name': 'ActionLog'}, + 'action': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'entity': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']", 'null': 'True'}), + 'issue_comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.IssueComment']", 'null': 'True'}), + 'new_json': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Offer']", 'null': 'True'}), + 'old_json': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'payment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Payment']", 'null': 'True'}), + 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Project']", 'null': 'True'}), + 'solution': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Solution']", 'null': 'True'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}) + }, + 'core.issue': { + 'Meta': {'object_name': 'Issue'}, + 'createdByUser': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_feedback': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_public_suggestion': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Project']", 'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '400'}), + 'trackerURL': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'trackerURL_noprotocol': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'updatedDate': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}) + }, + 'core.issuecomment': { + 'Meta': {'object_name': 'IssueComment'}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']"}) + }, + 'core.issuecommenthistevent': { + 'Meta': {'object_name': 'IssueCommentHistEvent'}, + 'comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.IssueComment']"}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'event': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'eventDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + 'core.offer': { + 'Meta': {'object_name': 'Offer'}, + 'acceptanceCriteria': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'currency': ('django.db.models.fields.CharField', [], {'max_length': '10'}), + 'expirationDate': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']"}), + 'lastChangeDate': ('django.db.models.fields.DateTimeField', [], {}), + 'no_forking': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '9', 'decimal_places': '2'}), + 'require_release': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'sponsor': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'core.offercomment': { + 'Meta': {'object_name': 'OfferComment'}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Offer']"}) + }, + 'core.offercommenthistevent': { + 'Meta': {'object_name': 'OfferCommentHistEvent'}, + 'comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.OfferComment']"}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'event': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'eventDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + 'core.payment': { + 'Meta': {'object_name': 'Payment'}, + 'bitcoin_fee': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '16', 'decimal_places': '8'}), + 'bitcoin_receive_address': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bitcoin_frespo.ReceiveAddress']", 'null': 'True'}), + 'bitcoin_transaction_hash': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'confirm_key': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'currency': ('django.db.models.fields.CharField', [], {'max_length': '10'}), + 'fee': ('django.db.models.fields.DecimalField', [], {'max_digits': '16', 'decimal_places': '8'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastChangeDate': ('django.db.models.fields.DateTimeField', [], {}), + 'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Offer']"}), + 'offer2payment_suggested_rate': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '16', 'decimal_places': '8'}), + 'offer_currency': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True'}), + 'paykey': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'total': ('django.db.models.fields.DecimalField', [], {'max_digits': '16', 'decimal_places': '8'}), + 'total_bitcoin_received': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '16', 'decimal_places': '8'}), + 'usd2payment_rate': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '16', 'decimal_places': '8'}) + }, + 'core.paymenthistevent': { + 'Meta': {'object_name': 'PaymentHistEvent'}, + 'event': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'eventDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'payment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Payment']"}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'core.paymentpart': { + 'Meta': {'object_name': 'PaymentPart'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'money_sent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bitcoin_frespo.MoneySent']", 'null': 'True'}), + 'payment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Payment']"}), + 'paypalEmail': ('django.db.models.fields.EmailField', [], {'max_length': '256', 'null': 'True'}), + 'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '16', 'decimal_places': '8'}), + 'programmer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'solution': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Solution']"}) + }, + 'core.project': { + 'Meta': {'object_name': 'Project'}, + 'createdByUser': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'homeURL': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image3x1': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}), + 'trackerURL': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}) + }, + 'core.solution': { + 'Meta': {'object_name': 'Solution'}, + 'accepting_payments': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']"}), + 'lastChangeDate': ('django.db.models.fields.DateTimeField', [], {}), + 'programmer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'core.tag': { + 'Meta': {'object_name': 'Tag'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}), + 'objid': ('django.db.models.fields.IntegerField', [], {}), + 'objtype': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'core.userinfo': { + 'Meta': {'object_name': 'UserInfo'}, + 'about': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'bitcoin_receive_address': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}), + 'brazilianPaypal': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'hide_from_userlist': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_paypal_email_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_primary_email_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'paypalEmail': ('django.db.models.fields.EmailField', [], {'max_length': '256'}), + 'paypal_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'preferred_language_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'realName': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'receiveAllEmail': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_announcements': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_issue_comments': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_issue_offer': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_issue_payment': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_issue_work': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'screenName': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'website': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}) + }, + 'core.watch': { + 'Meta': {'object_name': 'Watch'}, + 'entity': ('django.db.models.fields.CharField', [], {'max_length': '60'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']", 'null': 'True'}), + 'objid': ('django.db.models.fields.IntegerField', [], {}), + 'reason': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + } + } + + complete_apps = ['core'] + symmetrical = True diff --git a/djangoproject/core/migrations/0066_populate_actionlog_pay.py b/djangoproject/core/migrations/0066_populate_actionlog_pay.py new file mode 100644 index 00000000..c46a2f2a --- /dev/null +++ b/djangoproject/core/migrations/0066_populate_actionlog_pay.py @@ -0,0 +1,295 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import DataMigration +from django.db import models +import json + +def getParts(payment, orm): + return orm.PaymentPart.objects.filter(payment=payment) + + +def part_to_dict_json(part): + return { + 'programmer_id': part.programmer.id, + 'solution_id': part.solution.id, + 'price': float(str(part.price)) if part.price else None, + } + + +def payment_to_json(payment, orm): + return json.dumps({ + 'id': payment.id, + 'status': payment.status, + 'fee': float(str(payment.fee)) if payment.fee else None, + 'total': float(str(payment.total)) if payment.total else None, + 'total_bitcoin_received': float(str(payment.total_bitcoin_received)) if payment.total_bitcoin_received else None, + 'bitcoin_fee': float(str(payment.bitcoin_fee)) if payment.bitcoin_fee else None, + 'offer2payment_suggested_rate': float(str(payment.offer2payment_suggested_rate)) if payment.offer2payment_suggested_rate else None, + 'usd2payment_rate': float(str(payment.usd2payment_rate)) if payment.usd2payment_rate else None, + 'currency': payment.currency, + 'bitcoin_transaction_hash': payment.bitcoin_transaction_hash, + 'offer_currency': payment.offer_currency, + 'parts': [part_to_dict_json(part) for part in getParts(payment, orm)] + }) + + +class Migration(DataMigration): + + def forwards(self, orm): + for payment in orm.Payment.objects.filter(status__in=['CONFIRMED_IPN', 'CONFIRMED_TRN']): + print('PAY: user(%s) paid offer(%s) - %s %s' % ( + payment.offer.sponsor.id, + payment.offer.id, + payment.currency, + payment.total, + )) + orm.ActionLog( + creationDate=payment.lastChangeDate, + action='PAY', + entity='PAYMENT', + project=payment.offer.issue.project, + issue=payment.offer.issue, + payment=payment, + new_json=payment_to_json(payment, orm), + user=payment.offer.sponsor, + ).save() + + def backwards(self, orm): + pass + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + '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', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'bitcoin_frespo.moneysent': { + 'Meta': {'object_name': 'MoneySent'}, + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'from_address': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastChangeDate': ('django.db.models.fields.DateTimeField', [], {}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'to_address': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'transaction_hash': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '16', 'decimal_places': '8'}) + }, + 'bitcoin_frespo.receiveaddress': { + 'Meta': {'object_name': 'ReceiveAddress'}, + 'address': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + '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'}), + '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'}) + }, + 'core.actionlog': { + 'Meta': {'object_name': 'ActionLog'}, + 'action': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'entity': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']", 'null': 'True'}), + 'issue_comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.IssueComment']", 'null': 'True'}), + 'new_json': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Offer']", 'null': 'True'}), + 'old_json': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'payment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Payment']", 'null': 'True'}), + 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Project']", 'null': 'True'}), + 'solution': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Solution']", 'null': 'True'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}) + }, + 'core.issue': { + 'Meta': {'object_name': 'Issue'}, + 'createdByUser': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_feedback': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_public_suggestion': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Project']", 'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '400'}), + 'trackerURL': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'trackerURL_noprotocol': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'updatedDate': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}) + }, + 'core.issuecomment': { + 'Meta': {'object_name': 'IssueComment'}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']"}) + }, + 'core.issuecommenthistevent': { + 'Meta': {'object_name': 'IssueCommentHistEvent'}, + 'comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.IssueComment']"}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'event': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'eventDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + 'core.offer': { + 'Meta': {'object_name': 'Offer'}, + 'acceptanceCriteria': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'currency': ('django.db.models.fields.CharField', [], {'max_length': '10'}), + 'expirationDate': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']"}), + 'lastChangeDate': ('django.db.models.fields.DateTimeField', [], {}), + 'no_forking': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '9', 'decimal_places': '2'}), + 'require_release': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'sponsor': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'core.offercomment': { + 'Meta': {'object_name': 'OfferComment'}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Offer']"}) + }, + 'core.offercommenthistevent': { + 'Meta': {'object_name': 'OfferCommentHistEvent'}, + 'comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.OfferComment']"}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'event': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'eventDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + 'core.payment': { + 'Meta': {'object_name': 'Payment'}, + 'bitcoin_fee': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '16', 'decimal_places': '8'}), + 'bitcoin_receive_address': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bitcoin_frespo.ReceiveAddress']", 'null': 'True'}), + 'bitcoin_transaction_hash': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}), + 'confirm_key': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'currency': ('django.db.models.fields.CharField', [], {'max_length': '10'}), + 'fee': ('django.db.models.fields.DecimalField', [], {'max_digits': '16', 'decimal_places': '8'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastChangeDate': ('django.db.models.fields.DateTimeField', [], {}), + 'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Offer']"}), + 'offer2payment_suggested_rate': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '16', 'decimal_places': '8'}), + 'offer_currency': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True'}), + 'paykey': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'total': ('django.db.models.fields.DecimalField', [], {'max_digits': '16', 'decimal_places': '8'}), + 'total_bitcoin_received': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '16', 'decimal_places': '8'}), + 'usd2payment_rate': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '16', 'decimal_places': '8'}) + }, + 'core.paymenthistevent': { + 'Meta': {'object_name': 'PaymentHistEvent'}, + 'event': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'eventDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'payment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Payment']"}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'core.paymentpart': { + 'Meta': {'object_name': 'PaymentPart'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'money_sent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bitcoin_frespo.MoneySent']", 'null': 'True'}), + 'payment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Payment']"}), + 'paypalEmail': ('django.db.models.fields.EmailField', [], {'max_length': '256', 'null': 'True'}), + 'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '16', 'decimal_places': '8'}), + 'programmer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'solution': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Solution']"}) + }, + 'core.project': { + 'Meta': {'object_name': 'Project'}, + 'createdByUser': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'homeURL': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image3x1': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}), + 'trackerURL': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}) + }, + 'core.solution': { + 'Meta': {'object_name': 'Solution'}, + 'accepting_payments': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'creationDate': ('django.db.models.fields.DateTimeField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']"}), + 'lastChangeDate': ('django.db.models.fields.DateTimeField', [], {}), + 'programmer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'core.tag': { + 'Meta': {'object_name': 'Tag'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}), + 'objid': ('django.db.models.fields.IntegerField', [], {}), + 'objtype': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + 'core.userinfo': { + 'Meta': {'object_name': 'UserInfo'}, + 'about': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'bitcoin_receive_address': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}), + 'brazilianPaypal': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'hide_from_userlist': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_paypal_email_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_primary_email_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'paypalEmail': ('django.db.models.fields.EmailField', [], {'max_length': '256'}), + 'paypal_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'preferred_language_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'realName': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'receiveAllEmail': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_announcements': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_issue_comments': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_issue_offer': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_issue_payment': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'receiveEmail_issue_work': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'screenName': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'website': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}) + }, + 'core.watch': { + 'Meta': {'object_name': 'Watch'}, + 'entity': ('django.db.models.fields.CharField', [], {'max_length': '60'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'issue': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Issue']", 'null': 'True'}), + 'objid': ('django.db.models.fields.IntegerField', [], {}), + 'reason': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + } + } + + complete_apps = ['core'] + symmetrical = True diff --git a/djangoproject/core/models.py b/djangoproject/core/models.py index 65d19bf1..c38e3c73 100644 --- a/djangoproject/core/models.py +++ b/djangoproject/core/models.py @@ -5,7 +5,7 @@ from datetime import timedelta from django.contrib.auth.models import User import hashlib, time, random -from core.utils.frespo_utils import get_or_none, strip_protocol +from core.utils.frespo_utils import get_or_none, strip_protocol, as_time_string from social_auth.models import UserSocialAuth from django.utils.http import urlquote from django.template.defaultfilters import slugify @@ -793,8 +793,9 @@ class Payment(models.Model): CONFIRMED_TRN_UNDERPAY = 'CONFIRMED_TRN_UNDERPAY' FORGOTTEN = 'FORGOTTEN' - def to_json(self): - return json.dumps({ + def to_dict_json(self): + return { + 'id': self.id, 'status': self.status, 'fee': float(str(self.fee)) if self.fee else None, 'total': float(str(self.total)) if self.total else None, @@ -806,7 +807,10 @@ def to_json(self): 'bitcoin_transaction_hash': self.bitcoin_transaction_hash, 'offer_currency': self.offer_currency, 'parts': [part.to_dict_json() for part in self.getParts()] - }) + } + + def to_json(self): + return json.dumps(self.to_dict_json()) @classmethod def newPayment(cls, offer, currency): @@ -929,9 +933,10 @@ class PaymentPart(models.Model): def to_dict_json(self): return { + 'id': self.id, 'programmer_id': self.programmer.id, 'programmer_image': self.programmer.gravatar_url_small(), - 'programmer_screenname': self.programmer.getUserInfo().screenname, + 'programmer_screenname': self.programmer.getUserInfo().screenName, 'solution_id': self.solution.id, 'price': float(str(self.price)) if self.price else None, } @@ -959,6 +964,7 @@ class ActionLog(models.Model): issue = models.ForeignKey(Issue, null=True) offer = models.ForeignKey(Offer, null=True) solution = models.ForeignKey(Solution, null=True) + payment = models.ForeignKey(Payment, null=True) issue_comment = models.ForeignKey(IssueComment, null=True) EDIT_ISSUE = 'EDIT_ISSUE' @@ -979,6 +985,8 @@ class ActionLog(models.Model): def to_dict_json(self): return { 'id': self.id, + 'creationDate': str(self.creationDate), + 'when': as_time_string(self.creationDate), 'action': self.action, 'entity': self.entity, # 'creationDate': self.id, @@ -991,6 +999,8 @@ def to_dict_json(self): 'issue': self.issue.to_dict_json() if self.issue else None, 'offer_id': self.offer.id if self.offer else None, 'offer': self.offer.to_dict_json() if self.offer else None, + 'payment_id': self.payment.id if self.payment else None, + 'payment': self.payment.to_dict_json() if self.payment else None, 'solution_id': self.solution.id if self.solution else None, 'issue_comment_id': self.issue_comment.id if self.issue_comment else None, 'old_json': self.old_json, @@ -1173,6 +1183,7 @@ def log_pay(cls, payment): entity='PAYMENT', project=payment.offer.issue.project, issue=payment.offer.issue, + payment=payment, new_json=payment.to_json(), user=payment.offer.sponsor, ).save() diff --git a/djangoproject/core/utils/frespo_utils.py b/djangoproject/core/utils/frespo_utils.py index 80682ea8..3d70685c 100644 --- a/djangoproject/core/utils/frespo_utils.py +++ b/djangoproject/core/utils/frespo_utils.py @@ -1,5 +1,6 @@ from decimal import Decimal -from urlparse import urlparse +from datetime import timedelta +from django.utils import timezone _TWOPLACES = Decimal(10) ** -2 @@ -25,4 +26,27 @@ def strip_protocol(url): elif url.startswith('https://'): return url[8:] else: - return url \ No newline at end of file + return url + + +def as_time_string(date): + delta = timezone.now() - date + five_secs = timedelta(seconds=5) + one_minute = timedelta(seconds=60) + one_hour = timedelta(hours=1) + one_day = timedelta(days=1) + one_month = timedelta(days=30) + if delta < five_secs: + return 'just now' + elif delta < one_minute: + return '%s seconds ago' % delta.seconds + elif delta < one_hour: + m = int(delta.seconds / 60) + return '%s minutes ago' % m + elif delta < one_day: + h = int(delta.seconds / 3600) + return '%s hours ago' % h + elif delta < one_month: + return '%s days ago' % delta.days + else: + return date.strftime('on %Y/%m/%d') \ No newline at end of file diff --git a/djangoproject/statfiles/static/js/activitylist/activitylist.html b/djangoproject/statfiles/static/js/activitylist/activitylist.html index 8e5ceaa8..fac11ae4 100644 --- a/djangoproject/statfiles/static/js/activitylist/activitylist.html +++ b/djangoproject/statfiles/static/js/activitylist/activitylist.html @@ -2,69 +2,69 @@