Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

django admin action without selecting objects -


is possible create custom admin action django admin doesn't require selecting objects run on?

if try run action without selecting objects, message:

items must selected in order perform actions on them. no items have been changed. 

is there way override behaviour , let action run anyway?

yuji on right track, i've used simpler solution may work you. if override response_action done below can replace empty queryset queryset containing objects before check happens. code checks action you're running make sure it's approved run on objects before changing queryset, can restrict happen in cases.

    def response_action(self, request, queryset):     # override allow exporting of records csv if no chkbox selected     selected = request.post.getlist(admin.action_checkbox_name)     if request.meta['query_string']:         qd = dictify_querystring(request.meta['query_string'])     else:         qd = none     data = request.post.copy()     if len(selected) == 0 , data['action'] in ('export_to_csv', 'extended_export_to_csv'):         ct = contenttype.objects.get_for_model(queryset.model)         klass = ct.model_class()         if qd:             queryset = klass.objects.filter(**qd)[:65535] # cap @ classic excel maximum minus 1 row headers         else:             queryset = klass.objects.all()[:65535] # cap @ classic excel maximum minus 1 row headers         return getattr(self, data['action'])(request, queryset)     else:         return super(modeladmincsv, self).response_action(request, queryset) 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -