Commits

ronald martinez committed 374ef00

ok

  • Participants
  • Parent commits 9cce3a0

Comments (0)

Files changed (3)

File app/admin.py

 
 class ProductAdmin(admin.ModelAdmin):
 
-    def save_model(self, request, *args):
-        #print "a"
-        print request.FILES.get('image').read()
-        #print type(request.FILES.get('image'))
-        #print "b"
-        #print self.title
-        #super(ProductAdmin, self).save_model(request, obj, form, change)
-        super(ProductAdmin, self).save_model(request, *args)
+    def save_model(self, request, obj, *args):
+        image = request.FILES.get('image').read()
+        print "xxx"
+        print obj.id
+        print "yyy"
+        print "save one"
+        obj.title = 'katty'
+        print "saveeee"
+        obj.save()
+        #super(ProductAdmin, self).save_model(request, *args)
+        #obj.
 
 
 admin.site.register(WebUser, WebUserAdmin)

File app/models.py

     def save(self, *args, **kwargs):
         if self.slug == '':
             self.slug = self._generate_slug(self.title)
+
+        print "save two"
         super(Product, self).save(*args, **kwargs)
 
     def __unicode__(self):

File vuulo_site/urls.py

+import settings
+
 from django.conf.urls import patterns, include, url
 
+
 # Uncomment the next two lines to enable the admin:
 from django.contrib import admin
 admin.autodiscover()
     # Uncomment the next line to enable the admin:
     url(r'^admin/', include(admin.site.urls)),
 )
+
+
+
+if settings.DEBUG:
+    # static files (images, css, javascript, etc.)
+    urlpatterns += patterns('',
+        (r'^media/(?P<path>.*)$', 'django.views.static.serve', {
+        'document_root': settings.MEDIA_ROOT}))