This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.decorators import login_required | |
from django.utils.decorators import method_decorator | |
from django.views import generic | |
from new import classobj | |
import re | |
class LoginRequiredMixin(object): | |
@method_decorator(login_required) | |
def dispatch(self,request, *args, **kwargs ): | |
return super(LoginRequiredMixin, self).dispatch(request, *args, **kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Author: Stephen J. Zabel | |
License: BSD | |
This module exposed a helper function for | |
wrapping views at the urls.py/resolver level | |
My personal little itch as an example... | |
urlpatterns += required( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
flash:{ | |
msg: 'You do not have permission to that user' | |
,flashType: 'warn' | |
} | |
... | |
} | |
// or |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
App.set('flashProxy', Ember.A()); | |
App.FlashController = Ember.ArrayController.extend({ | |
itemController: 'flashObject' | |
,contentBinding: 'App.flashProxy' | |
}); | |
App.FlashObjectController = Ember.ObjectController.extend({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
App.Flash = DS.Model.extend({ | |
msg: DS.attr('string') | |
,flashType: DS.attr('string') | |
,didLoad: function(){ | |
this._super(); | |
App.flashProxy.pushObject(this); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
App.BaseRoute = Ember.Route.extend({ | |
renderTemplate: function () { | |
this._super(); | |
this.loadAdditionalControllers(); | |
} | |
,loadAdditionalControllers: function(){ | |
this.render('flash',{ | |
controller: 'flash' |