Skip to content

Commit

Permalink
support media files
Browse files Browse the repository at this point in the history
  • Loading branch information
station committed Jul 25, 2016
1 parent 2206086 commit f7f509f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion frontend/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Profile(models.Model):
statistics = models.ForeignKey(Statistics)
loc_latitude = models.FloatField(default=0.0)
loc_longitude = models.FloatField(default=0.0)
min_cp = models.IntegerField(default=0)

class Eggs(models.Model):
km = models.IntegerField()
Expand All @@ -46,7 +47,7 @@ class PokeData(models.Model):
base_flee_rate = models.FloatField(blank=True,default=0.0)
evolution = models.IntegerField(blank=True,default=0)
candy = models.IntegerField(blank=True,default=0)
picture = models.ImageField(blank=True,default=0)
picture = models.ImageField(blank=True,upload_to='pokeimg/')

class Pokemon(models.Model):
individual_id = models.CharField(max_length=64)
Expand Down
1 change: 1 addition & 0 deletions frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def post(self, request, *args, **kwargs):
'username': profile.account.username,
'password': profile.account.password,
'auth': auth,
'min_cp': profile.min_cp
}
json_response = json.dumps(data)
return HttpResponse(json_response)
Expand Down
4 changes: 3 additions & 1 deletion pokefront/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

ALLOWED_HOSTS = []


STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR+'/media/'
# Application definition

INSTALLED_APPS = [
Expand Down
6 changes: 3 additions & 3 deletions pokefront/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
from django.conf.urls import url
from django.contrib import admin
from frontend.views import PokeList, Sync, Filldata, ReleasePoke, EvolvePoke, Overview, SendConfig


from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
url(r'^admin/', admin.site.urls),
Expand All @@ -28,4 +28,4 @@
url(r'evolve/(?:(?P<account_id>\d+)/(?:(?P<poke_id>\d+)/))?$', EvolvePoke.as_view(), name='evolve'),
url(r'fill/$', Filldata.as_view(), name='fill'),
url(r'get_config/$', SendConfig.as_view(), name='send_config'),
]
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

0 comments on commit f7f509f

Please sign in to comment.