Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added FileField for the Account.icon

  • Loading branch information...
commit 11c283025fa5273e520930308321415e4132d8f3 1 parent 74cc787
@deanmalmgren deanmalmgren authored
View
1  .hgignore
@@ -10,6 +10,7 @@ syntax: glob
example_project/env/
example_project/*.db
example_project/static/
+example_project/uploads/
# ignore distribution builds for pypi
django_flux.egg-info/
View
9 example_project/urls.py
@@ -1,3 +1,4 @@
+from django.conf import settings
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
@@ -9,3 +10,11 @@
(r'^', include('flux.urls')),
url(r'^admin/', include(admin.site.urls)),
)
+
+if settings.DEBUG:
+ urlpatterns += patterns('',
+ url(r'^%s(?P<path>.*)$'%settings.MEDIA_URL,
+ 'django.views.static.serve', {
+ 'document_root': settings.MEDIA_ROOT,
+ }),
+ )
View
9 flux/conf/settings.py
@@ -1,3 +1,4 @@
+import os
import datetime
from django.conf import settings
@@ -31,3 +32,11 @@
if FLUX_MAX_TIME_WINDOW.days % FLUX_BIN_SIZE.days != 0:
msg = "FLUX_BIN_SIZE must evenly divide FLUX_MAX_TIME_WINDOW"
raise ValueError(msg)
+
+
+# this settings variable specifies the location to which the icon
+# images are uploaded for the Account.icon
+FLUX_UPLOAD_TO = getattr(
+ settings, "FLUX_UPLOAD_TO",
+ os.path.join("uploads", "flux"),
+)
View
6 flux/models.py
@@ -36,6 +36,12 @@ class Meta:
db_index=True,
help_text="Enter the name of the account to track",
)
+ icon = models.FileField(
+ upload_to=settings.FLUX_UPLOAD_TO,
+ max_length=255,
+ blank=True,
+ help_text="Icon for this account (square, 50x50 preferred)",
+ )
other = models.TextField(
help_text="Other data associated with this account. JSON format.",
blank=True,
View
6 flux/static/flux/css/flux_timeseries.css
@@ -1,6 +1,10 @@
// styling for the flux_icon block
-.flux_icon img, .flux_icon {
+.flux_icon {
+ width: 50px;
+ height: 50px;
+}
+.flux_icon img {
width: 50px;
height: 50px;
}
View
2  flux/templates/flux/timeseries.html
@@ -4,7 +4,7 @@
<div class="flux_icon">
{% block flux_icon %}
<img alt="icon for {{account}}"
- src="{{STATIC_URL}}flux/img/{{account.type}}.png" />
+ src="{{account.icon.url}}" />
{% endblock flux_icon %}
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.