diff mbox

[Branch,~linaro-validation/lava-server/trunk] Rev 416: Introduce admin.py file since recent django versions support only that one.

Message ID 20130806153928.15878.631.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Stevan Radakovic Aug. 6, 2013, 3:39 p.m. UTC
Merge authors:
  Stevan Radaković (stevanr)
Related merge proposals:
  https://code.launchpad.net/~stevanr/lava-server/fix-google-analytics-admin-link/+merge/178761
  proposed by: Stevan Radaković (stevanr)
------------------------------------------------------------
revno: 416 [merge]
committer: Stevan Radakovic <stevan.radakovic@linaro.org>
branch nick: trunk
timestamp: Tue 2013-08-06 17:39:12 +0200
message:
  Introduce admin.py file since recent django versions support only that one.
added:
  google_analytics/admin.py
modified:
  google_analytics/models.py


--
lp:lava-server
https://code.launchpad.net/~linaro-validation/lava-server/trunk

You are subscribed to branch lp:lava-server.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription
diff mbox

Patch

=== added file 'google_analytics/admin.py'
--- google_analytics/admin.py	1970-01-01 00:00:00 +0000
+++ google_analytics/admin.py	2013-08-06 14:25:08 +0000
@@ -0,0 +1,11 @@ 
+from django.conf import settings
+from django.contrib import admin
+
+from google_analytics.models import Analytic
+
+class AnalyticAdmin(admin.ModelAdmin):
+    list_display = ('site', 'analytics_code',)
+
+if getattr(settings, 'GOOGLE_ANALYTICS_MODEL', False):
+    admin.site.register(Analytic, AnalyticAdmin)
+

=== modified file 'google_analytics/models.py'
--- google_analytics/models.py	2013-07-23 12:14:04 +0000
+++ google_analytics/models.py	2013-08-06 13:38:03 +0000
@@ -1,19 +1,7 @@ 
+from django.contrib import admin
+from django.contrib.sites.models import Site
 from django.db import models
-from django.conf import settings
-from django.contrib.sites.admin import SiteAdmin
-from django.contrib.sites.models import Site
-from django.contrib import admin
-
-if getattr(settings, 'GOOGLE_ANALYTICS_MODEL', False):
-
-    class Analytic(models.Model):
-        site = models.ForeignKey(Site, unique=True)
-        analytics_code = models.CharField(blank=True, max_length=100)
-
-        def __unicode__(self):
-            return u"%s" % (self.analytics_code)
-
-    class AnalyticAdmin(admin.ModelAdmin):
-        list_display = ('site', 'analytics_code',)
-
-    admin.site.register(Analytic, AnalyticAdmin)
+
+class Analytic(models.Model):
+    site = models.ForeignKey(Site, unique=True)
+    analytics_code = models.CharField(blank=True, max_length=100)