Archive | April, 2009

Redirecting to a 404 page in Django

4. April 2009

Comments Off on Redirecting to a 404 page in Django

There are a few ways to redirect to a 404 page (or page not found error) in Django. The easiest way is to raise Django’s built in 404 exception, like so: from django.http import Http404 def myView(request, param): if not param: raise Http404 return render_to_response('myView.html') You can add a file called 404.html to your templates […]

Continue reading...

DateDiff Equivalent in C# – 3 Options

1. April 2009

3 Comments

If you are looking for a DateDiff function in C# like in VB or SQL Server, there is none. However here are some options to perform date operations in .Net via C#. Option 1 You can subtract two DateTime objects which returns a TimeSpan object. Here is an example: //To get the amount of days […]

Continue reading...