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.

python - Django Templates: Display a date only if it's in the future -


how compare dates in django template? thought of several possible avenues:

  • send today's date in context compared @ template
  • create own template tag
  • have logic in view pass date if it's in future

although last option seems easier, rather leave display logic in template in view. not want pass seems trivial today's date in template context.

perhaps has option or share implementation of 1 of options mentioned above , why decided go route.

i'd go template filter:

from datetime import date ... @register.filter def future_dates_only(the_date):    if the_date > date.today():        return the_date    else:        return none 

then in view like:

{{specialdate|future_dates_only|date:"d m y"}} 

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 -