Configurable favicon
authorKostas Papadimitriou <kpap@grnet.gr>
Mon, 26 Mar 2012 13:17:18 +0000 (16:17 +0300)
committerKostas Papadimitriou <kpap@grnet.gr>
Mon, 26 Mar 2012 13:17:18 +0000 (16:17 +0300)
cloudcms/admin.py
cloudcms/migrations/0005_auto__add_field_application_favicon.py [new file with mode: 0644]
cloudcms/models.py
cloudcms/templates/cms/base.html

index 19fcc38..459c2a0 100644 (file)
@@ -37,7 +37,7 @@ from cloudcms import models
 
 
 class ApplicationAdmin(admin.ModelAdmin):
-    raw_id_fields = ('logo', )
+    raw_id_fields = ('logo', 'favicon')
 
 
 admin.site.register(models.Application, ApplicationAdmin)
diff --git a/cloudcms/migrations/0005_auto__add_field_application_favicon.py b/cloudcms/migrations/0005_auto__add_field_application_favicon.py
new file mode 100644 (file)
index 0000000..9f2f405
--- /dev/null
@@ -0,0 +1,65 @@
+# 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 'Application.favicon'
+        db.add_column('cloudcms_application', 'favicon', self.gf('feincms.module.medialibrary.fields.MediaFileForeignKey')(blank=True, related_name='as_favicon', null=True, to=orm['medialibrary.MediaFile']), keep_default=False)
+    
+    
+    def backwards(self, orm):
+        
+        # Deleting field 'Application.favicon'
+        db.delete_column('cloudcms_application', 'favicon_id')
+    
+    
+    models = {
+        'cloudcms.application': {
+            'Meta': {'object_name': 'Application'},
+            'app_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'code': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'extra_styles': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+            'facebook_username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
+            'favicon': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'blank': 'True', 'related_name': "'as_favicon'", 'null': 'True', 'to': "orm['medialibrary.MediaFile']"}),
+            'footer_bottom': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+            'footer_top': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'index_url': ('django.db.models.fields.CharField', [], {'default': "'/'", 'max_length': '255'}),
+            'linked_in_username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
+            'logo': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'to': "orm['medialibrary.MediaFile']", 'null': 'True', 'blank': 'True'}),
+            'show_twitter_feed_on_top': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'twitter_username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'})
+        },
+        'medialibrary.category': {
+            'Meta': {'object_name': 'Category'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['medialibrary.Category']"}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '200'})
+        },
+        'medialibrary.mediafile': {
+            'Meta': {'object_name': 'MediaFile'},
+            'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['medialibrary.Category']", 'null': 'True', 'blank': 'True'}),
+            'copyright': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
+            'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'file': ('django.db.models.fields.files.FileField', [], {'max_length': '255'}),
+            'file_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'type': ('django.db.models.fields.CharField', [], {'max_length': '12'})
+        },
+        'sites.site': {
+            'Meta': {'object_name': 'Site', 'db_table': "'django_site'"},
+            'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        }
+    }
+    
+    complete_apps = ['cloudcms']
index 00c514f..a065ee7 100644 (file)
@@ -49,6 +49,8 @@ class Application(models.Model):
             help_text="The title of the application")
 
     logo = MediaFileForeignKey(MediaFile, blank=True, null=True)
+    favicon = MediaFileForeignKey(MediaFile, blank=True, null=True,
+            related_name="as_favicon")
     site = models.ForeignKey(sites_models.Site)
     app_url = models.URLField(help_text="The url of the application UI (not "\
             "the cms", verify_exists=False, blank=True, null=True)
index 7d50046..ef64850 100644 (file)
@@ -27,8 +27,8 @@
   {% endblock %}
   
   {% block favicons %}
-  <link rel="shortcut icon" href="">
-  <link rel="apple-touch-icon" href="">
+  <link rel="shortcut icon" href="{{ APP.favicon.get_absolute_url }}">
+  <link rel="apple-touch-icon" href="{{ APP.favicon.get_absolute_url }}">
   {% endblock favicons %}
 
   {% block css %}