diff --git a/media/js/mkt/admin_featuredapp.js b/media/js/mkt/admin_featuredapp.js index cc976c5cb4..16f0bc836a 100644 --- a/media/js/mkt/admin_featuredapp.js +++ b/media/js/mkt/admin_featuredapp.js @@ -63,18 +63,30 @@ function appslistXHR(verb, data) { $(document).ready(function(){ $("#featured-webapps").delegate( - '.remove', 'click', _pd(function() { - deleteFromAppsList($("#categories"), - $(this).data("id")); - })); - $("#featured-webapps").delegate( - "select.localepicker", "change", _pd(function (e) { + '.remove', + 'click', + _pd(function() { + deleteFromAppsList($("#categories"), $(this).data("id")); + }) + ); + $('#featured-webapps').delegate( + 'select.localepicker', + 'change', + _pd(function (e) { var region = $(e.target); - $.ajax({type: 'POST', - url: region.data("url"), - data: {"region": region.val(), - "app": region.data("id")}}); - })); + $.ajax({ + type: 'POST', + url: region.data('url'), + data: { + 'region': + _(region.children('option')) + .filter(function(opt) {return opt.selected}) + .map(function(sopt) {return sopt.value}), + 'app': region.data('id') + } + }); + }) + ); var categories = $("#categories"); var appslist = $("#featured-webapps"); var p = $.ajax({type: 'GET', diff --git a/mkt/zadmin/models.py b/mkt/zadmin/models.py index ceec4a73a9..4795cae913 100644 --- a/mkt/zadmin/models.py +++ b/mkt/zadmin/models.py @@ -10,8 +10,15 @@ class FeaturedApp(models.Model): app = models.ForeignKey(Webapp, null=False) category = models.ForeignKey(Category, null=True) is_sponsor = models.BooleanField(default=False) + + class Meta: + db_table = 'zadmin_featuredapp' + + +class FeaturedAppRegionExclusion(models.Model): + featured_app = models.ForeignKey(FeaturedApp, null=False) region = models.PositiveIntegerField(default=mkt.regions.WORLDWIDE.id, db_index=True) class Meta: - db_table = 'zadmin_featuredapp' + db_table = 'zadmin_featuredapp_regionexclusion' diff --git a/mkt/zadmin/templates/zadmin/featured_apps_ajax.html b/mkt/zadmin/templates/zadmin/featured_apps_ajax.html index 85cb573bde..ac33279aff 100644 --- a/mkt/zadmin/templates/zadmin/featured_apps_ajax.html +++ b/mkt/zadmin/templates/zadmin/featured_apps_ajax.html @@ -18,17 +18,16 @@ {% endif %}