Re: Problem with overriding the default Django admin page.

2011-01-18 Thread Jiten Singh
Hi,

I am sending my project file details ... Hope this helps

*Project Hierarchy*

mysite/
   |--->/templates/
   |   |--->/books/(another app like dateapp)
   |   |-->/dateapp/
   |   |  |>*current_datetime.html*
   |   |  |>*hours_ahead.html*
   |   |-->*base.html*
   |
   |--->*settings.py*

*current_datetime.html*

{% extends "base.html" %}

{% block title %}The current time{% endblock %}

{% block content %}
It is now {{ current_date }}.
{% endblock %}

---
my projects settings file TEMPLATE_DIR

*TEMPLATE_DIRS* = (
 *os.path.join(os.path.dirname(__file__), 'templates').replace('\\','/'),*
# Put strings here, like "/home/html/django_templates" or
"C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)


I my case template inheritance works quite fine. [?]


It is usually not recommended to meddle with admin app of django.

I hope instead of giving the path of the file in admin app, if you copy that
file (your base.html) in you project's template dir , it may help



On Tue, Jan 18, 2011 at 8:34 AM, Mike Dewhirst wrote:

> On 18/01/2011 1:59pm, Mike Dewhirst wrote:
>
>> This is what I do ...
>>
>> in settings.py
>>
>> # this is the directory containing settings.py
>> PROJECT_DIR = os.path.realpath(os.path.dirname(__file__))
>>
>> # if templates are not found here look in app_name/templates
>> TEMPLATE_DIRS = (os.path.join(PROJECT_DIR, 'templates/'),)
>>
>> This makes my templates directory a sub-dir of the project dir and
>> inside that there are other sub-dirs one for each app and one for the
>> admin.
>>
>> I don't really need one for the admin because django knows where the
>> admin templates live inside the django tree.
>>
>> However, there is one admin template I override so that I can
>> personalise the admin. That is called base_site.html. It is ...
>>
>> PROJECT_DIR/templates/admin/base_site.html
>>
>> It is the only admin template I change
>>
>
>
> AND it is the only template in my PROJECT_DIR/templates/admin directory.
>
>
>
> and it only contains ...
>
>>
>> {% extends "admin/base.html" %}
>> {# admin/base.html is in
>> site-packages/django/contrib/admin/templates/admin #}
>> {% load i18n %}
>> {% block title %}{{ title }} | {% trans 'My site admin' %}{% endblock %}
>>
>> {% block branding %}
>> {% trans 'My administration' %}
>> {% endblock %}
>>
>> Note the comment which indicates that it inherits from the django tree
>> of admin templates.
>>
>> How does django know to look at my base_site.html while it is processing
>> the django tree of templates?
>>
>> The answer is simple and can be found in your settings.py file here ...
>>
>> TEMPLATE_LOADERS = (
>> 'django.template.loaders.filesystem.Loader',
>> 'django.template.loaders.app_directories.Loader',
>> )
>>
>> If the filesystem loader is ahead of the app_directories loader, django
>> looks in your project templates before its own. Here is the doc
>> reference ...
>>
>> http://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types
>>
>> Hope this helps
>>
>> Mike
>>
>>
>>
>>
>> On 18/01/2011 12:26pm, Chen Xu wrote:
>>
>>> I did try this, and I tried again, but it still doesn't work.
>>> Do I need to do something extra like quit the server, and restart again?
>>> By the way I did try this too.
>>>
>>> Now, I am totally lost.
>>>
>>> Thanks
>>>
>>> On Mon, Jan 17, 2011 at 3:17 AM, Vovk Donets >> > wrote:
>>>
>>> You must specify in the TEMPLATE_DIRS path to the dir where
>>> templates were placed, not abs path file
>>> So
>>> TEMPLATE_DIRS = (
>>> "/Users/xuchen81/Django/mysite/",
>>>
>>> )
>>> should work, coz' "In order to override one or more of them, first
>>> create an admin directory in your project's templates directory.
>>> This can be any of the directories you specified in TEMPLATE_DIRS
>>> <
>>> http://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATE_DIRS
>>> >."
>>>
>>>
>>> 2011/1/17 Chen Xu mailto:xuche...@gmail.com>>
>>>
>>> Hi, Django group:
>>> I am floowing the tutorial 1 on Django site, which is a poll
>>> application
>>> I have problem with overriding the admin page
>>> I copied admin/base_site.html from
>>> (django/contrib/admin/templates) to
>>> /Users/xuchen81/Django/mysite/admin/base_site.html
>>>
>>> and add this line
>>> "/Users/xuchen81/Django/mysite/admin/base_site.html"
>>> to TEMPLATE_DIRS in my settings.py file. It looks like the
>>> following:
>>>
>>> TEMPLATE_DIRS = (
>>> "/Users/xuchen81/Django/mysite/admin/base_site.html",
>>> )
>>>
>>> but the admin is just doesn't use this file, it still uses the
>>> default base_site.html.
>>>
>>> Could anyone please help me?
>>>
>>> --
>>> *Vovk Donets*
>>> python/django developer
>>>
>>> skype: suunbeeam
>>> icq: 232490857
>>> mail: donets.vladi.

Re: Google app engine django 1.2 localization

2011-03-12 Thread Jiten Singh
Hi Nick,

While working with GAE I use django provided on
http://allbuttonspressed.com, it is django non rel i know you must
have heard about it.

I have django1.2.4 final installed in my machine ,

however i use django non rel for GAE apps.. and make it part of my gae
project by symlinking to it django customized by non rel team. the version
in my shell (using ./manage.py shell) is 1.3.0 alpha...

I haven't tried localisation files yet.. just thought may be using django
non rel at allbuttonspressed team can solve your problem...



*Best Regards,*
*Jitendra*
*_discover the power of opensource_*


On Sat, Mar 12, 2011 at 2:55 PM, Nick Rosencrantz wrote:

> Dear Group, Here's a question I try to solve, Maybe you know what's
> the change between GAE+django 0.96 and GAE+django 1.2 with respect to
> localization? Putting .po and .mo files in APP_NAME/conf ... used to
> work and upgraded to django 1.2 it won't work anymore. Having upgraded
> from django 0.96 to 1.2 the i18n translations
> I got that are in addition to the builtin translations bugged out. I
> started a a question here about it
>
> http://stackoverflow.com/questions/5271687/how-to-make-django-pick-up-my-po-and-mo-translations
> ie How to make GAE+ django pick up my .po and .mo translations. I got
> translations ready in .po and .mo files. How can I make django 1.2
> display these? I can use the builtin translations and now I want to
> enable in addition the ones I keep in [application-name]/conf/locale/
> [Language_Code]/LC_MESSAGES'
>
> Is there a way? It used to work with django 0.96 and after the upgrade
> only the builtin translations work. I tried moving to APP_DIR/locale/
> LANG_CODE/LC_MESSAGES/django.po and it won't work for me. Maybe I
> missed something. Do I have to recompile .po files?
>
> Folowing the instructions from answers, I put my .po and .mo files in
>
> APP_DIR/locale/LANG_CODE/LC_MESSAGES/django.po
>
> It still won't work. I'm considering why and welcoming any more advice
> or recommendation how to enable i18n features with django for google
> app engine.
>
> If any know-how is on this issue then kindly instruct here how to
> proceed.
> Regards,
> Nick Rosencrantz
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-admin.py startproject mysite

2011-04-04 Thread Jiten Singh
Hi Santiago,

I think there is some problem in your installation of Django 1.3 , i
installed it myself and there is no problem with

*django-admin.py startproject mysite*

even the help of django-admin-py lists startproject command

I think  re-installation can work.



*Best Regards,
Jitendra
_discover the power of opensource*


On Mon, Apr 4, 2011 at 1:41 PM, Santiago Caracol  wrote:

> Hello,
>
> the Django (1.3) tutorial says:
>
> From the command line, cd into a directory where you’d like to store
> your code, then run the command django-admin.py startproject mysite.
> This will create a mysite directory in your current directory.
>
> When I run
>
> django-admin.py startproject mysite,
>
> I get this error:
>
> Unknown command: 'startproject'
> Type 'django-admin.py help' for usage.
>
>
> Using django-admin.py help, I get these subcommands:
>
> Available subcommands:
>  changepassword
>  cleanup
>  collectstatic
>  compilemessages
>  createcachetable
>  createsuperuser
>  dbshell
>  diffsettings
>  dumpdata
>  findstatic
>  flush
>  inspectdb
>  loaddata
>  makemessages
>  reset
>  runfcgi
>  runserver
>  shell
>  sql
>  sqlall
>  sqlclear
>  sqlcustom
>  sqlflush
>  sqlindexes
>  sqlinitialdata
>  sqlreset
>  sqlsequencereset
>  startapp
>  syncdb
>  test
>  testserver
>  validate
>
> Does the Django tutorial still match reality?
>
> Santiago
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.