custom dynamic admin actions

2009-09-27 Thread J

Hello,

I need to add custom dynamic admin actions (based on records in a
related table), but I'm not entirely sure how to do this, as it's not
explained in the docs.

Basically, I have two models: "Transaction", which has a foreign key to
"Account", and I want to define an admin action that will set all the
selected records in the "Transaction" model to a specific "Account".

One idea I had was to have different actions: "Set to account 1", "Set
to account 2", but I'm having trouble creating these admin actions
dynamically.

Thanks for your assistance,
J


--~--~-~--~~~---~--~~
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: Custom linking of models in many-to-one relationship

2009-09-27 Thread kmike

This looks like django's generic relations ('Content types' in
documentation).
`select_related` for generic related models is not supported in
django. So you should retreive all Notes associated with Account
manually. If there are several Accounts you still can fetch all data
in 2 queries using 'id__in' queries (example:
http://bitbucket.org/kmike/django-generic-images/src/tip/generic_utils/managers.py#cl-122).

On 28 сен, 09:17, triman  wrote:
> I have a model that can be attached to a variety of different models,
> based on the value of a column.  Is there any way to map this
> relationship in Django?  If not, is there a way to automatically do
> post-fetch processing where I could populate it?
>
> Here is a example:
>
> class Note(models.Model):
>     owner_id = models.IntegerField() #this is the FK of the related
> object
>     owner_type = models.CharField(max_length=40) # this can either be
> "Account" or "Ticket"
>     note = models.TextField()
>
> class Account(models.Model)
>     name = models.CharField(max_length=40)
>     ...
>
> class Ticket(models.Model)
>     subject = models.CharField(max_length=120)
>     ...
>
> So basically, we can attach Notes to either Account or Ticket.  The
> "owner_id" field will be the primary key of the object being attached
> to.  The "owner_type" will be either "Account" or "Ticket".  When
> retrieving an Account, I want to also return all the Notes associated
> with it.  I don't care about going the other direction in the
> relationship
>
> Is there any way to do this with the Django mappings?
--~--~-~--~~~---~--~~
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: What JavaScript framework do you use and why?

2009-09-27 Thread Jani Tiainen

Joshua Russo kirjoitti:
> Great links guys, thanks. I'm still in the mindset of frameworks just 
> making JavaScript less painful too and I'm looking for ways to move 
> beyond that. I just started looking at Dojo before posting this and it 
> definitely looks like it has potential.

I'm pretty "heavy" user of Dojo. My project is completely built on top 
of Django/Dojo using JSON-RPC to do talk with Django part.

I'm pretty happy how it works, specially declarative way to make widgets 
is pretty cool comparing to other that usually require JS markup to 
achieve same thing.

Dojango is pretty nice. I just don't use (model)forms all.

-- 
Jani Tiainen

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Custom linking of models in many-to-one relationship

2009-09-27 Thread triman

I have a model that can be attached to a variety of different models,
based on the value of a column.  Is there any way to map this
relationship in Django?  If not, is there a way to automatically do
post-fetch processing where I could populate it?

Here is a example:

class Note(models.Model):
owner_id = models.IntegerField() #this is the FK of the related
object
owner_type = models.CharField(max_length=40) # this can either be
"Account" or "Ticket"
note = models.TextField()

class Account(models.Model)
name = models.CharField(max_length=40)
...

class Ticket(models.Model)
subject = models.CharField(max_length=120)
...

So basically, we can attach Notes to either Account or Ticket.  The
"owner_id" field will be the primary key of the object being attached
to.  The "owner_type" will be either "Account" or "Ticket".  When
retrieving an Account, I want to also return all the Notes associated
with it.  I don't care about going the other direction in the
relationship

Is there any way to do this with the Django mappings?

--~--~-~--~~~---~--~~
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: strange problem with floatformat

2009-09-27 Thread jonathan

Ha no one else seen this problem, or have any idea how it might
happen?

On Sep 26, 7:44 pm, jonathan  wrote:
> Hi, I am having a strange problem with floatformat (filter) and I
> wonder if anyone else has seen it.
>
> I am using google app engine and am storing decimal.Decimal objects in
> the datastore that I am displaying in a template as money values so I
> am doing foo.methodThatReturnsDecimal|floatformat:2.
>
> The problem is that it doesn't work... but it does work if I open up a
> shell... I don't understand why. I was wondering if it could be to do
> with the django implementation of decimal
>
> The behaviour I am seeing is: Decimal("10") passed to floatformat:2
> displays on the page as "10". Where I expect to see "10.00".
>
> Does anyone have any ideas what might be going on?
>
> j
--~--~-~--~~~---~--~~
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: Admin URLs not working correctly

2009-09-27 Thread Vic Fryzel

I'm also able to reproduce this.  Trying to figure out the issue.

On Sep 27, 6:55 pm, Michael Williamson 
wrote:
> > A small, recreatable example would help.
>
> I've just recreated by doing the following, all with Django 1.1:
>
>   1. Run django-admin startproject bug
>   2. Set DATABASE_ENGINE to sqlite3 and DATABASE_NAME to /tmp/bug-
> database
>   3. Add 'django.contrib.admin' to INSTALLED_APPS
>   4. Edit urls.py so that it looks like this:
>
> from django.conf.urls.defaults import *
>
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>     (r'^admin/', include(admin.site.urls)),
> )
>
>   5. Run manage.py startapp blog
>   6. Edit models.py so it looks like this:
>
> from django.db import models
> from django.contrib import admin
>
> class Tag(models.Model):
>     name = models.CharField(max_length=50)
>
> admin.site.register(Tag)
>
>   7. Add 'bug.blog' to INSTALLED_APPS
>   8. Run manage.py syncdb
>   9. Add a VirtualHost to apache2:
>
> 
>     DocumentRoot /var/www/django-admin-bug/public
>     
>         Options Indexes FollowSymLinks
>         AllowOverride All
>         Order allow,deny
>         Allow from all
>     
> 
>
>   10. Put the following .htaccess in /var/www/django-admin-bug/public:
>
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE bug.settings
> PythonOption django.root
> PythonDebug On
> PythonPath "['/var/www/django-admin-bug'] + sys.path"
>
>   11. Set DEBUG=False
>   12. Try to add a tag, and get a 404.
>
> When running the application using manage.py runserver, the bug
> disappears, so it seems mod_python is doing something differently.

--~--~-~--~~~---~--~~
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: Why is this view not displaying data?

2009-09-27 Thread jeffself


Thanks Karen!  That did the trick.
--~--~-~--~~~---~--~~
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: Why is this view not displaying data?

2009-09-27 Thread Karen Tracey
On Sun, Sep 27, 2009 at 8:41 PM, jeffself  wrote:

>
> Here's my url.py:
>
> from django.conf.urls.defaults import *
>
> urlpatterns = patterns('Rankings.college.views',
>url(r'^rankings/division/(\w+)/$', 'rankings_by_league'),
> )
>
> views.py
>
> def rankings_by_league(request, league):
>try:
>league = League.objects.get(slug__iexact=league)
>except League.DoesNotExist:
>raise Http404
>
>return list_detail.object_list(
>request,
>queryset = SchoolSeason.objects.all(),
>template_name = "college/rankings_by_league.html",
>template_object_name = "rankings",
>extra_context = {"league": league}
>)
>
> rankings_by_league.html
> {% extends "base.html" %}
>
> {% block title %}My rankings {% endblock %}
>
> {% block content %}
>
> 2009 {{ league.league_name }} Rankings
>
> 
>{% for ranking in rankings %}
>{{ ranking.school.school_name}} {{ ranking.wins}}
> {{ ranking.losses}} {{ ranking.rating}}
>{% endfor %}
> 
>
> {% endblock %}
>
> I've spent my entire Sunday looking at this and can't figure it out.
> Only thing that displays is the  tag.
>

Doc here:

http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-list-detail-object-list

states that _list will be appended to the value of your template_object_name
to create the variable name used in the context.  So try iterating through
rankings_list.

Karen

--~--~-~--~~~---~--~~
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: Update only selected fields

2009-09-27 Thread Karen Tracey
On Sun, Sep 27, 2009 at 7:17 PM, jsk  wrote:

>
> Hi all,
>
> I was wondering if there is built-in support for updating only
> selected field(s) when calling model.save().
> When I call save() on the object, django call SQL UPDATE for all
> fields of the model, which is not ideal from performance point of
> view.
> I've found this snippet: http://www.djangosnippets.org/snippets/479/
>
> But I'm asking myself if there is django built-in solution for this
> problem, or better trick ?
>
>
No, there is no built-in support for this.  As that snippet notes, there is
a ticket requesting it:

http://code.djangoproject.com/ticket/4102

Karen

--~--~-~--~~~---~--~~
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: DateFormat in Django and Appengine

2009-09-27 Thread Karen Tracey
On Sun, Sep 27, 2009 at 6:51 PM, Peter Newman <
peter.newman@googlemail.com> wrote:

