From dc756440d92c7480ccfdeb71dc69bb4890134d92 Mon Sep 17 00:00:00 2001 From: alonisser Date: Mon, 31 Oct 2016 01:58:35 +0200 Subject: [PATCH] Adding missing blank to some fields, allowing admin to work, adding admin for protocol parts, optmizing admin parts count --- committees/admin.py | 21 +- ...dy__chg_field_protocolpart_header__chg_.py | 303 ++++++++++++++++++ committees/models.py | 12 +- 3 files changed, 326 insertions(+), 10 deletions(-) create mode 100644 committees/migrations/0024_auto__chg_field_protocolpart_body__chg_field_protocolpart_header__chg_.py diff --git a/committees/admin.py b/committees/admin.py index 9d316baa..2d848fe1 100644 --- a/committees/admin.py +++ b/committees/admin.py @@ -1,11 +1,11 @@ from django.contrib.contenttypes import generic from django.contrib.contenttypes.generic import GenericTabularInline -from django.db.models import Q +from django.db.models import Q, Count from django.contrib import admin from import_export.admin import ImportExportModelAdmin from video.models import Video -from models import Committee, CommitteeMeeting, Topic +from models import Committee, CommitteeMeeting, Topic, ProtocolPart from links.models import Link from django.utils.translation import ugettext_lazy as _ from mks.utils import get_all_mk_names @@ -78,7 +78,7 @@ def queryset(self, request, queryset): class CommitteeMeetingAdmin(ImportExportModelAdmin): ordering = ('-date',) - list_display = ('__unicode__', 'date', 'committee_type', 'protocol_parts') + list_display = ('id', '__unicode__', 'date', 'committee_type', 'protocol_parts') list_filter = ('committee', 'committee__type', MissingProtocolListFilter) search_fields = ['id', 'topics'] actions = ['redownload_and_reparse_protocol', 'reparse_protocol', 'update_metadata_from_dataservice'] @@ -87,7 +87,11 @@ def committee_type(self, obj): return obj.committee.type def protocol_parts(self, obj): - return obj.parts.all().count() + return obj.num_parts + + def get_queryset(self, request): + qs = super(CommitteeMeetingAdmin, self).get_queryset(request) + return qs.annotate(num_parts=Count('parts')) def redownload_and_reparse_protocol(self, request, qs): mks, mk_names = get_all_mk_names() @@ -106,9 +110,18 @@ def update_metadata_from_dataservice(self, request, qs): [cm.update_from_dataservice() for cm in qs] self.message_user(request, "successfully updated %s meetings" % qs.count()) + admin.site.register(CommitteeMeeting, CommitteeMeetingAdmin) +class ProtocolPartsAdmin(ImportExportModelAdmin): + search_fields = ('id', 'meeting__pk', 'header', 'body') + list_display = ('id', 'meeting', 'header') + + +admin.site.register(ProtocolPart, ProtocolPartsAdmin) + + class LinksTable(GenericTabularInline): model = Link ct_field = 'content_type' diff --git a/committees/migrations/0024_auto__chg_field_protocolpart_body__chg_field_protocolpart_header__chg_.py b/committees/migrations/0024_auto__chg_field_protocolpart_body__chg_field_protocolpart_header__chg_.py new file mode 100644 index 00000000..bcaf784a --- /dev/null +++ b/committees/migrations/0024_auto__chg_field_protocolpart_body__chg_field_protocolpart_header__chg_.py @@ -0,0 +1,303 @@ +# -*- 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): + + # Changing field 'ProtocolPart.body' + db.alter_column(u'committees_protocolpart', 'body', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'ProtocolPart.header' + db.alter_column(u'committees_protocolpart', 'header', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'ProtocolPart.type' + db.alter_column(u'committees_protocolpart', 'type', self.gf('django.db.models.fields.TextField')(max_length=20, null=True)) + + def backwards(self, orm): + + # Changing field 'ProtocolPart.body' + db.alter_column(u'committees_protocolpart', 'body', self.gf('django.db.models.fields.TextField')(default='')) + + # Changing field 'ProtocolPart.header' + db.alter_column(u'committees_protocolpart', 'header', self.gf('django.db.models.fields.TextField')(default='')) + + # Changing field 'ProtocolPart.type' + db.alter_column(u'committees_protocolpart', 'type', self.gf('django.db.models.fields.TextField')(default='', max_length=20)) + + 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'committees.committee': { + 'Meta': {'object_name': 'Committee'}, + 'aliases': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'chairpersons': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'chaired_committees'", 'blank': 'True', 'to': u"orm['mks.Member']"}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'hide': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'knesset_description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'knesset_description_arb': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'knesset_description_eng': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'knesset_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'knesset_note': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'knesset_note_eng': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'knesset_parent_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'knesset_portal_link': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'knesset_type_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'last_scrape_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'members': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'committees'", 'blank': 'True', 'to': u"orm['mks.Member']"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'name_arb': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'}), + 'name_eng': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'}), + 'portal_knesset_broadcasts_url': ('django.db.models.fields.URLField', [], {'max_length': '1000', 'blank': 'True'}), + 'protocol_not_published': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'replacements': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'replacing_in_committees'", 'blank': 'True', 'to': u"orm['mks.Member']"}), + 'start_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'type': ('django.db.models.fields.CharField', [], {'default': "'committee'", 'max_length': '10', 'db_index': 'True'}) + }, + u'committees.committeemeeting': { + 'Meta': {'ordering': "('-date',)", 'object_name': 'CommitteeMeeting'}, + 'committee': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'meetings'", 'to': u"orm['committees.Committee']"}), + 'date': ('django.db.models.fields.DateField', [], {'db_index': 'True'}), + 'date_string': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'datetime': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'knesset_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'lobbyist_corporations_mentioned': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'committee_meetings'", 'blank': 'True', 'to': u"orm['lobbyists.LobbyistCorporation']"}), + 'lobbyists_mentioned': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'committee_meetings'", 'blank': 'True', 'to': u"orm['lobbyists.Lobbyist']"}), + 'mks_attended': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'committee_meetings'", 'symmetrical': 'False', 'to': u"orm['mks.Member']"}), + 'protocol_parts_update_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'protocol_text': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'protocol_text_update_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'src_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'topics': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'votes_mentioned': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'committee_meetings'", 'blank': 'True', 'to': "orm['laws.Vote']"}) + }, + u'committees.protocolpart': { + 'Meta': {'ordering': "('order', 'id')", 'object_name': 'ProtocolPart'}, + 'body': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'header': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'meeting': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'parts'", 'to': u"orm['committees.CommitteeMeeting']"}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'speaker': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'protocol_parts'", 'null': 'True', 'to': u"orm['persons.Person']"}), + 'type': ('django.db.models.fields.TextField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}) + }, + u'committees.topic': { + 'Meta': {'object_name': 'Topic'}, + 'committees': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['committees.Committee']", 'symmetrical': 'False'}), + 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}), + 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'editors': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'editing_topics'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['auth.User']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'log': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), + 'meetings': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['committees.CommitteeMeeting']", 'null': 'True', 'blank': 'True'}), + 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'rating_score': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}), + 'rating_votes': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'blank': 'True'}), + 'status': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '256'}) + }, + 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'}) + }, + 'laws.vote': { + 'Meta': {'ordering': "('-time', '-id')", 'object_name': 'Vote'}, + 'abstain_votes_count': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'against_coalition': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'against_opposition': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'against_own_bill': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'against_party': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'against_votes_count': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'controversy': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'for_votes_count': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'full_text': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'full_text_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'importance': ('django.db.models.fields.FloatField', [], {'default': '0.0'}), + 'meeting_number': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'src_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'src_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'summary': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'time': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}), + 'time_string': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'}), + 'vote_number': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'vote_type': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}), + 'votes': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'votes'", 'blank': 'True', 'through': "orm['laws.VoteAction']", 'to': u"orm['mks.Member']"}), + 'votes_count': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'laws.voteaction': { + 'Meta': {'object_name': 'VoteAction'}, + 'against_coalition': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'against_opposition': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'against_own_bill': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'against_party': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'member': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['mks.Member']"}), + 'party': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['mks.Party']"}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '10'}), + 'vote': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'actions'", 'to': "orm['laws.Vote']"}) + }, + u'lobbyists.lobbyist': { + 'Meta': {'object_name': 'Lobbyist'}, + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'large_image_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'person': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'lobbyist'", 'null': 'True', 'to': u"orm['persons.Person']"}), + 'source_id': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}) + }, + u'lobbyists.lobbyistcorporation': { + 'Meta': {'object_name': 'LobbyistCorporation'}, + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'source_id': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}) + }, + u'mks.knesset': { + 'Meta': {'object_name': 'Knesset'}, + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'number': ('django.db.models.fields.IntegerField', [], {'primary_key': 'True'}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}) + }, + u'mks.member': { + 'Meta': {'ordering': "['name']", 'object_name': 'Member'}, + 'area_of_residence': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'average_monthly_committee_presence': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), + 'average_weekly_presence_hours': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), + 'backlinks_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'bills_stats_approved': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'bills_stats_first': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'bills_stats_pre': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'bills_stats_proposed': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'blog': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['planet.Blog']", 'unique': 'True', 'null': 'True', 'blank': 'True'}), + 'current_party': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'members'", 'null': 'True', 'to': u"orm['mks.Party']"}), + 'current_position': ('django.db.models.fields.PositiveIntegerField', [], {'default': '999', 'blank': 'True'}), + 'current_role_descriptions': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'date_of_birth': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'date_of_death': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'family_status': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'fax': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), + 'gender': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.IntegerField', [], {'primary_key': 'True'}), + 'img_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}), + 'is_current': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'number_of_children': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'parties': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'all_members'", 'symmetrical': 'False', 'through': u"orm['mks.Membership']", 'to': u"orm['mks.Party']"}), + 'phone': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), + 'place_of_birth': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'place_of_residence': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'place_of_residence_lat': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}), + 'place_of_residence_lon': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}), + 'residence_centrality': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'residence_economy': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'year_of_aliyah': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + u'mks.membership': { + 'Meta': {'object_name': 'Membership'}, + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'member': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['mks.Member']"}), + 'party': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['mks.Party']"}), + 'position': ('django.db.models.fields.PositiveIntegerField', [], {'default': '999', 'blank': 'True'}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}) + }, + u'mks.party': { + 'Meta': {'ordering': "('-number_of_seats',)", 'unique_together': "(('knesset', 'name'),)", 'object_name': 'Party'}, + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_coalition': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'knesset': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parties'", 'null': 'True', 'to': u"orm['mks.Knesset']"}), + 'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'number_of_members': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'number_of_seats': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'split_from': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['mks.Party']", 'null': 'True', 'blank': 'True'}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}) + }, + u'persons.person': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Person'}, + 'area_of_residence': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'calendar_sync_token': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'calendar_url': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'date_of_birth': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'date_of_death': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'family_status': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'fax': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), + 'gender': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'img_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}), + 'mk': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'person'", 'null': 'True', 'to': u"orm['mks.Member']"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'number_of_children': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'phone': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), + 'place_of_birth': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'place_of_residence': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'place_of_residence_lat': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}), + 'place_of_residence_lon': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}), + 'residence_centrality': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'residence_economy': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'titles': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'persons'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['persons.Title']"}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'year_of_aliyah': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + u'persons.title': { + 'Meta': {'object_name': 'Title'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}) + }, + u'planet.blog': { + 'Meta': {'ordering': "('title', 'url')", 'object_name': 'Blog'}, + 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}), + 'url': ('django.db.models.fields.URLField', [], {'unique': 'True', 'max_length': '1024', 'db_index': 'True'}) + } + } + + complete_apps = ['committees'] \ No newline at end of file diff --git a/committees/models.py b/committees/models.py index e8ab7f6c..288a96c1 100644 --- a/committees/models.py +++ b/committees/models.py @@ -245,9 +245,9 @@ class CommitteeMeeting(models.Model): tagged_items = generic.GenericRelation(TaggedItem, object_id_field="object_id", content_type_field="content_type") - lobbyists_mentioned = models.ManyToManyField('lobbyists.Lobbyist', related_name='committee_meetings') + lobbyists_mentioned = models.ManyToManyField('lobbyists.Lobbyist', related_name='committee_meetings', blank=True) lobbyist_corporations_mentioned = models.ManyToManyField('lobbyists.LobbyistCorporation', - related_name='committee_meetings') + related_name='committee_meetings', blank=True) datetime = models.DateTimeField(db_index=True, null=True, blank=True) knesset_id = models.IntegerField(null=True, blank=True) @@ -492,11 +492,11 @@ def list(self): class ProtocolPart(models.Model): meeting = models.ForeignKey(CommitteeMeeting, related_name='parts') order = models.IntegerField() - header = models.TextField(blank=True) - body = models.TextField(blank=True) + header = models.TextField(blank=True, null=True) + body = models.TextField(blank=True, null=True) speaker = models.ForeignKey('persons.Person', blank=True, null=True, related_name='protocol_parts') objects = ProtocolPartManager() - type = models.TextField(blank=True, max_length=20) + type = models.TextField(blank=True, null=True, max_length=20) annotatable = True @@ -518,7 +518,7 @@ def get_absolute_url(self): def __unicode__(self): return "%s %s: %s" % (self.meeting.committee.name, self.header, - self.header) + self.body) TOPIC_PUBLISHED, TOPIC_FLAGGED, TOPIC_REJECTED, \