1. Marko Samastur
  2. delajozate

Commits

Marko Samastur  committed 41034b7

Dodal funkcijo funkcijam :)

  • Participants
  • Parent commits 2679078
  • Branches default

Comments (0)

Files changed (4)

File dz/admin.py

View file
 	Mandat, Funkcija, Odbor, ClanOdbora
 
 class FunkcijaAdmin(admin.ModelAdmin):
-	list_display = ('oseba', 'mandat', 'od', 'do', 'podatki_preverjeni')
+	list_display = ('oseba', 'mandat', 'funkcija', 'od', 'do', 'podatki_preverjeni')
 	list_filter = ('mandat', 'podatki_preverjeni')
 
 class StrankaAdmin(admin.ModelAdmin):
 	search_fields = ('ime', 'priimek')
 
 class ClanStrankeAdmin(admin.ModelAdmin):
+	search_fields = ('oseba__ime', 'oseba__priimek', 'stranka__ime')
 	list_display = ('oseba', 'stranka', 'od', 'do', 'podatki_preverjeni')
 	list_filter = ('podatki_preverjeni',)
 

File dz/migrations/0013_auto__add_field_funkcija_funkcija.py

View file
+# encoding: 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 'Funkcija.funkcija'
+        db.add_column('dz_funkcija', 'funkcija', self.gf('django.db.models.fields.CharField')(default='poslanec', max_length=64, null=True, blank=True), keep_default=False)
+
+
+    def backwards(self, orm):
+        
+        # Deleting field 'Funkcija.funkcija'
+        db.delete_column('dz_funkcija', 'funkcija')
+
+
+    models = {
+        'dz.clanodbora': {
+            'Meta': {'object_name': 'ClanOdbora'},
+            'do': ('django.db.models.fields.DateField', [], {'blank': 'True'}),
+            'funkcija': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'mandat': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Mandat']"}),
+            'od': ('django.db.models.fields.DateField', [], {}),
+            'odbor': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Odbor']"}),
+            'opombe': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'podatki_preverjeni': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'poslanec': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Funkcija']"})
+        },
+        'dz.clanstranke': {
+            'Meta': {'ordering': "('-do',)", 'object_name': 'ClanStranke'},
+            'do': ('django.db.models.fields.DateField', [], {'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'od': ('django.db.models.fields.DateField', [], {}),
+            'opombe': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'oseba': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Oseba']"}),
+            'podatki_preverjeni': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'stranka': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Stranka']", 'null': 'True', 'blank': 'True'})
+        },
+        'dz.funkcija': {
+            'Meta': {'ordering': "('id',)", 'object_name': 'Funkcija'},
+            'do': ('django.db.models.fields.DateField', [], {'blank': 'True'}),
+            'funkcija': ('django.db.models.fields.CharField', [], {'default': "'poslanec'", 'max_length': '64', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'mandat': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Mandat']"}),
+            'od': ('django.db.models.fields.DateField', [], {}),
+            'opombe': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'oseba': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Oseba']"}),
+            'podatki_preverjeni': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
+        },
+        'dz.mandat': {
+            'Meta': {'object_name': 'Mandat'},
+            'do': ('django.db.models.fields.DateField', [], {'default': 'datetime.date(9999, 12, 31)', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'od': ('django.db.models.fields.DateField', [], {}),
+            'st': ('django.db.models.fields.IntegerField', [], {})
+        },
+        'dz.odbor': {
+            'Meta': {'object_name': 'Odbor'},
+            'do': ('django.db.models.fields.DateField', [], {'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ime': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
+            'mandat': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Mandat']"}),
+            'od': ('django.db.models.fields.DateField', [], {}),
+            'opombe': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'podatki_preverjeni': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'url': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'})
+        },
+        'dz.oseba': {
+            'Meta': {'ordering': "('ime', 'priimek')", 'object_name': 'Oseba'},
+            'dan_smrti': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '64', 'blank': 'True'}),
+            'facebook': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ime': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+            'opombe': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'podatki_preverjeni': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'priimek': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+            'rojstni_dan': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            'slika': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '96', 'db_index': 'True'}),
+            'spletna_stran': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'twitter': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
+            'vir_slike': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'})
+        },
+        'dz.skupina': {
+            'Meta': {'object_name': 'Skupina'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ime': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+            'stranka': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Stranka']", 'null': 'True', 'blank': 'True'})
+        },
+        'dz.stranka': {
+            'Meta': {'object_name': 'Stranka'},
+            'barva': ('django.db.models.fields.CharField', [], {'max_length': '6', 'blank': 'True'}),
+            'davcna': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
+            'do': ('django.db.models.fields.DateField', [], {'default': 'datetime.date(9999, 12, 31)', 'null': 'True'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '64', 'blank': 'True'}),
+            'facebook': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ime': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+            'maticna': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
+            'nastala_iz': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'spremenila_v'", 'blank': 'True', 'to': "orm['dz.Stranka']"}),
+            'od': ('django.db.models.fields.DateField', [], {'null': 'True'}),
+            'okrajsava': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
+            'opombe': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'podatki_preverjeni': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'spletna_stran': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'twitter': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'})
+        }
+    }
+
+    complete_apps = ['dz']

File dz/migrations/0014_auto__chg_field_funkcija_funkcija.py

View file
+# encoding: 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):
+        
+        # Changing field 'Funkcija.funkcija'
+        db.alter_column('dz_funkcija', 'funkcija', self.gf('django.db.models.fields.CharField')(max_length=64))
+
+
+    def backwards(self, orm):
+        
+        # Changing field 'Funkcija.funkcija'
+        db.alter_column('dz_funkcija', 'funkcija', self.gf('django.db.models.fields.CharField')(max_length=64, null=True))
+
+
+    models = {
+        'dz.clanodbora': {
+            'Meta': {'object_name': 'ClanOdbora'},
+            'do': ('django.db.models.fields.DateField', [], {'blank': 'True'}),
+            'funkcija': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'mandat': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Mandat']"}),
+            'od': ('django.db.models.fields.DateField', [], {}),
+            'odbor': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Odbor']"}),
+            'opombe': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'podatki_preverjeni': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'poslanec': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Funkcija']"})
+        },
+        'dz.clanstranke': {
+            'Meta': {'ordering': "('-do',)", 'object_name': 'ClanStranke'},
+            'do': ('django.db.models.fields.DateField', [], {'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'od': ('django.db.models.fields.DateField', [], {}),
+            'opombe': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'oseba': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Oseba']"}),
+            'podatki_preverjeni': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'stranka': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Stranka']", 'null': 'True', 'blank': 'True'})
+        },
+        'dz.funkcija': {
+            'Meta': {'ordering': "('id',)", 'object_name': 'Funkcija'},
+            'do': ('django.db.models.fields.DateField', [], {'blank': 'True'}),
+            'funkcija': ('django.db.models.fields.CharField', [], {'default': "'poslanec'", 'max_length': '64'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'mandat': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Mandat']"}),
+            'od': ('django.db.models.fields.DateField', [], {}),
+            'opombe': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'oseba': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Oseba']"}),
+            'podatki_preverjeni': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
+        },
+        'dz.mandat': {
+            'Meta': {'object_name': 'Mandat'},
+            'do': ('django.db.models.fields.DateField', [], {'default': 'datetime.date(9999, 12, 31)', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'od': ('django.db.models.fields.DateField', [], {}),
+            'st': ('django.db.models.fields.IntegerField', [], {})
+        },
+        'dz.odbor': {
+            'Meta': {'object_name': 'Odbor'},
+            'do': ('django.db.models.fields.DateField', [], {'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ime': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
+            'mandat': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Mandat']"}),
+            'od': ('django.db.models.fields.DateField', [], {}),
+            'opombe': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'podatki_preverjeni': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'url': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'})
+        },
+        'dz.oseba': {
+            'Meta': {'ordering': "('ime', 'priimek')", 'object_name': 'Oseba'},
+            'dan_smrti': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '64', 'blank': 'True'}),
+            'facebook': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ime': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+            'opombe': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'podatki_preverjeni': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'priimek': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+            'rojstni_dan': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            'slika': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '96', 'db_index': 'True'}),
+            'spletna_stran': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'twitter': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
+            'vir_slike': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'})
+        },
+        'dz.skupina': {
+            'Meta': {'object_name': 'Skupina'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ime': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+            'stranka': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dz.Stranka']", 'null': 'True', 'blank': 'True'})
+        },
+        'dz.stranka': {
+            'Meta': {'object_name': 'Stranka'},
+            'barva': ('django.db.models.fields.CharField', [], {'max_length': '6', 'blank': 'True'}),
+            'davcna': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
+            'do': ('django.db.models.fields.DateField', [], {'default': 'datetime.date(9999, 12, 31)', 'null': 'True'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '64', 'blank': 'True'}),
+            'facebook': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ime': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+            'maticna': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
+            'nastala_iz': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'spremenila_v'", 'blank': 'True', 'to': "orm['dz.Stranka']"}),
+            'od': ('django.db.models.fields.DateField', [], {'null': 'True'}),
+            'okrajsava': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
+            'opombe': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'podatki_preverjeni': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'spletna_stran': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'twitter': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'})
+        }
+    }
+
+    complete_apps = ['dz']

File dz/models.py

View file
 from delajozate.temporal import END_OF_TIME
 import datetime
 
+FUNKCIJE = (
+	('poslanec', 'Poslanec/ka'),
+)
+
 def null_date(date):
 	if date == END_OF_TIME:
 		return None
 
 class Funkcija(models.Model):
 	oseba = models.ForeignKey(Oseba)
+	funkcija = models.CharField(max_length=64, default='poslanec',
+								choices=FUNKCIJE)
 	mandat = models.ForeignKey(Mandat)
 	od = models.DateField()
 	do = models.DateField(blank=True)