>
> Guys -
>
> I have a slight issue with dates in Django and appengine:
>
> I have the following class because i want date input in the form of DD/
> MM/YY
>
> class MyForm(ModelForm):
>  mydate = forms.DateTimeField(input_formats=['%d-%m-%y', '%d/%m/
> %y'])
>  class Meta:
>  model = MyObject
>
> This works for entering into the datastore.
> However when i use a generic view to edit the data the form comes back
> in the format of -MM-DD. Any ideas on how to change that?
>
>
Specify the format you want for existing values as the format parameter to a
DateTimeInput widget for the form field:

http://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.DateTimeInput

Note this is new in Django 1.1 so you will need to be running at least that
level.

Karen

--~--~-~--~~~---~--~~
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: TypeError: save() got an unexpected keyword argument 'profile_callback'

2009-09-27 Thread Karen Tracey
On Sun, Sep 27, 2009 at 6:04 PM, Gloria  wrote:

>
> Hi All,
>
> I have inherited some Django code, I'm porting it to a new machine,
> and here is an error I'm getting, which is proving to be hard to
> trace:
>
> Traceback (most recent call last):
>
>  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> base.py", line 92, in get_response
>response = callback(request, *callback_args, **callback_kwargs)
>
>  File "build/bdist.linux-x86_64/egg/registration/views.py", line 148,
> in register
>new_user = form.save(profile_callback=profile_callback)
>
> TypeError: save() got an unexpected keyword argument
> 'profile_callback'
>
> I can't find build/bdist.linux-x86_64/egg/registration/views.py on my
> system, strangely enough. Is this portion of Django byte compiled,
> then removed?
>
>
This isn't part of Django at all, it's an add-on package.  At a guess it is
django-registration, and whatever build/install process was used to put it
on this machine resulted in the file spec you see.

If you dig into the history of the views.py file in django-registration
here:

http://bitbucket.org/ubernostrum/django-registration/history/registration/views.py

you'll see the last change (made in January of 2009) removed the
previously-required profile_callback keyword parameter for save of the form
used during registration.

I'd guess then that you are moving code from a machine that had a "latest"
copy of django-registration installed to a machine that has an older level,
and that is what is causing the problem.  Removing the old level and
installing latest will likely fix it -- but could potentially break any
other apps on this machine that are using the old level of
django-registration.

Karen

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Why is this view not displaying data?

2009-09-27 Thread jeffself

Here's my url.py:

from django.conf.urls.defaults import *

urlpatterns = patterns('Rankings.college.views',
url(r'^rankings/division/(\w+)/$', 'rankings_by_league'),
)

views.py

def rankings_by_league(request, league):
try:
league = League.objects.get(slug__iexact=league)
except League.DoesNotExist:
raise Http404

return list_detail.object_list(
request,
queryset = SchoolSeason.objects.all(),
template_name = "college/rankings_by_league.html",
template_object_name = "rankings",
extra_context = {"league": league}
)

rankings_by_league.html
{% extends "base.html" %}

{% block title %}My rankings {% endblock %}

{% block content %}

2009 {{ league.league_name }} Rankings


{% for ranking in rankings %}
{{ ranking.school.school_name}} {{ ranking.wins}}
{{ ranking.losses}} {{ ranking.rating}}
{% endfor %}


{% endblock %}

I've spent my entire Sunday looking at this and can't figure it out.
Only thing that displays is the  tag.
--~--~-~--~~~---~--~~
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: Admin URLs not working correctly

2009-09-27 Thread Karen Tracey
On Sun, Sep 27, 2009 at 6:55 PM, Michael Williamson <
mikerwilliam...@yahoo.co.uk> wrote:

>
> > A small, recreatable example would help.
>
> I've just recreated by doing the following, all with Django 1.1:
>
>  1. Run django-admin startproject bug
>  2. Set DATABASE_ENGINE to sqlite3 and DATABASE_NAME to /tmp/bug-
> database
>  3. Add 'django.contrib.admin' to INSTALLED_APPS
>  4. Edit urls.py so that it looks like this:
>
> from django.conf.urls.defaults import *
>
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
> (r'^admin/', include(admin.site.urls)),
> )
>
>   5. Run manage.py startapp blog
>  6. Edit models.py so it looks like this:
>
> from django.db import models
> from django.contrib import admin
>
> class Tag(models.Model):
>name = models.CharField(max_length=50)
>
> admin.site.register(Tag)
>
>
Ah.  You've put your admin.site.register call in models.py.  This should go
in an admin.py file, not models.py.  Whether your model is registered with
admin is being determined by the accident of whether your models.py file has
happened to be loaded at the time you attempt to access it in admin.  Your
models.py file will have been loaded when running under the development
server, since it does explicit model validation during startup.  Similarly
the admin validation done when DEBUG=True will have ensured that your
models.py file is loaded when you first attempt to access admin.

When running under Apache with DEBUG=False, however, there has not
necessarily been any need to load your models.py by the time you attempt to
access admin. That's why you are getting 404 errors...that call to
admin.site.register has not yet been made.

admin.autodiscover() and placing admin registrations in admin.py files (what
are loaded by admin.autodiscover()) ensures that model registrations happen
once and only once, at a predictable time, regardless of deployment scenario
and debug setting.  If you move your admin registrations to an admin.py file
I believe your problem will go away.

Karen

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Update only selected fields

2009-09-27 Thread jsk

Hi all,

I was wondering if there is built-in support for updating only
selected field(s) when calling model.save().
When I call save() on the object, django call SQL UPDATE for all
fields of the model, which is not ideal from performance point of
view.
I've found this snippet: http://www.djangosnippets.org/snippets/479/

But I'm asking myself if there is django built-in solution for this
problem, or better trick ?

Thanks

J.

--~--~-~--~~~---~--~~
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: Admin URLs not working correctly

2009-09-27 Thread Michael Williamson

> A small, recreatable example would help.

I've just recreated by doing the following, all with Django 1.1:

  1. Run django-admin startproject bug
  2. Set DATABASE_ENGINE to sqlite3 and DATABASE_NAME to /tmp/bug-
database
  3. Add 'django.contrib.admin' to INSTALLED_APPS
  4. Edit urls.py so that it looks like this:

from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
)

  5. Run manage.py startapp blog
  6. Edit models.py so it looks like this:

from django.db import models
from django.contrib import admin

class Tag(models.Model):
name = models.CharField(max_length=50)

admin.site.register(Tag)

  7. Add 'bug.blog' to INSTALLED_APPS
  8. Run manage.py syncdb
  9. Add a VirtualHost to apache2:


DocumentRoot /var/www/django-admin-bug/public

Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all



  10. Put the following .htaccess in /var/www/django-admin-bug/public:

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE bug.settings
PythonOption django.root
PythonDebug On
PythonPath "['/var/www/django-admin-bug'] + sys.path"

  11. Set DEBUG=False
  12. Try to add a tag, and get a 404.

When running the application using manage.py runserver, the bug
disappears, so it seems mod_python is doing something differently.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



DateFormat in Django and Appengine

2009-09-27 Thread Peter Newman

Guys -

I have a slight issue with dates in Django and appengine:

I have the following class because i want date input in the form of DD/
MM/YY

