django-timezones - python

I am trying to setup django-timezones but am unfamiliar on how to go about this. The only info that I have found is here: http://www.ohloh.net/p/django-timezones
class MyModel(Model):
timezone = TimeZoneField()
datetime = LocalizedDateTime('timezone')
I also tried looking through the pinax code or any other projects that use this app but haven't found anything.
Does anyone have an example or some info that they can share on how to use this?
Thanks,
Justin

Well, the firs thing you need to do when installing any Django app, is add it to your INSTALLED_APPS in settings.py. This particular app doesn't do to much other then give you some handy fields and things that you can use in other parts of your Django project. Your best bet to understand it is reading the source, I would say.

Related

Calling functions in a django app from url

Consider the domain example.content.com. Now I want that content.com part to point to my django web application, and that example part to point to specific functions in my views.py folder, so that I can call different functions in my views.py by changing that example part. Is there any way to achieve this?
Any help is appreciated. Thankyou!
I think you want something like Subdomains!
I think django-subdomains package will be best for it!
Django Subdomain Docs
pip install django-subdomains

Alternative Admin in Django

Hello guys I would like to know if there's a way NOT to override Django Admin, but to build your own, with a custom template. I have searched on the internet but there seems to be no answer. I hope there is a person who knows the answer to my question.
Please refer to documentation:
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#customizing-adminsite
As far as I understood you are trying to have nicer view for admin site. If that is the case I suggest to take a look to Mezzanine, it provides nice features:
http://mezzanine.jupo.org/docs/admin-customization.html

How to make drag drop tree in django admin?

I need some drap&drop tree plugin like this for Django Admin.
Anybody knows about such plugins for Django?
Googling for it I found this one (never used though). It's not very clear what you need, maybe if you explain it a little better people could give you the right path to follow.
Besides that, it is always possible to customize Django Admin (override or extend) templates as documented here. By using this approach you could implement everything by yourself (using jQuery UI or Bootstrap for example).
Good luck!

Understanding how Django Apps system works

After some months of using Django, I feel the need to create the first my Django application. In this way I can really take the advantages of the Django's power.
Someone can give me hints and directions for learning well about it?
How Django's apps system works? And how can I create my first reusable app?
I think Django's is one of the best framework ever created and I want to learn it very well for using it in various contexts.
And now I would to take my Django's experience and skills to the next level.
In addition to the official Django documentation and tutorial, which are excellent, I would recommend two books you should check out:
Ayman Hourieh's Django Web Development 1.0:
http://www.amazon.com/gp/aw/d/1847196780/ref=redir_mdp_mobile/191-3941588-1909500
An awesome book that will take you step by step through creating your first Django app, and that touches on several of Django's features and functionality.
The Definitive Guide to Django:
http://www.amazon.com/gp/aw/d/1847196780/ref=redir_mdp_mobile/191-3941588-1909500
The title says it all, written by Django's creator and lead developer.
Don't miss a great talk about reusable apps by James Bennet: http://www.youtube.com/watch?v=A-S0tqpPga4 .
Try here for starters:
https://docs.djangoproject.com/en/1.3/intro/tutorial01/
This document describes Django 1.3.
Writing your first Django app, part 1...
And I suggest you go to Amazon.com, look through Django books and read a lot of the reviews until you find something that sounds appropriate for you.
HTH

Django admin site: implement a singleton for global variables?

Does anyone have experience (Django 1.x pref 1.3) with implementing a sort of singleton accessible from the admin page to expose some global variables for editing (site name, keywords, ...).
I cant find anything like this and it sounds quite unbelievable!
thanks
(django-preferences is broken with 1.x)
As lazerscience says, you probably want Django-dbsettings. I have a fork at Github that works with the latest Django versions.
after some playing I had dbsettings working... but with a few glitches:
- Aptana doesnt recognise the import preferences as a valid reference
- when I access my /settings/ page with the fields of the model I created and then save it I have a CSRF token missing or incorrect. error
NOTE: The official googlecode repository doesnt work (with 1.3), Daniel's version does instead (I guess he changed newforms -> forms etc). The way I created a new model for the settings veiw is:
from django.db import models
import dbsettings
class ImageLimits(dbsettings.Group):
maximum_width = dbsettings.PositiveIntegerValue()
maximum_height = dbsettings.PositiveIntegerValue()
options = ImageLimits()
You should avoid using singleton's as much as possible.
Are Singletons really that bad?
What is so bad about singletons?
For the rest, site name is editable in Django admin (see django.contrib.sites module).
Talking about keywords - it's bad to repeat them, thus, you better implement it in your item model (page, news article, etc).
Could you maybe give more examples of what do you need it for?

Categories

Resources