Links

   Quran Explorer - Interactive Audio Recitations & Translations
Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Thursday, May 8, 2014

Django QuerySet Operators

Supports the following
 
exact
iexact
contains
icontains
in
gt
gte
lt
lte
startswith
istartswith
endswith
iendswith
range
year
month
day
week_day
isnull
search
regex
iregex
 
 
Example: 
queryset = Tender.objects.filter(deadline__gt = datetime.datetime.now())
 

Wednesday, April 30, 2014

Gaffes


Since this blog is about my own experience while coding away my sanity, i think it would be fir enought to share my blunders too... not just wat works!!!!!!!!

In no particular order....

1. Strange PostgreSQL Error message
    "ERROR:  input of anonymous composite types is not implemented "

     This is an error message i had never encountered before but , against my own advice, instead of backtracking and looking for documentation of the error or googling, i went straight ahead to my new ui code and tried to debug.... i wasted almost 8 man hours... a whole official day in other words.

Later on i discovered that i had forgoten to specify a datataype for a db column in the sql script !!!!!!!!


2. New Django Models 'Refusing' to appear on the Admin site
   Was in 'debug' mode for about 2 days

   Found out that i had forgoten to register the new Models at admin.py




Thursday, March 27, 2014

Add Mezzanine to an existing Django Project

 

I dont take any credit for the following content.. Its here solely for (my) future reference and has been taken directly from the Mezzanine FAQs page

 

How can I add Mezzanine to an existing Django project?

Mezzanine is a Django project made up of multiple Django apps, and is geared towards being used as the basis for new Django projects, however adding Mezzanine to an existing Django project should be as simple as adding the necessary settings and urlpatterns.
Mezzanine contains a project_template directory, which it uses to create new projects. In here you’ll find the necessary settings.py and urls.py modules, containing the project-level setup for Mezzanine. Of particular note are the following settings:
  • INSTALLED_APPS
  • TEMPLATE_CONTEXT_PROCESSORS
  • MIDDLEWARE_CLASSES
  • PACKAGE_NAME_GRAPPELLI and PACKAGE_NAME_FILEBROWSER (for django-grappelli and django-filebrowser integration)
  • The call to mezzanine.utils.conf.set_dynamic_settings at the very end of the settings.py module.

Tuesday, March 4, 2014

Fixing Django ImportError in production

Hi,

"TemplateSyntaxError: Caught ImportError while rendering: No module named blahblahblah"  

In Development all imports work perfectly untill u move to production....

I 'lost' almost 16 man-hours trying to troubleshoot this. This is almost always a path issue.. There are several options one of them adding the path using os.path but the one that worked for me is to fully qualify the module name.

This means prefixing the project name to the module name such that if your project name was 'my_project' and the missing module/app is 'registration_app' you'll need to use my_project.registration_app EVERYWHERE in your .py files..