class MyForm(ModelForm):
  mydate = forms.DateTimeField(input_formats=['%d-%m-%y', '%d/%m/
%y'])
  class Meta:
  model = MyObject

This works for entering into the datastore.
However when i use a generic view to edit the data the form comes back
in the format of -MM-DD. Any ideas on how to change that?

Thanks
Peter
--~--~-~--~~~---~--~~
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: TypeError: save() got an unexpected keyword argument 'profile_callback'

2009-09-27 Thread Gloria

Some logging debug, placed in /usr/local/lib/python2.6/dist-packages/
django/core/handlers/base.py:

   import logging
import pprint
logging.error("Args: %s %s %s %s" % (pprint.pformat
(callback),pprint.pformat(callback_args),pprint.pformat
(callback_kwargs),pprint.pformat(request.path_info)))

response = callback(request, *callback_args,
**callback_kwargs


The results:

2009-09-27 18:20:56,279 root: ERRORArgs:  () {'form_class': } u'/users/
register/'
--~--~-~--~~~---~--~~
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: Modeling and validating international addresses?

2009-09-27 Thread Nan


Google finds one app that seems pretty heavyweight (and poorly
documented):

http://code.google.com/p/django-global-contact/

At first glance, building a model that can read address formats from a
database for forms and output should be fairly straightforward, but
input validation is much more difficult to do.

I'll probably end up with very loosely validated US-style addresses
(with a "not in US or Canada" state option as a stopgap for the non-
North-American folks), and then implement some sort of global solution
if the site takes off.  It's looking like the return on effort isn't
worth it at this point.


On Sep 27, 4:58 pm, Wim Feijen  wrote:
> Hi ringmeup again,
>
> What I would do is choose the most common one and use that. In many
> web applications I find that people use American-style addresses,
> where I have to enter my state which has no equivalent in the
> Netherlands, but nevertheless I have to.
>
> Another good solution would be to define a common BaseAddress on which
> you expend for each country's customs, and if you want to make your
> application really slick, you can throw in some Javascript to
> dynamically alter the form displayed. Though I would certainly opt for
> simplicity and let the user first select a country, and then render
> the appropriate form in the next script.
>
> What does google find?
>
> Wim
>
> On Sep 26, 10:34 pm, ringemup  wrote:
>
> > I can't be the only person building an app that needs to be able to
> > take mailing addresses from people all over the world, not just in one
> > country.  How have you handled models and validation for international
> > addresses?
--~--~-~--~~~---~--~~
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: Overriding verbose_name in contrib or 3rd-party apps?

2009-09-27 Thread Nan


Thanks for the suggestions, everyone.

It seems to be popping up for all sorts of things -- from changing
verbose_name in order to globally relabel form fields in ModelForms to
changing __unicode__ methods to change template output.  I know there
are workarounds, but they seem less DRY.

On Sep 27, 5:02 pm, Michael Williamson 
wrote:
> On Sep 25, 9:59 pm, ringemup  wrote:
>
> > Is there an easy way to override strings like help_text or
> > verbose_name or __unicode__ methods for models in contrib or third-
> > party apps?  I can't seem to find anything on Google.
>
> > Thanks!
>
> A reasonably hacktastic way of doing this is monkey-patching. For
> instance, say you want to override the __unicode__ method of the class
> Blog. Firstly, write the new method e.g.
>
> def new_unicode(self):
> return self._name
>
> Then, set the __unicode__ method of Blog to your new function:
>
> Blog.__unicode__ = new_unicode
>
> Is this a horrible piece of code? Absolutely. But it is quick, and it
> works. A clean solution depends more on why you actually want to do
> this.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



TypeError: save() got an unexpected keyword argument 'profile_callback'

2009-09-27 Thread Gloria

Hi All,

I have inherited some Django code, I'm porting it to a new machine,
and here is an error I'm getting, which is proving to be hard to
trace:

Traceback (most recent call last):

  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py", line 92, in get_response
response = callback(request, *callback_args, **callback_kwargs)

  File "build/bdist.linux-x86_64/egg/registration/views.py", line 148,
in register
new_user = form.save(profile_callback=profile_callback)

TypeError: save() got an unexpected keyword argument
'profile_callback'

I can't find build/bdist.linux-x86_64/egg/registration/views.py on my
system, strangely enough. Is this portion of Django byte compiled,
then removed?

I'm running Django 1.2 Apha (although this also happens in 1.1) with
Satchmo 0.9 on a Debian EC2 instance using WSGI. My weekend is shot :)

Thank you in advance,
Gloria

--~--~-~--~~~---~--~~
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: Admin URLs not working correctly

2009-09-27 Thread Michael Williamson

> You've listed one that doesn't work -- /admin/blog/comment/add.  Is comment
> listed as a model at all under /admin/blog when things break?  Does
> /admin/blog/comment/ work to show a change list of comment models?  Can you
> bring up a detail page on an existing one?  Successfully change it?  I'm
> trying to figure out if something has happened to cause the comment model to
> disappear entirely from admin or if it's still partly there but broken.  If
> only partially broken, what parts, exactly, are broken?

Here's the error when DEBUG=True, and I've commented out the bit of
code that fixes the problem when DEBUG=True:

 Using the URLconf defined in mikesite.urls, Django tried these URL
patterns, in this order:

   1. ^$
   2. ^blog/
   3. ^admin/ ^$
   4. ^admin/ ^logout/$
   5. ^admin/ ^password_change/$
   6. ^admin/ ^password_change/done/$
   7. ^admin/ ^jsi18n/$
   8. ^admin/ ^r/(?P\d+)/(?P.+)/$
   9. ^admin/ ^(?P\w+)/$
  10. ^admin/ ^auth/user/
  11. ^admin/ ^auth/group/

So, I can't add one, view a list of existing ones, or change an
existing one. All I seem to be able to do with the blog app is visit /
admin/blog/.

> Again, I don't understand how that would help.  Someone did recently open a
> ticket (http://code.djangoproject.com/ticket/11918) saying that switching to
> the older url pattern for admin worked with DEBUG=False where the current
> one did not, but you haven't actually switched all the way back to the old
> pattern here.

Turns out I'm a fool. Changing the regex didn't really help -- it
stopped 404s coming up, but it also started showing the wrong pages,
so disregard this as a fix.

> Plenty of people are using the 1.1 pattern without trouble,
> so there's something in the configs where problems arise that is different.
> We've not gotten enough specifics on the failing configs for me to have any
> idea what it might be.  A small, recreatable example would help.

I'll try coming up with the smallest failing example tomorrow.

Thanks for the reply

Mike
--~--~-~--~~~---~--~~
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: en vs. en_US (was 'Problems creating a new locale')

2009-09-27 Thread Lewis Taylor

Hi michael,

the language code should always be in the form xx or xx-xx and the
locale folders should be in the form xx or xx_XX. If you look through
the translation code you can see that what django does is given a
language xx-xx, it will check for xx_XX locale then xx. given xx (en
for example), it'll just look for locale xx, it won't search for more
specific dialects.

One flaw is that if django doesn't find the specified language in the
conf/locale folder of the django directory, it returns the default
language code in the settings, so you must have en_US in the django
locale directory if you want specific languages.




On Sep 26, 4:31 pm, Michael Scheper  wrote:
> Hello again,
>
> I poked at this a bit more yesterday and traced this problem to core
> Python behaviour. The critical line of Django code is in the
> django.utils.translation.trans_real.translation(language) function, in
> _translation() under _fetch():
>
> t = gettext_module.translation('django', path, [loc], klass)
>
> When the value of loc doesn't include a territory (i.e. when it's
> 'en', and not something like 'en_AU' or 'en_US'), you really don't
> know which locale you're going to get. I've experimented with it and
> it seems to depend on what order the file system returns the locale
> directories. I've written in the Django i18n forums about this 
> (seehttp://www.nabble.com/Strange-gettext.find-results-td25621560.html)
> but I would call this a bug, either in Django or Python.
>
> As a result of this bug, users in Portugal might see the Brazilian
> content, and users in Spain might see Argentine content. Luckily,
> Django has separate locales for zh_CH and zh_TW, not just zh;
> otherwise, things could have gotten /really/ nasty!
>
> In any case, to solve my own problem, I'm working on a hack for
> LocaleMiddleware so it looks at request.META.HTTP_ACCEPT_LANGUAGE if
> request.LANGUAGE_CODE is 'en', and chooses the right locale,
> regardless of whether Django supports it yet.
>
> Cheers,
> MS.
>
> On Sep 21, 1:43 pm, Michael Scheper  wrote:
>
> > G'day everyone,
>
> > What I want to do: To keep my American users happy, I want to localise
> > my site for en-us locale users. That way, they'll see all the dropped
> > 'u's and past participles and other things that don't exist in 'U.S.
> > English' (and that U.S. date format and all the other spelling
> > variations), but my site will still be correct for users in en-au, en-
> > nz, en-gb, en-za, en-ca, etc.
>
> > Unfortunately, it's not working. Even when I have my browser set to
> > U.S. English, the version of my site I see is in international
> > English.
>
> > Details: I'm using Python 2.5.2, and 'Django version 1.0-final-SVN-
> > unknown'.
>
> > What I've tried:
>
> > 1. I've made sure that i18n/l10n is working in general by translating
> > a few things to Dutch (nl) and setting my browser to that locale. It
> > works. (This article helped a 
> > lot:http://devdoodles.wordpress.com/2009/02/14/multi-language-support-in-...)
>
> > 2. According tohttp://docs.djangoproject.com/en/dev/topics/i18n/,
> > 'Django does not support localizing your application into a locale for
> > which Django itself has not been translated. [...] If you want to
> > support a locale for your application that is not already part of
> > Django, you'll need to make at least a minimal translation of the
> > Django core.' I've done this by copying the 'en' directory to 'en_US'
> > in /var/lib/python-support/python2.5/django/conf/locale and /usr/share/
> > python-support/python-django/django/conf/locale.* I also set LANGUAGES
> > to include only 'en' and 'en-us' (and 'nl') in settings.py. Since I
> > did these two things, putting {{ request.LANGUAGE_CODE }} in a
> > template yields 'en-us' when I set my browser to U.S. English, and
> > just 'en' when I use other English locales. (Before doing these
> > things, it returned 'en' regardless of which English locale I had my
> > browser set to.)
>
> > 3. I used django-admin makemessages -l en and django-admin
> > makemessages -l en-us to create language files, created the American
> > translations, and ran django-admin compilemessages. (I also tried
> > using en_US instead of en-us, since that's the standard used in the
> > two system directories I noted above. No difference.)
>
> > What's not working: The U.S. English text isn't showing up when I set
> > my browser to U.S. English, even though {{ request.LANGUAGE_CODE }}
> > does display 'en-us'.
>
> > * I have root on my own development server, so I was able to copy
> > these locale directories. My web host probably won't let me do this,
> > however, so I need to find another way that works.
>
> > Any advice?
--~--~-~--~~~---~--~~
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 

Re: Admin URLs not working correctly

2009-09-27 Thread Karen Tracey
On Sun, Sep 27, 2009 at 4:41 PM, Michael Williamson <
mikerwilliam...@yahoo.co.uk> wrote:

>
> Admin URLs do not seem to behaving themselves for me. My urls.py looks
> like this:
>
>from django.conf.urls.defaults import *
>
>from django.contrib import admin
>admin.autodiscover()
>
>urlpatterns = patterns('',
>(r'^$', 'django.views.generic.simple.redirect_to', {'url': '/
> blog/'}),
>(r'^blog/', include('mikesite.blog.urls')),
>(r'^admin/', include(admin.site.urls)),
>)
>
> When DEBUG=True, the admin interface works fine. When DEBUG=False, I
> get 404 errors when I attempt to access some URLs, such as /admin/blog/
> comment/add/, yet others, such as /admin/blog/ or /admin/auth/user/
> add/ work just fine.
>

You've listed one that doesn't work -- /admin/blog/comment/add.  Is comment
listed as a model at all under /admin/blog when things break?  Does
/admin/blog/comment/ work to show a change list of comment models?  Can you
bring up a detail page on an existing one?  Successfully change it?  I'm
trying to figure out if something has happened to cause the comment model to
disappear entirely from admin or if it's still partly there but broken.  If
only partially broken, what parts, exactly, are broken?


>
> After some digging around, I found that setting DEBUG=True fixes the
> problem since this enables validation in django.contrib.admin.sites
> (lines 69 to 72). When DEBUG is True,
> django.contrib.admin.validation.validate is called, which in turn
> calls django.db.models.get_apps().
>
> Putting django.db.models.get_apps() at the top of urls.py fixes the
> problem e.g.
>
>from django.conf.urls.defaults import *
>
>from django.contrib import admin
>admin.autodiscover()
>
>from django.db import models
>models.get_apps()
>
>
It surprises me that putting something after the call to autodiscover()
could fix the problem.  It sounds like the call to autodiscover() is running
into trouble and not ending up registering all your models (causing 404
errors on some attempts to access them).  I don't see how putting something
after the call to autodiscover() would fix that.

This type of workaround sounds vaguely like some posted for this ticket:
http://code.djangoproject.com/ticket/10405.  You might read through that and
see if your models share characteristics with those in use by people who
have posted there.  If so, the root problem may be similar.



>urlpatterns = patterns('',
>(r'^$', 'django.views.generic.simple.redirect_to', {'url': '/
> blog/'}),
>(r'^blog/', include('mikesite.blog.urls')),
>(r'^admin/', include(admin.site.urls)),
>)
>
> I can also fix the problem by slightly changing the admin regex like
> so:
>
>from django.conf.urls.defaults import *
>
>from django.contrib import admin
>admin.autodiscover()
>
>urlpatterns = patterns('',
>(r'^$', 'django.views.generic.simple.redirect_to', {'url': '/
> blog/'}),
>(r'^blog/', include('mikesite.blog.urls')),
>(r'^admin/.*', include(admin.site.urls)),
>)
>
>
Again, I don't understand how that would help.  Someone did recently open a
ticket (http://code.djangoproject.com/ticket/11918) saying that switching to
the older url pattern for admin worked with DEBUG=False where the current
one did not, but you haven't actually switched all the way back to the old
pattern here.  Plenty of people are using the 1.1 pattern without trouble,
so there's something in the configs where problems arise that is different.
We've not gotten enough specifics on the failing configs for me to have any
idea what it might be.  A small, recreatable example would help.

Karen

--~--~-~--~~~---~--~~
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: Overriding verbose_name in contrib or 3rd-party apps?

2009-09-27 Thread Michael Williamson

On Sep 25, 9:59 pm, ringemup  wrote:
> Is there an easy way to override strings like help_text or
> verbose_name or __unicode__ methods for models in contrib or third-
> party apps?  I can't seem to find anything on Google.
>
> Thanks!

A reasonably hacktastic way of doing this is monkey-patching. For
instance, say you want to override the __unicode__ method of the class
Blog. Firstly, write the new method e.g.

def new_unicode(self):
return self._name

Then, set the __unicode__ method of Blog to your new function:

Blog.__unicode__ = new_unicode

Is this a horrible piece of code? Absolutely. But it is quick, and it
works. A clean solution depends more on why you actually want to do
this.
--~--~-~--~~~---~--~~
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: Modeling and validating international addresses?

2009-09-27 Thread Wim Feijen

Hi ringmeup again,

What I would do is choose the most common one and use that. In many
web applications I find that people use American-style addresses,
where I have to enter my state which has no equivalent in the
Netherlands, but nevertheless I have to.

Another good solution would be to define a common BaseAddress on which
you expend for each country's customs, and if you want to make your
application really slick, you can throw in some Javascript to
dynamically alter the form displayed. Though I would certainly opt for
simplicity and let the user first select a country, and then render
the appropriate form in the next script.

What does google find?

Wim


On Sep 26, 10:34 pm, ringemup  wrote:
> I can't be the only person building an app that needs to be able to
> take mailing addresses from people all over the world, not just in one
> country.  How have you handled models and validation for international
> addresses?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Admin URLs not working correctly

2009-09-27 Thread Michael Williamson

Admin URLs do not seem to behaving themselves for me. My urls.py looks
like this:

from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^$', 'django.views.generic.simple.redirect_to', {'url': '/
blog/'}),
(r'^blog/', include('mikesite.blog.urls')),
(r'^admin/', include(admin.site.urls)),
)

When DEBUG=True, the admin interface works fine. When DEBUG=False, I
get 404 errors when I attempt to access some URLs, such as /admin/blog/
comment/add/, yet others, such as /admin/blog/ or /admin/auth/user/
add/ work just fine.

After some digging around, I found that setting DEBUG=True fixes the
problem since this enables validation in django.contrib.admin.sites
(lines 69 to 72). When DEBUG is True,
django.contrib.admin.validation.validate is called, which in turn
calls django.db.models.get_apps().

Putting django.db.models.get_apps() at the top of urls.py fixes the
problem e.g.

from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

from django.db import models
models.get_apps()

urlpatterns = patterns('',
(r'^$', 'django.views.generic.simple.redirect_to', {'url': '/
blog/'}),
(r'^blog/', include('mikesite.blog.urls')),
(r'^admin/', include(admin.site.urls)),
)

I can also fix the problem by slightly changing the admin regex like
so:

from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^$', 'django.views.generic.simple.redirect_to', {'url': '/
blog/'}),
(r'^blog/', include('mikesite.blog.urls')),
(r'^admin/.*', include(admin.site.urls)),
)

I'm using Django 1.1.

If anybody could shed some light on this, it would be greatly
appreciated.

Mike

--~--~-~--~~~---~--~~
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: Overriding verbose_name in contrib or 3rd-party apps?

2009-09-27 Thread Wim Feijen

Can you please post some more information for what purpose you like to
do this?

My first guess would be you are using the admin interface. Dirty
workarounds are: copying code and adapting it, importing from your
adaptation in stead of the original. Maybe modifying the admin view to
do something differently. Or adapt a translation?

Probably there are a hundred better ways, but you can try these for a
start.

Wim

On Sep 25, 10:59 pm, ringemup  wrote:
> Is there an easy way to override strings like help_text or
> verbose_name or __unicode__ methods for models in contrib or third-
> party apps?  I can't seem to find anything on Google.
>
> Thanks!
--~--~-~--~~~---~--~~
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: can't show admin interface

2009-09-27 Thread Wim Feijen

It does nothing to help you solve your problem, but mod_wsgi is
generally preferred above mod python.

Good luck solving the problem!

Wim

On Sep 26, 10:06 am, nausikaa  wrote:
> Have you done
>
> from yourapp.models import *
> from django.contrib import admin
>
> admin.site.register(Books)
>
> in admin.py?
>
> On Sep 26, 4:55 am, pengwupeng  wrote:
>
> > the environment is  apache+django, accessing   my app is ok,but i
> > can't access the admin interface.
> > the configuration  of the httpd.conf  is likes this below:
> >     Listen 127.0.0.1:
> > 
> > 
> >     SetHandler python-program
> >     PythonPath "sys.path+['c:/']"
> >     PythonHandler django.core.handlers.modpython
> >     SetEnv DJANGO_SETTINGS_MODULE Djangoproject.settings
> >     PythonInterpreter books
> >     PythonDebug On
> > 
>
> > #Alias /site_media
> > Alias /site_media c:/Djangoproject/media
> > 
> >     AllowOverride None
> >     Options FollowSymLinks MultiViews Indexes
> >     Order allow,deny
> >     Allow from all
> > 
> > 
> >        SetHandler None
> > 
>
> > #Alias /media
> > Alias /media C:/Python25/Lib/site-packages/django/contrib/admin/media
> > 
> >     AllowOverride None
> >     Options FollowSymLinks MultiViews Indexes
> >     Order allow,deny
> >     Allow from all
> > 
> > 
> >        SetHandler None
> > 
> > # file types we want to serve statically
> > # case insensative match
> > 
> >        SetHandler None
> > 
> > 
>
> > Environment:
>
> > Request Method: GET
> > Request URL:http://localhost:/admin/
> > Django Version: 1.1
> > Python Version: 2.5.4
> > Installed Applications:
> > ['django.contrib.auth',
> >  'django.contrib.contenttypes',
> >  'django.contrib.sessions',
> >  'django.contrib.sites',
> >  'django.contrib.admin',
> >  'Djangoproject.books']
> > Installed Middleware:
> > ('django.middleware.common.CommonMiddleware',
> >  'django.contrib.sessions.middleware.SessionMiddleware',
> >  'django.contrib.auth.middleware.AuthenticationMiddleware')
>
> > Template error:
> > In template c:\python25\lib\site-packages\django\contrib\admin
> > \templates\admin\base.html, error at line 30
> >    Caught an exception while rendering: Could not import
> > Djangoproject.books.search. Error was: No module named books.models
> >    20 :     
>
> >    21 :     
>
> >    22 :         
>
> >    23 :         {% block branding %}{% endblock %}
>
> >    24 :         
>
> >    25 :         {% if user.is_authenticated and user.is_staff %}
>
> >    26 :         
>
> >    27 :             {% trans 'Welcome,' %}
>
> >    28 :             {% firstof user.first_name user.username %}
> > .
>
> >    29 :             {% block userlinks %}
>
> >    30 :                  {% url django-admindocs-docroot as docsroot
> > %}
>
> >    31 :                 {% if docsroot %}
>
> >    32 :                     {% trans
> > 'Documentation' %} /
>
> >    33 :                 {% endif %}
>
> >    34 :                 {% url admin:password_change as
> > password_change_url %}
>
> >    35 :                 {% if password_change_url %}
>
> >    36 :                     
>
> >    37 :                 {% else %}
>
> >    38 :                     
>
> >    39 :                 {% endif %}
>
> >    40 :                 {% trans 'Change password' %} /
>
> > Traceback:
> > File "C:\Python25\Lib\site-packages\django\core\handlers\base.py" in
> > get_response
> >   92.                 response = callback(request, *callback_args,
> > **callback_kwargs)
> > File "C:\Python25\Lib\site-packages\django\contrib\admin\sites.py" in
> > wrapper
> >   196.                 return self.admin_view(view, cacheable)(*args,
> > **kwargs)
> > File "C:\Python25\Lib\site-packages\django\views\decorators\cache.py"
> > in _wrapped_view_func
> >   44.         response = view_func(request, *args, **kwargs)
> > File "C:\Python25\Lib\site-packages\django\contrib\admin\sites.py" in
> > inner
> >   186.             return view(request, *args, **kwargs)
> > File "C:\Python25\Lib\site-packages\django\views\decorators\cache.py"
> > in _wrapped_view_func
> >   44.         response = view_func(request, *args, **kwargs)
> > File "C:\Python25\Lib\site-packages\django\contrib\admin\sites.py" in
> > index
> >   374.             context_instance=context_instance
> > File "C:\Python25\Lib\site-packages\django\shortcuts\__init__.py" in
> > render_to_response
> >   20.     return HttpResponse(loader.render_to_string(*args,
> > **kwargs), **httpresponse_kwargs)
> > File "C:\Python25\Lib\site-packages\django\template\loader.py" in
> > render_to_string
> >   108.     return t.render(context_instance)
> > File "C:\Python25\Lib\site-packages\django\template\__init__.py" in
> > render
> >   178.         return self.nodelist.render(context)
> > File "C:\Python25\Lib\site-packages\django\template\__init__.py" in
> > render
> >   779.                 bits.append(self.render_node(node, context))
> > File 

Re: rendering a table

2009-09-27 Thread Wim Feijen

Hi Hugo,

Your template code, does it actually contains  and  ?
Like below?


{% for row in rows %}

{% for value in row %}
{{ value }}
{% endfor %}

{% endfor %}


Then, what does rows look like? Can you post your output please? To
get this output, for example, use "print rows" before you render the
template, and post the result here. That would help!

Wim

On Sep 27, 6:37 pm, jhugo  wrote:
> What i want to display as a table is the fallowing:
>
> rows---row---       row         ---row
>            |               |               |
>            number1  name1   date1
>            number2  name2   date2
>            number3  name3   date3
>
> Now when django renders my template i get this:
>
> number1  name1   date1
> number1  name1   date1 number2  name2   date2
> number1  name1   date1 number2  name2   date2 number3  name3   date3
>
> Is this better? I am not getting why i am getting this behavior?
>
> On Sep 27, 5:48 am, Léon Dignòn  wrote:
>
> > Could you post your list and your output please?
>
> > On Sep 27, 2:04 am, jhugo  wrote:
>
> > > Hi,
>
> > > I want to render a table using a list of list. What I do is create a
> > > list for the rows and append another list for the columns. I use two
> > > fors in my template to render the table and as the first loop progress
> > > the second always renders the values from the beginning and a i end up
> > > having my rows incrementing in length. Why is this?
>
> > > this is what i have:
>
> > > {% for row in rows %}
> > > 
> > > {% for value in row %}
> > > {{ value }}
> > > {% endfor %}
> > > 
> > > {% endfor %}
>
> > > Thanks,
>
> > > -- Hugo
--~--~-~--~~~---~--~~
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: OperationalError: unable to open database file, when saving existing object

2009-09-27 Thread Wim Feijen

So, if I understand correctly, creating new objects and saving them to
the database works correctly, and updating objects fails. Is that
correct? Is it an update from the admin interface or from code written
by you?

If the former, it might have something to do with db privileges. Which
back-end are you using, sqlite? In that case, are you running the
project while being the same user as the owner of the sqlite db-file?
If the back-end is another database, did you edit and modify write
privileges?

Wim


On Sep 27, 3:28 pm, pigmalione  wrote:
> Hello,
>
> When I attempt to save an existing db object I get the following
> error:
>
>   File "", line 1, in 
>   File "/usr/lib/python2.5/site-packages/django/db/models/base.py",
> line 410, in
>  save
>     self.save_base(force_insert=force_insert,
> force_update=force_update)
>   File "/usr/lib/python2.5/site-packages/django/db/models/base.py",
> line 474, in
>  save_base
>     rows = manager.filter(pk=pk_val)._update(values)
>   File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> line 444, i
> n _update
>     return query.execute_sql(None)
>   File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> subqueries.py", li
> ne 120, in execute_sql
>     cursor = super(UpdateQuery, self).execute_sql(result_type)
>   File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> query.py", line 23
> 69, in execute_sql
>     cursor.execute(sql, params)
>   File "/usr/lib/python2.5/site-packages/django/db/backends/util.py",
> line 19, i
> n execute
>     return self.cursor.execute(sql, params)
>   File "/usr/lib/python2.5/site-packages/django/db/backends/sqlite3/
> base.py", li
> ne 193, in execute
>     return Database.Cursor.execute(self, query, params)
> OperationalError: unable to open database file
>
> I can keep saving new objects, but once I edit an attribute and
> attempt to save, I get the above message.
>
> Can someone suggest something?
>
> Thanks a lot.
--~--~-~--~~~---~--~~
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: Moving the .py(c|o) files out of the app?

2009-09-27 Thread Ned Batchelder

Python doesn't give you a way to write the .pyc files anywhere except 
next to their .py files.  But you can compile everything ahead of time, 
and then either move the .pyc files somewhere else or just delete the 
.py files (assuming you have another copy!)

The python module compileall is just for this purpose:

$ python -m compileall .

will search the tree rooted in the current directory for .py files newer 
than their .pyc files, and compile them.

--Ned.
http://nedbatchelder.com

Christophe Pettus wrote:
> This is more a deployment question, but: Is there a way of specifying  
> a directory other than the app folder hierarchy for the .pyc or .pyo  
> files to be written to?  In production, I'm not wild about the idea of  
> the app folders being writable by the Apache process.  Any guidance?
> Thanks?
>
> --
> -- Christophe Pettus
> x...@thebuild.com
>
>
> >
>
>   

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



formfield_overrides for a specific field

2009-09-27 Thread tygielzchaosem

Hey all,

Is it possible to use ModelAdmin.formfield_overrides attribute to
customize a widget for only one field in an admin form, not for all
fields of a certain type in a model?

Say we have an admin class like this:

class MyModelAdmin(admin.ModelAdmin):
formfield_overrides = {
models.TextField: {
'widget': forms.Textarea(attrs={'cols': '100', 'rows':
'20'})
},
}
admin.site.register(MyModel MyModelAdmin)

If there were more then one fields in MyModel of type TextField, all
of them would be affected. It would be useful to have a modifier
targeting a field instance, not a field type.

Best Regards,
TygielZChaosem
--~--~-~--~~~---~--~~
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: Authentication for static files

2009-09-27 Thread Ben Davis
Actually, I just found out about the X-Sendfile header which I think might
solve this problem.  It basically allows you to set the HttpResponse content
to an empty string,  but the X-Sendfile header tells apache to send a file
from the filesystem,  so apache handles the actual serving of the file, but
it still allows you to do preprocessing beforehand.   I'll probably just
override django.views.static.serve to support this, and use the X-Sendfile
header when in production mode.

On Sat, Sep 26, 2009 at 11:16 PM, Graham Dumpleton <
graham.dumple...@gmail.com> wrote:

>
>
>
> On Sep 27, 3:08 am, Ben Davis  wrote:
> > I would like to be able to serve files that were uploaded via the admin
> > site;  for example, when someone clicks on the "Currently:" file link in
> the
> > changeform.  However, I also have the following requirements:
> >
> >1. The file should only be accessible when authenticated via django's
> >auth system
> >2. Clicking the file link should not present an already authenticated
> >user with another authentication challenge
> >
> > I'm currently using a custom FileSystemStorage location and base_url for
> > files that should be only accessible via the admin.
> >
> > I've seen this documentation:
> http://docs.djangoproject.com/en/dev/howto/apache-auth/,   but it deals
> with
> > mod_python,   and I'm using mod_wsgi,  so I'm not sure if that will work.
> > Also,  I'm not sure if that solution meets requirement #2.
> >
> > Any ideas?
>
> The mod_wsgi equivalent of that page is at:
>
>  http://code.google.com/p/modwsgi/wiki/AccessControlMechanisms
>
> Neither will help you though as they implement Basic/Digest
> authentication which is distinct from Django form/session based
> authentication and would as a result prompt for credentials again.
>
> Graham
> >
>

--~--~-~--~~~---~--~~
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-trunk/django directory problem

2009-09-27 Thread Malcolm MacKinnon
Ok, thanks David.

On Sun, Sep 27, 2009 at 1:30 AM, Daniel Roseman wrote:

>
> On Sep 27, 4:48 am, Malcolm MacKinnon  wrote:
> > Thanks, but I don't understand. Will removal cause problems with django
> > project/app on python path. It's simlinked to the python site-packages.
> >
>
> The file 'django' inside your django-trunk/django directory is
> actually a symlink to the parent directory, django-trunk. So if you cd
> into it, you're effectively cd-ing back into the same directory again
> and again. Remove it and everything should be OK.
> --
> DR.
> >
>

--~--~-~--~~~---~--~~
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: admin site doesn't refresh

2009-09-27 Thread Marek Pietrucha

FALS PROBLEM!! No NEED to reply.

sory :)

On Sep 27, 6:00 pm, Marek Pietrucha  wrote:
> I added screen shots:
>
> localhost:http://picasaweb.google.com/mark.pietrucha/DjangoAdminSite#5386176920...
> megiteam.pl:http://picasaweb.google.com/mark.pietrucha/DjangoAdminSite#5386176927...
>
> I think it's not a problem with the host because when i add different
> modules from other applications everything works and the admin site
> refreshes and shows them.
>
> It doesn't show only the CompanyAddress and LegalStatus modules.
>
> The problem has to be somewhere in my code :(
>
> thanks for help!
--~--~-~--~~~---~--~~
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: rendering a table

2009-09-27 Thread jhugo

What i want to display as a table is the fallowing:

rows---row---   row ---row
   |   |   |
   number1  name1   date1
   number2  name2   date2
   number3  name3   date3

Now when django renders my template i get this:

number1  name1   date1
number1  name1   date1 number2  name2   date2
number1  name1   date1 number2  name2   date2 number3  name3   date3

Is this better? I am not getting why i am getting this behavior?

On Sep 27, 5:48 am, Léon Dignòn  wrote:
> Could you post your list and your output please?
>
> On Sep 27, 2:04 am, jhugo  wrote:
>
> > Hi,
>
> > I want to render a table using a list of list. What I do is create a
> > list for the rows and append another list for the columns. I use two
> > fors in my template to render the table and as the first loop progress
> > the second always renders the values from the beginning and a i end up
> > having my rows incrementing in length. Why is this?
>
> > this is what i have:
>
> > {% for row in rows %}
> > 
> > {% for value in row %}
> > {{ value }}
> > {% endfor %}
> > 
> > {% endfor %}
>
> > Thanks,
>
> > -- Hugo
--~--~-~--~~~---~--~~
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: My Django powered website for web based learning

2009-09-27 Thread Parag Shah
Sorry about that. It should be accessible now:

http://www.adaptivelearningonline.net

-- 
Thanks & Regards
Parag Shah
http://blog.adaptivesoftware.biz


On Sun, Sep 27, 2009 at 9:55 PM, Grant Livingston wrote:

> Same here..
>
>
> >
>

--~--~-~--~~~---~--~~
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: My Django powered website for web based learning

2009-09-27 Thread Grant Livingston
Same here..

--~--~-~--~~~---~--~~
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: My Django powered website for web based learning

2009-09-27 Thread Marek Pietrucha

I can't get in :(

Is the site up and running?

On Sep 27, 3:16 pm, Parag Shah  wrote:
> Hello,
>
> I have created a Django powered website for open learning which organizes
> various computer science related course videos in the form of structured
> courses.
>
> Many thanks to the excellent Django and Python community for helping me get
> through the issues I faced.
>
> The website is hosted at:http://www.adaptivelearningonline.net
>
> I also plan to open source the code (as soon as I clean it up :-) )
>
> --
> Thanks & Regards
> Parag Shahhttp://blog.adaptivesoftware.biz
--~--~-~--~~~---~--~~
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: admin site doesn't refresh

2009-09-27 Thread Marek Pietrucha

I added screen shots:

localhost: 
http://picasaweb.google.com/mark.pietrucha/DjangoAdminSite#5386176920766947362
megiteam.pl: 
http://picasaweb.google.com/mark.pietrucha/DjangoAdminSite#5386176927362649474

I think it's not a problem with the host because when i add different
modules from other applications everything works and the admin site
refreshes and shows them.

It doesn't show only the CompanyAddress and LegalStatus modules.

The problem has to be somewhere in my code :(

thanks for help!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



admin site doesn't refresh

2009-09-27 Thread Marek Pietrucha

Hello my dear django users,

I started to write and application in django and I encountered a
problem with which i'm dealing for about 2days (i'm quite
frustrated ;) )

I have constructed my models, as follows:
# Company Models

from django.db import models

class CompanyType(models.Model):
name = models.CharField(max_length=1024, null=True, blank=True,
unique=True)

class Meta:
ordering = ('name',)

def __unicode__(self):
return self.name


class CompanySubType(models.Model):
name = models.CharField(max_length=1024, unique=True)

class Meta:
ordering = ('name',)

def __unicode__(self):
return self.name


class LegalStatus(models.Model):
name = models.CharField('Legal Status', max_length=1024)

class Meta:
ordering = ('name',)

def __unicode__(self):
return self.name


class Company(models.Model):
name = models.CharField(max_length=2048, null=True)
parentCompany = models.ForeignKey("self", null=True, blank=True)
legalStatus = models.ForeignKey(LegalStatus, null=True,
blank=True)
type = models.ForeignKey(CompanyType)
subtype = models.ManyToManyField(CompanySubType)

# Dane dodatkowe
krs = models.IntegerField('KRS', null=True, blank=True)

class Meta:
ordering = ('name',)

def __unicode__(self):
return self.name


class CompanyAddress(models.Model):
company = models.ForeignKey(Company)
label = models.CharField(max_length=1024)
address = models.CharField(max_length=1024, null=True, blank=True)
postalCode = models.CharField(max_length=14, null=True,
blank=True)
city = models.CharField('City/Town', max_length=256, null=True,
blank=True)
country = models.ForeignKey("helper.Country", null=True,
blank=True)

class Meta:
ordering = ('label',)

def __unicode__(self):
return self.label

my admin.py looks like this:
# Company Admin

from biotechdb.company.models import CompanyType, CompanySubType,
LegalStatus, Company, CompanyAddress
from biotechdb.helper.models import *
from django.contrib import admin

# Legal status
admin.site.register(LegalStatus)

# Company type
class CompanyTypeAdmin(admin.ModelAdmin):
list_display = ('name',)
list_per_page = 20

admin.site.register(CompanyType, CompanyTypeAdmin)

# Company sub type
class CompanySubTypeAdmin(admin.ModelAdmin):
list_display = ('name',)
list_per_page = 20

admin.site.register(CompanySubType, CompanySubTypeAdmin)

# Company Address
class PhoneInline(admin.TabularInline):
model = Phone
extra = 1

class WWWInline(admin.TabularInline):
model = WWW
extra = 1

class EmailInline(admin.TabularInline):
model = Email
extra = 1

class CompanyAddressAdmin(admin.ModelAdmin):
fiedlsets = [
 (None, {'fields': [('address', 'postalCode'),
('city', 'country')]})
 ]
inlines = [PhoneInline, WWWInline, EmailInline]

admin.site.register(CompanyAddress, CompanyAddressAdmin)

# Company
class CompanyAddressInline(admin.TabularInline):
model = CompanyAddress
extra = 1

class ChildComapnyInline(admin.TabularInline):
model = Company
extra = 0
fields = ("name", "type")
classes = ("collapse")

class CompanyAdmin(admin.ModelAdmin):
fieldsets = [
 (None, {'fields': [('name', 'legalStatus',
'parentCompany'), ('type', 'subtype', 'krs')]}),
]
inlines = [CompanyAddressInline, ChildComapnyInline]
list_filter = ['type', 'subtype']
list_display = ('name', 'parentCompany', 'type')
list_per_page = 20
search_fields = ['name']

admin.site.register(Company, CompanyAdmin)


When i was constructing the admin view first i added Companty,
CompanyType and CompanySubType. I deployed this app to a host
(megiteam.pl). Everything was working fine. After I check if
everything is working correct i added other modules as:
CompanyAddress, LegalStatus.

I restarted my local server (python manage.py runserver localhost:80) -
> changes were committed and the admin page showed all the modules
i've added. After that updated the changes via svn to my host on
(megiteam.pl). I logged in to my account via ssh on megiteam.pl and
downloaded the latest svn revision (svn up - in the project
catalogue). I have restarted the process but i didn't see any changes
in the admin site.

Could someone help me locating the problem?

BTW: technical info:
localhost: python 2.6, django 1.1
megiteam.pl: python 2.6.1, django 1.1
--~--~-~--~~~---~--~~
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: login_required redirects to a specific url

2009-09-27 Thread Сергей Зигачев

Sorry, maybe you should use something like that:

@login_required(redirect_field_name='redirect_to')

Where `redirect_to' is the address for a specific page.

-Original Message-
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com]
On Behalf Of V
Sent: Sunday, September 27, 2009 9:21 PM
To: Django users
Subject: Re: login_required redirects to a specific url


but that's a site wide setting, and I would like to have a different
url for a specific view only

V

On Sep 27, 3:41 pm, "Сергей Зигачев" 
wrote:
> Hello,
>
> http://docs.djangoproject.com/en/dev/ref/settings/#setting-LOGIN_URL
>
> As you can see, you need to implement the LOGIN_URL value in your
> settings.py file.
>
> From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com]
> On Behalf Of }--o
> Sent: Sunday, September 27, 2009 7:18 PM
> To: django-users
> Subject: login_required redirects to a specific url
>
> Hi,
>
> I'm using the login_required decorator extensively, but have one view
where
> instead of the default landing page ('accounts/login') I would like to
> redirect it to a specific page. Is there a simple way to do this?
>
> Viktor


--~--~-~--~~~---~--~~
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: Passing parent with multiple childs from View to HTML

2009-09-27 Thread Jay

In Django template, you can make methed call. So you can pass the
auther object to the template, then
  {% for book in auther.books.all %}

{% for section in book.sections.all %}
  
{% end for %}
  {% endfor %}

The ordering is using the definition in the Model Meta class.
auther.books and book.sections is my assumption for your FK related
names.

If you want to change the ordering, maybe a template tag is more
suitable for your purpose.

And about Form, I'm not clear what you want? A whole page with forms
for authors, books and sections? If so, you can have a look at
formset, specially the inlineformset. (http://docs.djangoproject.com/
en/dev/topics/forms/modelforms/#inline-formsets) If you just want to
get a simple form for inline editing in the author-book-section view
page, using js to generate it is my only choice

On Sep 27, 1:39 am, PlanetUnknown  wrote:
> I have been studying the modalforms & inline formsets but am not able
> to wrap my head around my composite objects, and want to see how
> things are done in django world -
>
> I have this hierarchical model
> "Author" has many "Books"
>   Each "Book" has 4 Sections -> Section-01, Section-02, Section-03 &
> Section-04
>     Each "Section" has number of attributes.
>
> I want to show all books on its own line
> If a book is clicked, I'll expand a hidden DIV, which will show the 4
> sections of that book.
> Like so -
> Book-1 | Short Description of book (when clicked, shows the below
> section)
> Section-01 | Section-02 | Section-04 | Section-04 |
> Book-2 | Short Description of book (when clicked, shows the below
> section)
> Section-01 | Section-02 | Section-04 |...
> ...
> ..
> .
>
> I have all the HTML code figured out, using jquery to show/hide Divs.
>
> Question - I'm confused as to how I can pass all this data from the
> view to the HTML page and then render so that when user edits
> something, things are passed back, in the form of Forms.
>
> But is there a way to pass this whole composite object - Author+Books
> +AllSectionsInBook in one go.
>
> Would be great if you could point me in a direction or how you solved
> this composition problem.
> Thanks a lot in advance !
--~--~-~--~~~---~--~~
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: login_required redirects to a specific url

2009-09-27 Thread V

but that's a site wide setting, and I would like to have a different
url for a specific view only

V

On Sep 27, 3:41 pm, "Сергей Зигачев" 
wrote:
> Hello,
>
> http://docs.djangoproject.com/en/dev/ref/settings/#setting-LOGIN_URL
>
> As you can see, you need to implement the LOGIN_URL value in your
> settings.py file.
>
> From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com]
> On Behalf Of }--o
> Sent: Sunday, September 27, 2009 7:18 PM
> To: django-users
> Subject: login_required redirects to a specific url
>
> Hi,
>
> I'm using the login_required decorator extensively, but have one view where
> instead of the default landing page ('accounts/login') I would like to
> redirect it to a specific page. Is there a simple way to do this?
>
> Viktor
--~--~-~--~~~---~--~~
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: login_required redirects to a specific url

2009-09-27 Thread Сергей Зигачев
Hello,

 

http://docs.djangoproject.com/en/dev/ref/settings/#setting-LOGIN_URL

 

As you can see, you need to implement the LOGIN_URL value in your
settings.py file.

 

From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com]
On Behalf Of }--o
Sent: Sunday, September 27, 2009 7:18 PM
To: django-users
Subject: login_required redirects to a specific url

 

Hi,

I'm using the login_required decorator extensively, but have one view where
instead of the default landing page ('accounts/login') I would like to
redirect it to a specific page. Is there a simple way to do this?

Viktor



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



OperationalError: unable to open database file, when saving existing object

2009-09-27 Thread pigmalione

Hello,

When I attempt to save an existing db object I get the following
error:

  File "", line 1, in 
  File "/usr/lib/python2.5/site-packages/django/db/models/base.py",
line 410, in
 save
self.save_base(force_insert=force_insert,
force_update=force_update)
  File "/usr/lib/python2.5/site-packages/django/db/models/base.py",
line 474, in
 save_base
rows = manager.filter(pk=pk_val)._update(values)
  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
line 444, i
n _update
return query.execute_sql(None)
  File "/usr/lib/python2.5/site-packages/django/db/models/sql/
subqueries.py", li
ne 120, in execute_sql
cursor = super(UpdateQuery, self).execute_sql(result_type)
  File "/usr/lib/python2.5/site-packages/django/db/models/sql/
query.py", line 23
69, in execute_sql
cursor.execute(sql, params)
  File "/usr/lib/python2.5/site-packages/django/db/backends/util.py",
line 19, i
n execute
return self.cursor.execute(sql, params)
  File "/usr/lib/python2.5/site-packages/django/db/backends/sqlite3/
base.py", li
ne 193, in execute
return Database.Cursor.execute(self, query, params)
OperationalError: unable to open database file

I can keep saving new objects, but once I edit an attribute and
attempt to save, I get the above message.

Can someone suggest something?

Thanks a lot.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



login_required redirects to a specific url

2009-09-27 Thread }--o
Hi,

I'm using the login_required decorator extensively, but have one view where
instead of the default landing page ('accounts/login') I would like to
redirect it to a specific page. Is there a simple way to do this?

Viktor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[ANN] My Django powered website for web based learning

2009-09-27 Thread Parag Shah
Hello,

I have created a Django powered website for open learning which organizes
various computer science related course videos in the form of structured
courses.

Many thanks to the excellent Django and Python community for helping me get
through the issues I faced.

The website is hosted at: http://www.adaptivelearningonline.net

I also plan to open source the code (as soon as I clean it up :-) )

-- 
Thanks & Regards
Parag Shah
http://blog.adaptivesoftware.biz

--~--~-~--~~~---~--~~
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: TinyMCE in Admin (Practical Django Projects book)

2009-09-27 Thread Erik Kronberg
On Sun, Sep 27, 2009 at 1:54 PM, James Bennett wrote:

>
> On Sun, Sep 27, 2009 at 6:48 AM, Erik Kronberg  wrote:
> > I'm on chapter 3 of James Bennett's Practical Django Projects. My
> > problem is that TinyMCE isn't showing up in the Admin -> New Flatpage
> > text area. Using Linux (Ubuntu 9.04)
>
> First thing I'd recommend is checking it against the version here:
>
> http://bitbucket.org/ubernostrum/practical-django-projects/src/tip/cms/
>
> (about the first four chapters' worth of code are in the repo, the
> rest is trickling in as I have time to fill it out)
>
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of
> correct."
>
>
What is the whole path to the .js file for your project? I think I'm messing
it up somewhere along the line, I want to be sure.

My document root in urls.py is /home/erik/tiny_mce/
And the path in change_form.html is /tiny_mce/tiny_mce.js

The .js file is in /home/erik/tiny_mce/tiny_mce.js

Thank you for responding so fast! Liking your book so far =) (I never get
things right the first time, it's not a reflection on your book)

--~--~-~--~~~---~--~~
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: How to establish foreign key contraints across models living in different applications

2009-09-27 Thread pkenjora

Guillermo,

  Having one application depend on another is OK.  If your are writing
a generic reusable application that other can download and plug in
then generic keys may be the way to go.  If however, you are simply
having one of your own apps depend on another I strongly suggest not
using generic foreign keys, they have drawbacks that could hinder you
down the road.

-Paul

On Sep 27, 3:12 am, guillermooo 
wrote:
> Hi David,
>
> I suppose that what you suggest would work too, but it would break the
> reusability of the Todo application. I think what I need is rather a
> GenericRelation/GenericForeignKey. Just found it in the docs.
>
> Thanks,
>
> Guillermo
>
> On Sep 26, 10:21 pm, "djfis...@gmail.com" 
> wrote:
>
> > Guillermo,
>
> > It is possible to have a model in one application have a foreign key
> > to another application as of Django 1.0.
>
> > From:http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.mod...
> > ---
> > To refer to models defined in another application, you can explicitly
> > specify a model with the full application label. For example, if the
> > Manufacturer model above is defined in another application called
> > production, you'd need to use:
>
> > class Car(models.Model):
> >     manufacturer = models.ForeignKey('production.Manufacturer')
>
> > This sort of reference can be useful when resolving circular import
> > dependencies between two applications.
> > ---
>
> > Hopefully this is what you need.
>
> > -David
>
> > On Sep 26, 12:07 pm, Guillermo 
> > wrote:
>
> > > Hi all,
>
> > > I have one app with a Project model and another app with a TodoItem
> > > model. How can I declare Project to be the foreign key of TodoItem?
> > > Or, rather, how can I make TodoItem accept an arbitrary model as
> > > foreign key?
>
> > > Regards,
>
> > > Guillermo
--~--~-~--~~~---~--~~
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: Custom Command as cron

2009-09-27 Thread pkenjora

Here is an example of a complete script that does this:

http://blog.awarelabs.com/2007/using-django-models-in-batch-jobs/

You will need to know the complete path to Django.  In the CRON you
now do not need to set PYTHONPATH for Django because it is set in the
actual script.

-Paul

On Sep 24, 10:05 am, Matt McCants  wrote:
> Greetings all,
>
> I'm having an issue running a custom command as a cron. Most resources
> I've read have said that you can run your command from cron by simply
> using the following syntax:
>
> python manage.py custom_command_name
>
> Frustratingly, that does not work for me. It results in "Unknown
> command: 'custom_command_name'" Further attempts such as:
>
> /usr/bin/python /path/to/my/project/manage.py custom_command_name
>
> or any variation fail. If I run:
>
> python /path/to/my/project/manage.py help
>
> It executes, but my custom command does not show up.
>
> The custom command works fine when I call it from within the project
> directory.
>
> I suspect it has something to do with PythonPaths. I'm pretty new to
> both Django and Python, so any help is greatly appreciated.
>
> Thanks,
> Matt McCants
>
> This message is confidential, intended only for the named recipient(s) and 
> may contain information that is privileged or exempt from disclosure under 
> law. If you are not the intended recipient(s), you are notified that the 
> dissemination, distribution, or copying of this message is strictly 
> prohibited, and that this message should be deleted from your system. The 
> Free Lance-Star Publishing Company accepts no liability for the content of 
> this message, or for the consequences of any actions taken on the basis of 
> the information provided. If you receive this message in error, or are not 
> the named recipient(s), please notify the sender and delete the document from 
> your computer.
--~--~-~--~~~---~--~~
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: TinyMCE in Admin (Practical Django Projects book)

2009-09-27 Thread James Bennett

On Sun, Sep 27, 2009 at 6:48 AM, Erik Kronberg  wrote:
> I'm on chapter 3 of James Bennett's Practical Django Projects. My
> problem is that TinyMCE isn't showing up in the Admin -> New Flatpage
> text area. Using Linux (Ubuntu 9.04)

First thing I'd recommend is checking it against the version here:

http://bitbucket.org/ubernostrum/practical-django-projects/src/tip/cms/

(about the first four chapters' worth of code are in the repo, the
rest is trickling in as I have time to fill it out)


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



TinyMCE in Admin (Practical Django Projects book)

2009-09-27 Thread Erik Kronberg

Hello!

I'm completely stuck, double checked spelling and tried a couple of
different things. I am really new at Django and just know a bit of
Python, so don't expect me to understand any complicated terminology!

I'm on chapter 3 of James Bennett's Practical Django Projects. My
problem is that TinyMCE isn't showing up in the Admin -> New Flatpage
text area. Using Linux (Ubuntu 9.04)

>>> django.VERSION
(1, 1, 0, 'final', 0)

Latest stable TinyMCE

tiny_mce.js location  ~/tinymce/jscripts/tiny_mce/
change_form.html location~/templates/admin/flatpages/flatpage/
project location~/cms/


Following copy pastes--

urls.py

from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Example:
# (r'^cms/', include('cms.foo.urls')),

# Uncomment the admin/doc line below and add
'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
(r'', include('django.contrib.flatpages.urls')),
(r'^tiny_mce/(?P.*)$', 'django.views.static.serve',
{ 'document_root': '/home/erik/tinymce/jscripts/tiny_mce/' }),
)

---

change_form.html (only the first part)
---

{% extends "admin/base_site.html" %}
{% load i18n admin_modify adminmedia %}

{% block extrahead %}{{ block.super }}


 tinyMCE.init({
mode: "textareas",
theme: "simple"
});


---

Thank you for reading! I'm sorry if I forgot anything important, I'll
add it asap

--~--~-~--~~~---~--~~
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: IGNORABLE_404 woes

2009-09-27 Thread Karen Tracey
On Sat, Sep 26, 2009 at 11:33 PM, troyhitch  wrote:

>
> I think I may have figured out what was happening. I did not have a
> 404.html in templates, and assume now that the messages were coming
> only because of that (the missing template seemed consequential to me
> and not the primary cause). I didn't think a template was necessary.
> Can someone confirm that this is the case?
>
>
Assuming you are using the default error handlers, you do need a 404.html
template.  Without it the server will wind up raising an exception when it
tries to return a 404 response.

I guess, then, you were not actually getting broken link emails (which have
a subject like Broken INTERNAL link on [site] and a body showing the
referrer, the requested URL, the user agent, and the IP address of the
requestor) but rather server error emails (which have a subject of ERROR
along with the requested URL and have a body that shows the traceback of the
error)?  I don't see how you could have been getting broken link emails if
you did not have a 404.html template.

You do also need a 500.html template.

Karen

--~--~-~--~~~---~--~~
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: How to establish foreign key contraints across models living in different applications

2009-09-27 Thread James Bennett

On Sat, Sep 26, 2009 at 3:21 PM, djfis...@gmail.com
 wrote:
> It is possible to have a model in one application have a foreign key
> to another application as of Django 1.0.

It's always been possible to point relationships at models in other
applications. The bit you're linking to is a special alternate syntax
which lets you avoid circular import problems (where Model A in App A
and Model B in App B both refer to each other -- Python doesn't let
you import each one into the other's file), and that and *only* that
was new as of 1.0.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: How to establish foreign key contraints across models living in different applications

2009-09-27 Thread guillermooo

Hi David,

I suppose that what you suggest would work too, but it would break the
reusability of the Todo application. I think what I need is rather a
GenericRelation/GenericForeignKey. Just found it in the docs.

Thanks,

Guillermo

On Sep 26, 10:21 pm, "djfis...@gmail.com" 
wrote:
> Guillermo,
>
> It is possible to have a model in one application have a foreign key
> to another application as of Django 1.0.
>
> From:http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.mod...
> ---
> To refer to models defined in another application, you can explicitly
> specify a model with the full application label. For example, if the
> Manufacturer model above is defined in another application called
> production, you'd need to use:
>
> class Car(models.Model):
>     manufacturer = models.ForeignKey('production.Manufacturer')
>
> This sort of reference can be useful when resolving circular import
> dependencies between two applications.
> ---
>
> Hopefully this is what you need.
>
> -David
>
> On Sep 26, 12:07 pm, Guillermo 
> wrote:
>
>
>
> > Hi all,
>
> > I have one app with a Project model and another app with a TodoItem
> > model. How can I declare Project to be the foreign key of TodoItem?
> > Or, rather, how can I make TodoItem accept an arbitrary model as
> > foreign key?
>
> > Regards,
>
> > Guillermo
--~--~-~--~~~---~--~~
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: rendering a table

2009-09-27 Thread Léon Dignòn

Could you post your list and your output please?

On Sep 27, 2:04 am, jhugo  wrote:
> Hi,
>
> I want to render a table using a list of list. What I do is create a
> list for the rows and append another list for the columns. I use two
> fors in my template to render the table and as the first loop progress
> the second always renders the values from the beginning and a i end up
> having my rows incrementing in length. Why is this?
>
> this is what i have:
>
> {% for row in rows %}
> 
> {% for value in row %}
> {{ value }}
> {% endfor %}
> 
> {% endfor %}
>
> Thanks,
>
> -- Hugo
--~--~-~--~~~---~--~~
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: admin list_display

2009-09-27 Thread paulhide

Thanks for your reply and I think you are right, I could achieve the
effect I am after (described in the middle paragraph of my first
post), but it just wouldn't be such a nice user interface as just
clicking  a link.

Paul Hide

On Sep 27, 10:05 am, Daniel Roseman  wrote:
> On Sep 26, 12:53 pm, paulh  wrote:
>
>
>
> > Using the admin list_display and a callable with its allow_tags
> > property set to True you can plant a link for each object on the
> > changle_list display page of the admin. Is there some way of making
> > this link dynamic without having to extend the
> > ModelAdmin.changelist_view and its associated template?
>
> > The idea is to use the admin search and associated paged object
> > display for selecting an object and then using the object in a variety
> > of contexts, the context being set by the particular link that was
> > planted.
>
> > Someone seemed to be asking a question rather like this in the users
> > group not long ago and the reply seemed to be connected with reverse
> > urls, but maybe I misinterpreted this.
>
> > Paul Hide
>
> I'm not entirely sure what you're after, but it sounds like the new
> 1.1 "admin actions" functionality would be more what you need.
>
> Seehttp://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/
> --
> DR.
--~--~-~--~~~---~--~~
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: admin list_display

2009-09-27 Thread Daniel Roseman

On Sep 26, 12:53 pm, paulh  wrote:
> Using the admin list_display and a callable with its allow_tags
> property set to True you can plant a link for each object on the
> changle_list display page of the admin. Is there some way of making
> this link dynamic without having to extend the
> ModelAdmin.changelist_view and its associated template?
>
> The idea is to use the admin search and associated paged object
> display for selecting an object and then using the object in a variety
> of contexts, the context being set by the particular link that was
> planted.
>
> Someone seemed to be asking a question rather like this in the users
> group not long ago and the reply seemed to be connected with reverse
> urls, but maybe I misinterpreted this.
>
> Paul Hide

I'm not entirely sure what you're after, but it sounds like the new
1.1 "admin actions" functionality would be more what you need.

See http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/
--
DR.
--~--~-~--~~~---~--~~
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: admin list_display

2009-09-27 Thread paulhide

Having thought about this myself and done some more research, a better
question is: is there a way of getting extra args through to a
list_display callable? Having stared at the code in template_tags/
admin_list.py it would appear that there is no facility for getting
extra args through to these callables, or maybe I am looking in the
wrong place.

Paul Hide

On Sep 26, 12:53 pm, paulh  wrote:
> Using the admin list_display and a callable with its allow_tags
> property set to True you can plant a link for each object on the
> changle_list display page of the admin. Is there some way of making
> this link dynamic without having to extend the
> ModelAdmin.changelist_view and its associated template?
>
> The idea is to use the admin search and associated paged object
> display for selecting an object and then using the object in a variety
> of contexts, the context being set by the particular link that was
> planted.
>
> Someone seemed to be asking a question rather like this in the users
> group not long ago and the reply seemed to be connected with reverse
> urls, but maybe I misinterpreted this.
>
> Paul Hide
--~--~-~--~~~---~--~~
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-trunk/django directory problem

2009-09-27 Thread Daniel Roseman

On Sep 27, 4:48 am, Malcolm MacKinnon  wrote:
> Thanks, but I don't understand. Will removal cause problems with django
> project/app on python path. It's simlinked to the python site-packages.
>

The file 'django' inside your django-trunk/django directory is
actually a symlink to the parent directory, django-trunk. So if you cd
into it, you're effectively cd-ing back into the same directory again
and again. Remove it and everything should be OK.
--
DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Moving the .py(c|o) files out of the app?

2009-09-27 Thread Christophe Pettus

This is more a deployment question, but: Is there a way of specifying  
a directory other than the app folder hierarchy for the .pyc or .pyo  
files to be written to?  In production, I'm not wild about the idea of  
the app folders being writable by the Apache process.  Any guidance?
Thanks?

--
-- Christophe Pettus
x...@thebuild.com


--~--~-~--~~~---~--~~
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: Custom Command as cron

2009-09-27 Thread Fangzx

Hi, I used ubuntu crontab to exec python script in my project.

1. In crontab, you can do  like this:

DJANGO_SETTINGS_MODULE=divo3.settings
PYTHONPATH=/root/deploy

# m h  dom mon dow   command
50 * * * * python /root/deploy/divo3/job.py

2. The job.py file must put in the root dir of django project, its
content like this:

#coding=utf-8
from apps.check.views.job import do_check_job
from apps.board.views.job import do_board_job
from apps.core.views.job import do_core_job
from apps.xf.views.job import do_xf_job
from apps.utils.log import log_error

if __name__ == "__main__":
do_core_job()
do_board_job()
do_check_job()
do_xf_job()

#EOP


On 9月25日, 上午1时15分, Matt McCants  wrote:
> I knew this would happen as soon as I hit submit to make a fool of
> myself.
>
> So I tried to use:
> manage.py custom_command_name --pythonpath='/path/to/my/project'
>
> but that had not worked either. The real path to the project is:
>
> /home/webdev/django/fls
>
> but I failed to put in:
>
> manage.py custom_command_name --pythonpath='/home/webdev/django'
>
> seems to have done the trick. As I said, I'm fairly new to Django and
> Python. I understand why I was wrong. Thanks for reading anyway!
>
> Matt
>
>
>
>
>
>
>
> On Thu, 2009-09-24 at 13:05 -0400, Matt McCants wrote:
> > Greetings all,
>
> > I'm having an issue running a custom command as a cron. Most resources
> > I've read have said that you can run your command from cron by simply
> > using the following syntax:
>
> > python manage.py custom_command_name
>
> > Frustratingly, that does not work for me. It results in "Unknown
> > command: 'custom_command_name'" Further attempts such as:
>
> > /usr/bin/python /path/to/my/project/manage.py custom_command_name
>
> > or any variation fail. If I run:
>
> > python /path/to/my/project/manage.py help
>
> > It executes, but my custom command does not show up.
>
> > The custom command works fine when I call it from within the project
> > directory.
>
> > I suspect it has something to do with PythonPaths. I'm pretty new to
> > both Django and Python, so any help is greatly appreciated.
>
> > Thanks,
> > Matt McCants
>
> > This message is confidential, intended only for the named recipient(s) and 
> > may contain information that is privileged or exempt from disclosure under 
> > law. If you are not the intended recipient(s), you are notified that the 
> > dissemination, distribution, or copying of this message is strictly 
> > prohibited, and that this message should be deleted from your system. The 
> > Free Lance-Star Publishing Company accepts no liability for the content of 
> > this message, or for the consequences of any actions taken on the basis of 
> > the information provided. If you receive this message in error, or are not 
> > the named recipient(s), please notify the sender and delete the document 
> > from your computer.
>
> This message is confidential, intended only for the named recipient(s) and 
> may contain information that is privileged or exempt from disclosure under 
> law. If you are not the intended recipient(s), you are notified that the 
> dissemination, distribution, or copying of this message is strictly 
> prohibited, and that this message should be deleted from your system. The 
> Free Lance-Star Publishing Company accepts no liability for the content of 
> this message, or for the consequences of any actions taken on the basis of 
> the information provided. If you receive this message in error, or are not 
> the named recipient(s), please notify the sender and delete the document from 
> your computer.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---