Re: digg style pagination

2009-11-18 Thread Oleg Oltar
I am trying to use the application
http://code.google.com/p/django-pagination/, that you proposed in the latest
post.


But getting an exception. Could you help to fix it please?

TemplateSyntaxError at /section/home

Caught an exception while rendering: 'request'

Original Traceback (most recent call last):
  File "/opt/local/lib/python2.5/site-packages/django/template/debug.py",
line 71, in render_node
result = node.render(context)
  File 
"/opt/local/lib/python2.5/site-packages/django_pagination-1.0.5-py2.5.egg/pagination/templatetags/pagination_tags.py",
line 90, in render
page_obj = paginator.page(context['request'].page)
  File "/opt/local/lib/python2.5/site-packages/django/template/context.py",
line 49, in __getitem__
raise KeyError(key)
KeyError: 'request'

 Request Method: GET  Request URL: http://127.0.0.1:8000/section/home
Exception
Type: TemplateSyntaxError  Exception Value:

Caught an exception while rendering: 'request'

Original Traceback (most recent call last):
  File "/opt/local/lib/python2.5/site-packages/django/template/debug.py",
line 71, in render_node
result = node.render(context)
  File 
"/opt/local/lib/python2.5/site-packages/django_pagination-1.0.5-py2.5.egg/pagination/templatetags/pagination_tags.py",
line 90, in render
page_obj = paginator.page(context['request'].page)
  File "/opt/local/lib/python2.5/site-packages/django/template/context.py",
line 49, in __getitem__
raise KeyError(key)
KeyError: 'request'



On Mon, Sep 7, 2009 at 7:38 PM, Michael Ralan  wrote:

>
> It's possible to get digg-style pagination yes. What you need to do is
> this.
>
> Get the django-pagination add-on from the following url
>
> http://code.google.com/p/django-pagination/
>
> The documentation says unzip the pagination folder to a path
> accessible to python. This is usually taken to mean your site-packages
> folder. I couldn't do that because my app will be hosted on a server
> where I don't have that sort privilege.
>
> So what I did was to unzip it into a folder I did have access to.
> Because I'm running django using mod_wsgi there is a place I could add
> the following line to my initialization code. (Actually I added it to
> my projectfolder\apache\django.wsgi file). Unless the latter is
> already familiar to you probably have to scratch around somewhere.
>
> sys.path.append('g:/xampp/htdocs/pagination')
>
> From this point I followed the included documentation and it works!
>
> For the digg-look and feel I had to download some .css styling at
>
>
> http://mis-algoritmos.com/2007/03/16/some-styles-for-your-pagination/?page=2
>
> Hope this helps!
>
> Regards
>
> On Aug 17, 3:19 pm, sniper  wrote:
> > Hi,
> > Thanks for the help. I thought there would be django's official built
> > in
> > functionality which i might have missed, but looks like i have to
> > use unofficial third party code.
> >
> > On Aug 14, 6:49 pm, Benjamin  Wohlwend  wrote:
> >
> > > Hi,
> >
> > > On Aug 14, 8:54 pm,sniper wrote:
> >
> > > > I am asking this because in the admin page, the list page uses digg
> > > > style paging.
> >
> > > Like everything else that comes with Django, the admin app is open
> > > source, so nothing stops you from having a peek. This particular
> > > functionality can be found in django/contrib/admin/templatetags/
> > > admin_list.py, line 28[1]. The template tag has some admin-specifics
> > > in it, you'd have to copy the template tag and adjust it. Or, and this
> > > is probably what David so eloquently suggested, you could use one of
> > > the countless digg-style paginators for Django that float around the
> > > net. I'm quite fond of this[2] one because it extends the built-in
> > > pagination facilities instead of completely reinventing the wheel.
> >
> > > Kind regards,
> > > Benjamin
> >
> > > [1]
> http://code.djangoproject.com/browser/django/trunk/django/contrib/adm...
> > > [2]http://www.djangosnippets.org/snippets/773/
> --~--~-~--~~~---~--~~
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en
> -~--~~~~--~~--~--~---
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: casting unicode to model

2009-11-18 Thread neridaj
Thanks Karen but I'm just getting a 'NoneType' object has no attribute
'objects' with this code:

def search(request):
query = request.GET.get('q', '')
model = request.GET.get('models', '')
model_class = get_model(blog, model)
results = []
if query:
results = model_class.objects.filter(content__icontains=query)
return render_to_response('search/search.html',
{ 'query': query, 'results':
results })

On Nov 18, 6:29 pm, Karen Tracey  wrote:
> On Wed, Nov 18, 2009 at 9:09 PM, neridaj  wrote:
> > Hello,
>
> > I have a select menu which I would like to use as a model selector in
> > a view but I keep getting 'unicode' object has no attribute 'objects'
> > because I need to cast this to type Model or something similar. How do
> > I go about doing that.
>
> Undocumented internal routine, but unlikely to change:
>
> from django.db.models import get_model
> model_class = get_model(app_name, model_name)
>
> 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-us...@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=.




Re: Initial values for formwizard form

2009-11-18 Thread Mark L.


On Nov 19, 1:28 am, geraldcor  wrote:
> Ok,
>
> Here is how I do it if I am using a regular form with a regular view:
>
> profile = request.user.get_profile()
> form = MyForm('company': profile.defaultcompany, 'contact':
> profile.defaultcontact, etc...})
> return render_to_response('forms/submit.html', {'form': form},
> context_instance=RequestContext(request))
>
> pretty simple and basic.
>
> How do I do this with a form wizard?
>
> Greg
>
> On Nov 17, 3:39 pm, geraldcor  wrote:
>
> > Hello all,
>
> > I began making a form that used request.user.get_profile to get
> > default values for company name, phone, email etc. I have since
> > decided to move to a formwizard to split things up. I have no idea how
> > to override methods for the formwizard class to be able to include
> > those initial values in the form. Can someone please help me with this
> > problem or point me to the proper help? I have come up short with all
> > of my searching. Thanks.


Hello,

The *initial* values for the forms in a form wizard are stored in the
self.initial[] list. It means, that to set set initial values for the
form in step X you do the following:

init = {
'key1':'val1',
'key2':'val2',
etc..
}

self.initial[X] = init

The best (and, indeed, about the only place to handle this) is the
process_step method of the wizard instance (or parse_params, if you
need to set initial values for the form in step 0).

Hope that helps

Mark

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: how to run django with fastcgi, but not run as user "root" on linux

2009-11-18 Thread Fm
Hi,
I'm am green-hand to linux.
When I use /usr/bin/su nobody -c /usr/local/bin/python /home/admin/cc/
manage.py runfcgi
method=threaded host=127.0.0.1 port=12345
it say "This account is currently not available."

Because nobody's shell is /sbin/nologin,I could not use su?

what is the normal way of RC system provided to set the user to run?

Thanks a lot
Fm

On Nov 18, 7:37 pm, Tom Evans  wrote:
> On Wed, Nov 18, 2009 at 8:25 AM, Fm  wrote:
> > Hi all,
> > I have write a script in /etc/rc.d/init.d so that Django can start
> > with my server.
> > It may look like
> > start () {
> >    echo -n $"Starting $prog: "
> > /usr/local/bin/python /home/admin/cc/manage.py runfcgi method=threaded
> > host=127.0.0.1 port=12345
> > }
>
> /usr/bin/su nobody -c /usr/local/bin/python /home/admin/cc/manage.py runfcgi
> method=threaded host=127.0.0.1 port=12345
>
> I'd be surprised if your RC system didn't provide a cleaner way of setting
> the user to run as though.
>
> Cheers
>
> Tom

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: casting unicode to model

2009-11-18 Thread Karen Tracey
On Wed, Nov 18, 2009 at 9:09 PM, neridaj  wrote:

> Hello,
>
> I have a select menu which I would like to use as a model selector in
> a view but I keep getting 'unicode' object has no attribute 'objects'
> because I need to cast this to type Model or something similar. How do
> I go about doing that.
>
>
Undocumented internal routine, but unlikely to change:

from django.db.models import get_model
model_class = get_model(app_name, model_name)

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-us...@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=.




Re: Internal server error 500 with mod_wsgi

2009-11-18 Thread Karen Tracey
On Wed, Nov 18, 2009 at 8:28 PM, Alessandro Ronchi <
alessandro.ron...@soasi.com> wrote:

> I get the same problem also with an Assert False (a typical debug symbol
> I've used with mod_python).
>
> http://dpaste.com/16/
>
> no browser and no email, only logs.
>
>

You seem to have put the assert False in settings.py, and the code is
(still) dying during load of middleware, since that is triggering a load of
settings.  Look at the top of the trace.  The code is here:

http://code.djangoproject.com/browser/django/tags/releases/1.1.1/django/core/handlers/wsgi.py#L230

That is, within the call to self.load_middleware().  The special handling of
exceptions that produces pretty debug pages and sends error email isn't done
until you get into get_response (called down several lines from the
load_middleware()):

http://code.djangoproject.com/browser/django/tags/releases/1.1.1/django/core/handlers/base.py#L66

Specifically when that method call handle_uncaught_exception:

http://code.djangoproject.com/browser/django/tags/releases/1.1.1/django/core/handlers/base.py#L136

which either produces the pretty error page or sends email, depending on
DEBUG setting.

Really, you can get both pretty debug pages and emails with mod_wsgi as well
as you can with the development server or mod_python.  I've seen both.  The
problem with both exception traces you have shown is that the exception is
occurring too early in the processing -- neither of these exceptions you
have posted would ever result in a debug page or an error email, regardless
of deployment setup.

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-us...@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=.




casting unicode to model

2009-11-18 Thread neridaj
Hello,

I have a select menu which I would like to use as a model selector in
a view but I keep getting 'unicode' object has no attribute 'objects'
because I need to cast this to type Model or something similar. How do
I go about doing that.

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-us...@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=.




Re: Internal server error 500 with mod_wsgi

2009-11-18 Thread Alessandro Ronchi
On Thu, Nov 19, 2009 at 2:02 AM, Karen Tracey  wrote:

> On Wed, Nov 18, 2009 at 7:29 PM, Alessandro Ronchi <
> alessandro.ron...@soasi.com> wrote:
>
>>
>>
>> http://dpaste.com/122205/
>> is my log file.
>>
>>
> Traceback shows it is dying during the load of middleware.  You would not
> get a pretty debug page for this even with DEBUG=True and running the
> development server: you'd get a bare traceback, which is what you see in the
> Apache log.  This is code that is not covered by the
> exception-catching-turn-it-into-a-pretty-page try/except block.  Ultimately
> it says (stripping out the referrer and leading timestamp, etc):
>
>File "/var/www/vhosts/
> hobbygiochi.com/django/satchmo_src/satchmo/apps/livesettings/functions.py",
> line 67, in get_config
>  raise SettingNotSet('%s config group does not exist' % group),
> SettingNotSet: 
>


I get the same problem also with an Assert False (a typical debug symbol
I've used with mod_python).

http://dpaste.com/16/

no browser and no email, only logs.

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Internal server error 500 with mod_wsgi

2009-11-18 Thread Karen Tracey
On Wed, Nov 18, 2009 at 7:29 PM, Alessandro Ronchi <
alessandro.ron...@soasi.com> wrote:

>
>
> http://dpaste.com/122205/
> is my log file.
>
>
Traceback shows it is dying during the load of middleware.  You would not
get a pretty debug page for this even with DEBUG=True and running the
development server: you'd get a bare traceback, which is what you see in the
Apache log.  This is code that is not covered by the
exception-catching-turn-it-into-a-pretty-page try/except block.  Ultimately
it says (stripping out the referrer and leading timestamp, etc):

   File "/var/www/vhosts/
hobbygiochi.com/django/satchmo_src/satchmo/apps/livesettings/functions.py",
line 67, in get_config
 raise SettingNotSet('%s config group does not exist' % group),
SettingNotSet: 

Which seems to imply something wrong with your satchmo config.  I don't know
satchmo but it seems to be trying to complain about a config group not
existing.  However it seems to run into trouble reporting the name of that
group. That  message might be implying the group name has
non-ASCII data in it, which is making the SettingNotSet instance
unprintable.  That  may be a clue or may be completely wrong -- it's just
the only kind of situation where I've seen that sort of 
message crop up.

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-us...@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=.




Re: Internal server error 500 with mod_wsgi

2009-11-18 Thread Alessandro Ronchi
On Thu, Nov 19, 2009 at 1:08 AM, Graham Dumpleton <
graham.dumple...@gmail.com> wrote:

>
>
> On Nov 19, 10:48 am, Alessandro Ronchi 
> wrote:
> > With mod_wsgi I only get error logged into apache and not on the
> interactive
> > trackback in the browser, also If i set DEBUG=True in my settings.
> >
> > Is there any way to handle the django trackback as usual?
>
> Is the error definitely from Django and if so from what part of
> Django?
>
> Perhaps post example of traceback.
>
> Have you looked at 'DEBUG_PROPAGATE_EXCEPTIONS' setting.
>
>
> http://docs.djangoproject.com/en/dev/ref/settings/#debug-propagate-exceptions
>
> Also check over comments against:
>
> http://docs.djangoproject.com/en/dev/ref/settings/#debug
>
> and when tracebacks may be suppressed.
>


http://dpaste.com/122205/
is my log file.

I don't used DEBUG_PROPAGATE_EXCEPTIONS
but as far as I understand it defaults to False, so Django should handle the
error with usual trackback, also with mod_wsgi?

this is my vhost.conf (i'm using plesk):
http://dpaste.com/122208/

and this is my wsgi app:
http://dpaste.com/122209/

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Automatic swapping of field data?

2009-11-18 Thread Doug Blank
Django users,

I have data that needs to be handled in two different manners,
depending on if the user has certain permissions or not. For example,
if a record is marked "private" and a user is not permitted, I want to
substitute the word "PROTECTED" for a particular field's value.

Now, of course I realize that each and every place I refer to
table.fieldname I could wrap a protection around that, either in my
Python code, or in my templates.

What I'm really looking for is something closer to the model code so
that I can be assured that no private data accidentally slips out.
Does Django have any built in support that does this, or could be
adapted to do this?

Any ideas appreciated!

-Doug

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Internal server error 500 with mod_wsgi

2009-11-18 Thread Graham Dumpleton


On Nov 19, 10:48 am, Alessandro Ronchi 
wrote:
> With mod_wsgi I only get error logged into apache and not on the interactive
> trackback in the browser, also If i set DEBUG=True in my settings.
>
> Is there any way to handle the django trackback as usual?

Is the error definitely from Django and if so from what part of
Django?

Perhaps post example of traceback.

Have you looked at 'DEBUG_PROPAGATE_EXCEPTIONS' setting.

http://docs.djangoproject.com/en/dev/ref/settings/#debug-propagate-exceptions

Also check over comments against:

http://docs.djangoproject.com/en/dev/ref/settings/#debug

and when tracebacks may be suppressed.

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-us...@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=.




Re: Internal server error 500 with mod_wsgi

2009-11-18 Thread Alessandro Ronchi
On Thu, Nov 19, 2009 at 12:48 AM, Alessandro Ronchi <
alessandro.ron...@soasi.com> wrote:

> With mod_wsgi I only get error logged into apache and not on the
> interactive trackback in the browser, also If i set DEBUG=True in my
> settings.
>
> Is there any way to handle the django trackback as usual?
>

mod_wsgi also doesn't send me the email of errors. I really need them. Is it
possible to make python send me an email of every internal error also with
mod_wsgi?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Internal server error 500 with mod_wsgi

2009-11-18 Thread Alessandro Ronchi
With mod_wsgi I only get error logged into apache and not on the interactive
trackback in the browser, also If i set DEBUG=True in my settings.

Is there any way to handle the django trackback as usual?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Django website stats

2009-11-18 Thread Fabio Natali
Hi there!

I have a Django based website with a few dozen users. Only logged
users can enter the website and browse its pages.

I wish I could set up a stats page, i.e. some sort of table listing
how many accesses to the website for a given user. Specifically, I
need:

- per-user number of accesses
- per-page number of accesses
- detailed listing: how many times user x has accessed page y?
- I should be able to select the period of time (i.e. accesses in
  November)

I wonder if all those informations are somehow already contained in my
user model. I guess they aren't.

What's my best bet? Should I extend my db with a new model
(e.g. "access", with fields: user, page, date)?

Is there any "right" way to do this?

Thanks and regards,

-- 
Fabio Natali

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Inline admin objects question

2009-11-18 Thread Daniel Roseman
On Nov 18, 10:50 pm, Wayne  wrote:
> Thanks for your reply.
>
> My situation is a little bit more tricky. I have table A and table B.
> Table B has several columns, two of which are tableID and resourceID.
> Table B is related to table A in the following way:
> select * from table B where b.tableID= (table A) and b.resourceID=
> (primary key of table A). There is no composite foreign key support in
> Django and the database can not be changed. Is there a way to still
> relate those two objects and display them in the Django provided
> inline admin interface?
>
> Wayne

You may be in luck. The table structure you describe is almost exactly
how generic relations[1] are implemented in Django - and there is a
GenericInlineModelAdmin class which allows you to use generic
relations as inlines in the admin. So it looks like all you'd need to
do would be to set up the generic relation using your tableID and
resourceID fields instead of the default object_id and content_type,
populate the ContentTypes table with the tableID values, set up the
generic inline, and you should be in business.
--
DR.

[1]:http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Inline admin objects question

2009-11-18 Thread Wayne
Thanks for your reply.

My situation is a little bit more tricky. I have table A and table B.
Table B has several columns, two of which are tableID and resourceID.
Table B is related to table A in the following way:
select * from table B where b.tableID= (table A) and b.resourceID=
(primary key of table A). There is no composite foreign key support in
Django and the database can not be changed. Is there a way to still
relate those two objects and display them in the Django provided
inline admin interface?

Wayne

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: mod_wsgi django optimization

2009-11-18 Thread Graham Dumpleton


On Nov 19, 8:53 am, Alessandro Ronchi 
wrote:
> On Wed, Nov 18, 2009 at 10:29 PM, Graham Dumpleton <
>
>
>
>
>
> graham.dumple...@gmail.com> wrote:
>
> > Yes, don't be so concerned in the first instance of trying to squeeze
> > the most out of mod_wsgi configuration. You will get much more
> > dramatic gains by improving your database queries/performance and page/
> > data caching techniques.
>
> > Placing a nginx front end proxy in front of Apache/mod_wsgi to handle
> > static files also has benefits beyond just static file sharing.
>
> > So, what have you done in those areas to improve performance?
>
> > In other words, you should perhaps be asking about how to improve your
> > Django application performance rather than worrying about the hosting
> > system, as the hosting system is nearly always not going to be the
> > bottle neck in all of this.
>
> I'm using memcached and it's quite optimized I think.
> Good advice the ngix, but If it's possible I don't want to add another
> webserver. So, I want to get the most out of apache, where I can.

Theoretically nginx will make Apache/mod_wsgi work better for you.

In addition to offloading static file serving, the nginx front end
will also isolate you from slow browser clients. This is because
nginx, provided request content size is under default of 1MB (I
think), will buffer up request headers and request content and only
forward the request through to Apache/mod_wsgi when it has everything.
This means that the request only gets handed off to Apache/mod_wsgi
when all information available such that it can be process
immediately.

Doing this means that Apache will not be tied up with dealing with
slow clients and so it can get away with less processes/threads to
handle same number of requests.

One gets similar benefits with the response as well because the
buffering implicit in the socket pipeline and within nginx means that
Apache/mod_wsgi can offload the response quicker and close its
connection. By being able to do that quicker, it can use that thread
immediately for another request, rather than having to wait for slow
client to read prior response.

Further nginx proxy only supports HTTP/1.0 and so it doesn't use keep
alive. This means connection between nginx and Apache is dropped
immediately once response content offloaded by Apache. Thus Apache
also isn't having to wait around to see if another request might come
down the same socket.

Using nginx as a front end therefore potentially enables Apache/
mod_wsgi to handle a higher load of concurrent requests as Apache/
mod_wsgi will be spending less time processing any one request. This
fact will contribute to how you configure Apache and mod_wsgi.

That all said, it is still important to get request times as handled
by your application down as much as possible. This is where caching
and database optimisation is important, along with a focus on ensuring
pages with most number of hits get extra special attention with
perhaps even caching external to the application being used so that
application doesn't even get involved unless page content expired.

Anyway, we were having a discussion about optimising mod_wsgi settings
on mod_wsgi list a while back. That has gone off the boil at the
moment but will be resurrected again later after having come up with
some better middleware to help in monitoring process/thread
utilisation for purposes of tuning settings.

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-us...@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=.




Re: AdminSite objects

2009-11-18 Thread bjudson
Oh, I see it's much easier to solve this problem by overriding the
admin index view by putting something like this in the main URLconf:

(r'^admin/$', 'admin_views.dashboard'),

and then putting my dashboard view (and other custom views) into an
admin_views.py file in the site root. As described here:

http://www.djangobook.com/en/1.0/chapter17/

Ben.

On Nov 18, 2:50 pm, bjudson  wrote:
> Hi-
> I'm very new to Django, and trying to set up a site with a customized
> admin section. Specifically, I'm trying to override the default admin
> index page with stats & useful links. This will require more than just
> modifying the template, so I'm trying to create a new AdminSite
> instance as described here:
>
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adminsite-obj...
>
> However, this is description is a bit vague... am I supposed to create
> a new app folder for the AdminSite, with views.py, urls.py, etc? I
> can't find any clear descriptions of this process -- if anyone has
> simple code snippets that would be very helpful
>
> thanks.
> Ben.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Initial values for formwizard form

2009-11-18 Thread geraldcor
Ok,

Here is how I do it if I am using a regular form with a regular view:

profile = request.user.get_profile()
form = MyForm('company': profile.defaultcompany, 'contact':
profile.defaultcontact, etc...})
return render_to_response('forms/submit.html', {'form': form},
context_instance=RequestContext(request))

pretty simple and basic.

How do I do this with a form wizard?

Greg

On Nov 17, 3:39 pm, geraldcor  wrote:
> Hello all,
>
> I began making a form that used request.user.get_profile to get
> default values for company name, phone, email etc. I have since
> decided to move to a formwizard to split things up. I have no idea how
> to override methods for the formwizard class to be able to include
> those initial values in the form. Can someone please help me with this
> problem or point me to the proper help? I have come up short with all
> of my searching. 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-us...@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=.




Re: db error after migrating from postgres to oracle

2009-11-18 Thread Ian
On Nov 18, 9:45 am, CDR  wrote:
> Hello,
>
> I've encountered this database exception error: "ORA-01830: date
> format picture ends before converting entire input string."
>
> the sql that produced it was:
>
> sql
> u'INSERT INTO "CBR" ("ORG_ID", "BCID", "NAME", "TCC", "TDC", "TFC",
> "STARTPERIOD", "ENDPERIOD", "STATUS")
>   VALUES (1, 1, Monthly Usage Invoice for ORACLETEST (2009-11),
> 0., 0., 0., 2009-11-01 00:00:00+00:00, 2009-11-30
> 23:59:59.99+00:00, CURRENT) RETURNING "CBR"."ID" INTO
> '
>
> I encountered this from a code base that's been happily running in
> postgres for a long while, and I'm just now trying to get it to run
> against an Oracle 11g backed using the cx_Oracle.
>
> I'm pretty sure it's because the datetime values are not naive, but
> include a tz offset.  Ditching the offset isn't really an option, I
> need to ensure my datetimes are all in UTC for accurate time
> calculations, but still have the ability to present a the data in
> whatever timezone is in settings.py
>
> I've considered modifying the oracle backend to use Oracle's TIMESTAMP
> WITH TIME ZONE datatype, but have not been able to coerce that little
> change in successfully.
>
> I'm using a svn django version from about 2 months ago, I was using
> posgres 8.3, i'm trying to get to Oracle 11g.
>
> Thoughts?
>
> C.

Unfortunately, cx_Oracle currently does not support storing or
retrieving timezone-aware datetimes.  The timezone just gets stripped
off.  The MySQL backend also requires naive datetimes.  I'm not sure
what the official status of the PostgreSQL backend is with regard to
timezone-aware datetimes, although evidently it works.

I would suggest taking a look at the django-timezones app.  I haven't
used it myself, but I believe it's supposed to handle time zone
localization automatically by storing everything in utc.

Regards,
Ian

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Development to deployment

2009-11-18 Thread LeeRisq
I am working on a web site in a windows development environment, but
the hosting plan that my client is currently using runs a Linux
server. Can anyone tell me if there are significant hardships in
making this transition between Windows development vs. Linux
deployment. Thanks for reading.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: mod_wsgi django optimization

2009-11-18 Thread Alessandro Ronchi
On Wed, Nov 18, 2009 at 10:29 PM, Graham Dumpleton <
graham.dumple...@gmail.com> wrote:

>
> Yes, don't be so concerned in the first instance of trying to squeeze
> the most out of mod_wsgi configuration. You will get much more
> dramatic gains by improving your database queries/performance and page/
> data caching techniques.
>
> Placing a nginx front end proxy in front of Apache/mod_wsgi to handle
> static files also has benefits beyond just static file sharing.
>
> So, what have you done in those areas to improve performance?
>
> In other words, you should perhaps be asking about how to improve your
> Django application performance rather than worrying about the hosting
> system, as the hosting system is nearly always not going to be the
> bottle neck in all of this.


I'm using memcached and it's quite optimized I think.
Good advice the ngix, but If it's possible I don't want to add another
webserver. So, I want to get the most out of apache, where I can.


-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




AdminSite objects

2009-11-18 Thread bjudson
Hi-
I'm very new to Django, and trying to set up a site with a customized
admin section. Specifically, I'm trying to override the default admin
index page with stats & useful links. This will require more than just
modifying the template, so I'm trying to create a new AdminSite
instance as described here:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adminsite-objects

However, this is description is a bit vague... am I supposed to create
a new app folder for the AdminSite, with views.py, urls.py, etc? I
can't find any clear descriptions of this process -- if anyone has
simple code snippets that would be very helpful

thanks.
Ben.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: mod_wsgi django optimization

2009-11-18 Thread Graham Dumpleton


On Nov 19, 7:36 am, Alessandro Ronchi 
wrote:
> I'm running several django applications on different vhosts on a virtual
> server.
> In that virtual server  I have enough ram and cpu and I want to get the
> fastest configuration for mod_wsgi.
>
> I don't have much cuncurrent users on the same virtual host, but I have a
> lot of files for every page so I should try to optimize page loading
>
> Now I'm using
> processes=2 maximum-requests=500 threads=25
>
> with no particular apache optimization.
>
> Do you have any advice?

Yes, don't be so concerned in the first instance of trying to squeeze
the most out of mod_wsgi configuration. You will get much more
dramatic gains by improving your database queries/performance and page/
data caching techniques.

Placing a nginx front end proxy in front of Apache/mod_wsgi to handle
static files also has benefits beyond just static file sharing.

So, what have you done in those areas to improve performance?

In other words, you should perhaps be asking about how to improve your
Django application performance rather than worrying about the hosting
system, as the hosting system is nearly always not going to be the
bottle neck in all of this.

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-us...@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.




mod_wsgi django optimization

2009-11-18 Thread Alessandro Ronchi
I'm running several django applications on different vhosts on a virtual
server.
In that virtual server  I have enough ram and cpu and I want to get the
fastest configuration for mod_wsgi.

I don't have much cuncurrent users on the same virtual host, but I have a
lot of files for every page so I should try to optimize page loading

Now I'm using
processes=2 maximum-requests=500 threads=25

with no particular apache optimization.

Do you have any advice?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 javascript includes

2009-11-18 Thread esatterwh...@wi.rr.com
I would say template tags are the nice little framework for doing
this.

you could create a tags the looks in a certain path for files ending
in '.js' based on the model or application and join it with
settings.MEDIA_URL.. have it return a string of text or a list of
strings that you can iterate over in the template.

the you can have something like

{% get_js_for_object myobject %}

secondarly, some JavaScript frameworks have built in dependency
loaders that will fetch scripts based on what is on the page of
specified. mootools does. I think Dojo does. I'm sure others do. If
you are more comfortable with javascript than python/django that might
be something to look into.

On Nov 17, 4:15 am, Thierry  wrote:
> Other frameworks (Symfony) offer simple hooks for managing js
> includes.
> In Django its simply a line of template code.
>
> This is annoying for managing JS dependencies.
>
> Did anyone write a nice little framework for managing js?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.




ManyToMany question

2009-11-18 Thread Gretar
I'm making a game link site, where users can post links to their
favorite web game.
When people post games they are supposed to check what category the
game falls into.
I decided to allow many categories for each game since some games can
fall into many categories.

So the question is, how do I handle this in my view?
And how can I show it as Checkboxes, where at least one has to be
checked?
And how can I show this as checkboxes in the Admin as well?
Here is the code


---
Models:
---
class Category(models.Model):
category = models.CharField(max_length=200)

def __unicode__(self):
return self.category

class Game(models.Model):
name = models.CharField(max_length=200)
url = models.CharField(max_length=200)
poster = models.ForeignKey(User, related_name='game_poster_set')
postdate = models.DateTimeField(default=datetime.now)
cats = models.ManyToManyField(Category)
hits = models.IntegerField(default=0)
post = models.BooleanField(default=False)

---
Views:
---
def submit(request):
form = GameForm(request.POST or None)
if form.is_valid():
game = form.save(commit=False)
game.poster = request.user
game.save()
next = reverse('gamesite.games.views.favorites')
return HttpResponseRedirect(next)
return render_to_response(
'games/submit.html',
{'form': form},
context_instance = RequestContext(request),)

---
Forms:
---
class GameForm(forms.ModelForm):
name = forms.CharField(max_length=15, label='Name')
url = forms.URLField(label='URL', initial='http://')

class Meta:
model = Game
fields = ('name','url')


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-us...@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: Inline admin objects question

2009-11-18 Thread Daniel Roseman
On Nov 18, 6:46 pm, Wayne  wrote:
> Hi,
>
> I am working with a legacy database which does not set foreign key
> constraints at all between tables. I am wondering if I can still
> create Inline admin interface by relating two objects through
> different methods. If it is doable, what is the best way of doing it?
>
> Thanks,
>
> Wayne

There's no requirement for foreign key constraints with inline
objects. Neither sqlite nor the MyISAM backend for MySQL honour
foreign key constraints, but they work in the admin. As long as you
define the foreign key in your model you are fine.
--
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-us...@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.




Inline admin objects question

2009-11-18 Thread Wayne
Hi,

I am working with a legacy database which does not set foreign key
constraints at all between tables. I am wondering if I can still
create Inline admin interface by relating two objects through
different methods. If it is doable, what is the best way of doing it?

Thanks,

Wayne

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: same model field times in query result. How?

2009-11-18 Thread Preston Holmes
Its not clear how you differentiate one measure as speed or another as
dir.  Assuming only one has a link to another measure then you could
do something like:

results = Measurand.objects.exclude(entry__isnull=True).select_related
()

for speed in results:
speed_avg = speed.avg_value
dir_avg = speed.entry.avg_value

This first selects all measurements, excludes those that don't have a
link to another measurement, then fetches information about the
related measurements into the queryset.

-Preston



On Nov 17, 2:33 pm, tom  wrote:
> Hi,
>
> i want to have the same model-field 2x in the query result.
>
> The model.py is:
> class Measurand(models.Model):
>     """
>     A Model for measurement data
>     """
>     entry = models.ForeignKey(Entry)
>     avg_value = models.FloatField(help_text='the average measurement
> value', db_index=True, blank=True, null=True)
>     def __unicode__(self):
>         return 'Measurand:' + str(self.avg_value)
>
> My raw-sql looks like:
> cursor = connection.cursor()
>         cursor.execute(""" SELECT speed.avg_value, dir.avg_value
>                        FROM data_measurand AS speed LEFT JOIN
>                        data_measurand AS dir
>                        ON speed.entry_id=dir.entry_id;
>                        """, locals() )
>         row = cursor.fetchall()
>
> How can i do this with the django-orm?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




django ajax filtered fields

2009-11-18 Thread nuna
When using fields provided by this app there is no add link displayed
above the widget. This is very unhandy because it's impossible to add
a new related item, while editing the post. How can i accomplish this?

I also had problems selecting objects when the foreignkey is to the
same model, it doesn't save the relation.

thx in advanced



--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




db error after migrating from postgres to oracle

2009-11-18 Thread CDR
Hello,

I've encountered this database exception error: "ORA-01830: date
format picture ends before converting entire input string."

the sql that produced it was:

sql
u'INSERT INTO "CBR" ("ORG_ID", "BCID", "NAME", "TCC", "TDC", "TFC",
"STARTPERIOD", "ENDPERIOD", "STATUS")
  VALUES (1, 1, Monthly Usage Invoice for ORACLETEST (2009-11),
0., 0., 0., 2009-11-01 00:00:00+00:00, 2009-11-30
23:59:59.99+00:00, CURRENT) RETURNING "CBR"."ID" INTO
'

I encountered this from a code base that's been happily running in
postgres for a long while, and I'm just now trying to get it to run
against an Oracle 11g backed using the cx_Oracle.

I'm pretty sure it's because the datetime values are not naive, but
include a tz offset.  Ditching the offset isn't really an option, I
need to ensure my datetimes are all in UTC for accurate time
calculations, but still have the ability to present a the data in
whatever timezone is in settings.py

I've considered modifying the oracle backend to use Oracle's TIMESTAMP
WITH TIME ZONE datatype, but have not been able to coerce that little
change in successfully.

I'm using a svn django version from about 2 months ago, I was using
posgres 8.3, i'm trying to get to Oracle 11g.

Thoughts?

C.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Redirect problems

2009-11-18 Thread Zeynel
Adam and Skylar,

The ISP's support just replied to my ticket. They set the urls.py as

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

and this is now working.

But looking at the example in the documentation
http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-simple-redirect-to

urlpatterns = patterns('django.views.generic.simple', ('^foo/(?P\d
+)/$', 'redirect_to', {'url': '/bar/%(id)s/'}),)

I see that it is a little different. I am confused because I don't
exactly understand how urlpatterns works. I hope to read about it
more, e.g., I found this document with lots of examples:

http://www.scribd.com/doc/4975790/urlpatterns-for-django-cheatsheet

Thanks for the help.


On Nov 18, 11:09 am, Skylar Saveland 
wrote:
> What are the details of the error?
>
> On Nov 18, 7:06 am, Zeynel  wrote:
>
>
>
> > I've been trying to redirect
>
> > /admin/ to /admin/wkw1/lawyer
>
> > The suggestions from my previous 
> > posthttp://groups.google.com/group/django-users/msg/67c4594a4083bd45
> > did not work.
>
> > I read the redirect section in the documents as suggested
>
> >http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-...
>
> > and tried this urls.py
>
> > from django.conf.urls.defaults import *
> > from django.contrib import admin
> > admin.autodiscover()
>
> > urlpatterns = patterns('',
> >     (r'^wkw1/$', 'sw1.wkw1.views.index'),
> > #    (r'^admin/', include(admin.site.urls)),
> > )
>
> > urlpatterns += patterns('django.views.generic.simple',
> >    ('^admin/$', 'redirect_to', {'url': '/admin/wkw1/lawyer/'}),
> >    )
>
> > but this too results in a server error.
>
> > Any suggestions?
>
> > 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-us...@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=.




Re: Set model form initial value?

2009-11-18 Thread Nick Arnett
On Wed, Nov 18, 2009 at 2:01 AM, Ilya Polosuhin wrote:

> Just use "initial" keyword on creation form
> class myForm(forms.Form):
> test = forms.CharField(label = _('test'), max_length=255, required =
> True)
> 
> myForm(initial = {'test': 'test string'}).
>
> If you use form that generated from model:
> class myForm(forms.Form):
>
>   class Meta:
> model = myModel
> ...
> myForm(initial = myModel(var1 = 'qq' ))
>

Ah, that last way of doing it is the one that I couldn't find.

Meanwhile, I kludged it by using a loop to generate the choices and "ifequal
choice.id selected_project"  to insert the "checked" attribute into the
appropriate choice, which works.

Nice to know the right way, however.  Thanks

Nick

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Multiple level aggregate

2009-11-18 Thread Adam Knight
On Nov 16, 2009, at 12:12 PM, despy wrote:

> Hi,
> 
> I'm trying to get my head around a complex aggregate query and I could
> do with some help. Say I have the following models
> 
> StockMarket
> |
> Stock
> |
> StockPrice
> 
> If StockPrice has price and date fields, and one price entry for every
> day for every stock how would I write a query to get the average price
> for a given stockmarket for the last six months?


http://docs.djangoproject.com/en/dev/topics/db/aggregation/#generating-aggregates-over-a-queryset

prices = StockPrice.objects.filter(stock__market=SomeMarket,  ... and so on
avg = prices.aggregate(Avg('price'))

Or something like that.  Basically, you approach it from the other end.  You 
want the market's aggregate, but the answer to that is an average of StockPrice 
objects, so you search for them with the conditions you want and then apply the 
aggregate operation to that.

Adam Knight
codepoetry - http://www.codepoetry.net/products/



--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Addree Book Contact Importer in django/python

2009-11-18 Thread Skylar Saveland

>   I need to import contacts of given email id/pwd from gmail,yahoo,hotmail
> for django app. Please suggest?

yaho:
http://developer.yahoo.com/auth/
http://www.amaltas.org/show/using-yahoo-bbauth-with-django.html

goog:
http://code.google.com/p/gdata-python-client/

Not sure about hotmail.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Redirect problems

2009-11-18 Thread Skylar Saveland
What are the details of the error?

On Nov 18, 7:06 am, Zeynel  wrote:
> I've been trying to redirect
>
> /admin/ to /admin/wkw1/lawyer
>
> The suggestions from my previous 
> posthttp://groups.google.com/group/django-users/msg/67c4594a4083bd45
> did not work.
>
> I read the redirect section in the documents as suggested
>
> http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-...
>
> and tried this urls.py
>
> from django.conf.urls.defaults import *
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>     (r'^wkw1/$', 'sw1.wkw1.views.index'),
> #    (r'^admin/', include(admin.site.urls)),
> )
>
> urlpatterns += patterns('django.views.generic.simple',
>    ('^admin/$', 'redirect_to', {'url': '/admin/wkw1/lawyer/'}),
>    )
>
> but this too results in a server error.
>
> Any suggestions?
>
> 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-us...@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=.




Re: Redirect problems

2009-11-18 Thread Adam Knight
On Nov 18, 2009, at 6:06 AM, Zeynel wrote:

> I've been trying to redirect
> 
> /admin/ to /admin/wkw1/lawyer
> 
> The suggestions from my previous post 
> http://groups.google.com/group/django-users/msg/67c4594a4083bd45
> did not work.
> 
> I read the redirect section in the documents as suggested
> 
> http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-simple-redirect-to
> 
> and tried this urls.py
> 
> from django.conf.urls.defaults import *
> from django.contrib import admin
> admin.autodiscover()
> 
> urlpatterns = patterns('',
>(r'^wkw1/$', 'sw1.wkw1.views.index'),
> #(r'^admin/', include(admin.site.urls)),
> )
> 
> urlpatterns += patterns('django.views.generic.simple',
>   ('^admin/$', 'redirect_to', {'url': '/admin/wkw1/lawyer/'}),
>   )
> 
> but this too results in a server error.
> 
> Any suggestions?
> 
> Thanks.

Order matters.


urlpatterns = patterns('',
   (r'^wkw1/$', 'sw1.wkw1.views.index'),
)

urlpatterns += patterns('django.views.generic.simple',
  ('^admin/$', 'redirect_to', {'url': '/admin/wkw1/lawyer/'}),
)

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


Adam Knight
codepoetry - http://www.codepoetry.net/products/

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: ModelForm and fieldsets

2009-11-18 Thread Skylar Saveland
> that was my mistake - had an error in the template - it wors no.
> But according to this, I've another problem - fields which are foreign
> keys don't get rendered.

Typos?  Wrong names?  Maybe try to define the fields explicitly with
the widgets and choices that you want (but then the save method may be
wrong if you are not appropriately matching the model fields but
rather adding fields ...).

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: bulk product import to satchmo

2009-11-18 Thread Skylar Saveland
My buddy did a talk on generically importing data from excel for
pyatl.

http://www.mefeedia.com/watch/25167971

You can check out some code here:

http://code.google.com/p/django-batchimport/

Not sure how it will do with this satchmo business.

> there is no script for parsing.  I'm importing CSV files right into
> the database through the import function in myphpadmin.  I've
> populated the following tables:

E :P

Well, I don't know anything about php but perhaps this method does not
create the autoincrementing PK? - do these rows have ids?

Sounds like trouble generally

> > I've posted this on the satchmo group but i'm not getting any love so
> > I wanted to post it here to see if anyone has done what i'm trying to
> > do.  My client has about 3500 products in an excel spreadsheet and i'm
> > trying to at least import as much product data as possible so that he
> > doesn't have to hand type all of this stuff again.  I've got the
> > product_product table populated but there are no products listed on
> > the product listing page in the admin so he can edit the items.  This
> > leads me to believe that there are other tables which need to be
> > populated in order for the items to show up on the listing page.  Has

mrrr, i think that if a change-list is dependent on another table you
would at least get a traceback.

> > anyone ever done bulk importing from csv successfully?  

Yes :)

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: ModelForm and fieldsets

2009-11-18 Thread Benjamin Wolf
Hi,

that was my mistake - had an error in the template - it wors no.
But according to this, I've another problem - fields which are foreign 
keys don't get rendered.

Here is my code:

class ContactForm(BetterModelForm):
class Meta:
model = Disposal
fieldsets = (('row1', {'fields': 
('contract_type_id','distribution_channel_id','salesman_id'), 'legend': 
''}),
('row2', {'fields': 
('carmodel_id','modeltype_id','trade_in_id','calendar_week'),'legend': ''}),
('row3', {'fields': ('annotation',),'legend': ''}))


It works fine, but every FK gets ignored.
When I render the form without the fieldsets, the FK keys are there as 
aspected.
Thanks a lot again,
greets Ben

Skylar Saveland schrieb:
> If you haven't already, you could instantiate one in the shell and
> render/inspec it there.  You will at least be able to see what might
> be a problem with your class/python-code vs what might be wrong at the
> template level.
>
> On Nov 18, 9:27 am, Benjamin Wolf  wrote:
>   
>> Hi there,
>>
>> I'm using a ModelForm and had the wish to use fieldsets.
>> After a short search I've found 
>> this:http://pypi.python.org/pypi/django-form-utils/0.1.5
>> Seems to be what I want. So I've installed it and changed my form from
>> ModelForm to BetterModelForm.
>>
>> It works so far, but when I try to create a fieldset, it gets ignored /
>> not rendered.
>> Here's my form definition:
>>
>> class ContactForm(BetterModelForm):
>> class Meta:
>> model = Disposal
>> fieldsets = ('main', {'fields': ('customer_name',), 'legend':
>> 'Customer Data'}),
>>
>> Thanks for your help,
>> greets ben
>> 
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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=.
>
>
>   

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: CommaSeparatedIntegerField - no suitable widget?

2009-11-18 Thread anentropic
Ok, so the model, the formfield and the widget each take a 'choices'
attribute.  You have to specify the choices on the formfield for any
choices to show up.

incidentally the styling of CheckboxSelectMultiple seems to be
buggered in the admin, on a Mac at least (FF and Safari)

On Nov 18, 12:06 pm, anentropic  wrote:
> I am trying to use a CommaSeparatedIntegerField in one of my
> models...  there doesn't seem to be a suitable widget for editing this
> field though?
>
> Seems like one of the 'select multiple' widgets would be an obvious
> choice. SelectMultiple seems the default widget for it in admin, but
> it renders an empty list.  I wanted to use CheckboxSelectMultiple but
> that renders nothing (same problem I guess)
>
> It even renders nothing if I specify the 'choices' again on the form
> field.
>
> How are you supposed to use these things?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: ModelForm and fieldsets

2009-11-18 Thread Skylar Saveland
If you haven't already, you could instantiate one in the shell and
render/inspec it there.  You will at least be able to see what might
be a problem with your class/python-code vs what might be wrong at the
template level.

On Nov 18, 9:27 am, Benjamin Wolf  wrote:
> Hi there,
>
> I'm using a ModelForm and had the wish to use fieldsets.
> After a short search I've found 
> this:http://pypi.python.org/pypi/django-form-utils/0.1.5
> Seems to be what I want. So I've installed it and changed my form from
> ModelForm to BetterModelForm.
>
> It works so far, but when I try to create a fieldset, it gets ignored /
> not rendered.
> Here's my form definition:
>
> class ContactForm(BetterModelForm):
>     class Meta:
>         model = Disposal
>         fieldsets = ('main', {'fields': ('customer_name',), 'legend':
> 'Customer Data'}),
>
> Thanks for your help,
> greets ben

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




ModelForm and fieldsets

2009-11-18 Thread Benjamin Wolf
Hi there,

I'm using a ModelForm and had the wish to use fieldsets.
After a short search I've found this: 
http://pypi.python.org/pypi/django-form-utils/0.1.5
Seems to be what I want. So I've installed it and changed my form from 
ModelForm to BetterModelForm.

It works so far, but when I try to create a fieldset, it gets ignored / 
not rendered.
Here's my form definition:

class ContactForm(BetterModelForm):
class Meta:
model = Disposal
fieldsets = ('main', {'fields': ('customer_name',), 'legend': 
'Customer Data'}),
   

Thanks for your help,
greets ben


--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: DJango

2009-11-18 Thread Karen Tracey
On Wed, Nov 18, 2009 at 3:53 AM, victor  wrote:

> Hi, All.
>
> I'm newbie to DJango / BSD lincense.
>
> I have to create web application + desktop widgets. Web application
> will use django, and desktop widget will use django ORM. Can I do this
> under djnago license:
>
> 1) Desktop widget is closed source.
> 2) Sell web application / desktop widget (maybe also closed source /
> partially closed source)
>
> Do I have to specify that I've used Django? Or just put somewhere "NO
> GUARANTEE" statement?
>
>
Here's the license:
http://code.djangoproject.com/browser/django/trunk/LICENSE

By my reading something more than '"NO GUARANTEE" somewhere' is required by
that, but I am not a lawyer.

Note it is probably not in your best business interest to rely on advice
from a list full of tech-types on such questions.  If you are intending to
build a business around use of BSD-licensed code you should either do enough
independent research to the point where you are comfortable with your
understanding of what the license requires, or you should consult a lawyer.

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-us...@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=.




Re: How to use subqueries in django

2009-11-18 Thread Radhikavk

thank you sir i found the solution
-- 
View this message in context: 
http://old.nabble.com/How-to-use-subqueries-in-django-tp26387486p26408019.html
Sent from the django-users mailing list archive at Nabble.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-us...@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=.




Re: Problem with serving static files

2009-11-18 Thread igor
>>> urls.py:
>>> urlpatterns = patterns('',
>>> (r'^polls/', include('mysite.polls.urls')),
>>> (r'^site_media/(?P.*)$', 'django.views.static.serve',
>>> {'document_root': '/mysite/media/'}),
>>> )

Since I always start Django in its "root" directory, I put something like:

import os
urlpatterns += patterns('',
(r'^site_media/(?P.*)$', 'django.views.static.serve',
 {'document_root': os.path.join(os.getcwd(), 'public', 'site_media'}
)

Then I created a "public/site_media" directory in the project's root
directory:

$ mkdir -p public/site_media

And restarted Django.

Hope this helps.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: How to use subqueries in django

2009-11-18 Thread Karen Tracey
On Wed, Nov 18, 2009 at 2:15 AM, Radhikavk  wrote:

>
> in one query they have giver or conditions
> but i need
> i wil have one common query like
> list=rooms.objects.all()  # this is common query i m using
>
> and if the condition given like room status,type etc then i need to append
> those where conditions to the common query
> if room_type
>  append where room_type=this
> else
> nothing
>
> i have so many search criteria , i think this appending is useful but it is
> giving error queryset has no attribute append
>

Certainly it is useful, but in the Django ORM it is not done by calling a
method named append.  It is done by chaining filter calls.  Please read:

http://docs.djangoproject.com/en/dev/topics/db/queries/#id1

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-us...@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=.




Re: Login Error

2009-11-18 Thread Karen Tracey
On Wed, Nov 18, 2009 at 12:12 AM, Denis Bahati  wrote:

> Hi All,
> I have created a login screen for users of the site which is like User
> Profile and uses the username and password from django users. When i try to
> login to my view i get the error below.
>
> Environment: Request Method: POST Request URL:
> http://127.0.0.1/commTrack/commtrack/account/login/ 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', 'commTrack.commtrack']
> Installed Middleware: ('django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware') 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:/xampp/htdocs/commTrack\commtrack\views.py" in login_view 71.
> login(request, user) Exception Type: TypeError at /commtrack/account/login/
> Exception Value: login() takes exactly 1 argument (2 given)
>
> Here is my setting.py
> [snip]
>
Here is my view for login
>
>
> from django.contrib.auth import authenticate, login
> from django.shortcuts import render_to_response
> from django.http import HttpResponseRedirect
> from commTrack.commtrack.models import *
>
> def login_view(request): username = request.POST.get('username', '')
> password = request.POST.get('password', '') user =
> authenticate(username=username, password=password) if user is not None and
> user.is_active: # Correct password, and the user is marked "active"
> login(request, user) # Redirect to a success page. return
> HttpResponseRedirect("/commTrack/") else: # Show an error page return
> HttpResponseRedirect("/commTrack/commtrack/invalid/")
>

The login() function imported from django.conrib.auth takes two arguments.
Yet by the time your login_view attempts to call login() with two arguments,
auth's login definition has been overwritten with one that takes only one
argument.  Either there is a one-argument login getting pulled in by the:

from commTrack.commtrack.models import *

or there is more to this file between the import of auth's login and the
login_view definition, and somewhere in there is a one-argument login that
is hiding the one imported from django.contrib.auth.

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-us...@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=.




Re: Problem with serving static files

2009-11-18 Thread Benjamin Wolf
Thanks Jeremy, got it.

jeremyrdavis schrieb:
> The document root specified in urlpatterns should match the directory
> where your files are located.  You have "/mysite/media/" in your
> urlpatterns and "C:\django_projects\mysite\media" in your post.  Make
> sure those match.
>
>
> On Nov 18, 6:56 am, "Benjamin W."  wrote:
>   
>> Hi there,
>>
>> I'm new to django and got my first little problem.
>> I want to use a css file in my template. So I read 
>> this:http://docs.djangoproject.com/en/dev/howto/static-files/
>>
>> I set up everything, but I don't get the file.
>> My config:
>>
>> urls.py:
>> urlpatterns = patterns('',
>> (r'^polls/', include('mysite.polls.urls')),
>> (r'^site_media/(?P.*)$', 'django.views.static.serve',
>> {'document_root': '/mysite/media/'}),
>> )
>>
>> base.html (css include)
>> 
>>
>> Path to media:
>> C:\djanjo_projects\mysite\media
>>
>> When I open the source code of the page and click on the stylesheet, I
>> get this information:
>> Request URL:http://127.0.0.1:8080/site_media/css/design.css
>> /mysite/media/css/design.css does not exist
>>
>> Whats wrong with my pass?
>> Thanks a lot,
>> greets Ben
>> 
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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=.
>
>
>   

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Problem with serving static files

2009-11-18 Thread Denis Bahati
how do you make them similar? because its also a problem to with TinyMCE.

On Wed, Nov 18, 2009 at 4:13 PM, jeremyrdavis wrote:

> The document root specified in urlpatterns should match the directory
> where your files are located.  You have "/mysite/media/" in your
> urlpatterns and "C:\django_projects\mysite\media" in your post.  Make
> sure those match.
>
>
> On Nov 18, 6:56 am, "Benjamin W."  wrote:
> > Hi there,
> >
> > I'm new to django and got my first little problem.
> > I want to use a css file in my template. So I read this:
> http://docs.djangoproject.com/en/dev/howto/static-files/
> >
> > I set up everything, but I don't get the file.
> > My config:
> >
> > urls.py:
> > urlpatterns = patterns('',
> > (r'^polls/', include('mysite.polls.urls')),
> > (r'^site_media/(?P.*)$', 'django.views.static.serve',
> > {'document_root': '/mysite/media/'}),
> > )
> >
> > base.html (css include)
> > 
> >
> > Path to media:
> > C:\djanjo_projects\mysite\media
> >
> > When I open the source code of the page and click on the stylesheet, I
> > get this information:
> > Request URL:http://127.0.0.1:8080/site_media/css/design.css
> > /mysite/media/css/design.css does not exist
> >
> > Whats wrong with my pass?
> > Thanks a lot,
> > greets Ben
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Problem with serving static files

2009-11-18 Thread jeremyrdavis
The document root specified in urlpatterns should match the directory
where your files are located.  You have "/mysite/media/" in your
urlpatterns and "C:\django_projects\mysite\media" in your post.  Make
sure those match.


On Nov 18, 6:56 am, "Benjamin W."  wrote:
> Hi there,
>
> I'm new to django and got my first little problem.
> I want to use a css file in my template. So I read 
> this:http://docs.djangoproject.com/en/dev/howto/static-files/
>
> I set up everything, but I don't get the file.
> My config:
>
> urls.py:
> urlpatterns = patterns('',
>         (r'^polls/', include('mysite.polls.urls')),
>         (r'^site_media/(?P.*)$', 'django.views.static.serve',
>         {'document_root': '/mysite/media/'}),
> )
>
> base.html (css include)
> 
>
> Path to media:
> C:\djanjo_projects\mysite\media
>
> When I open the source code of the page and click on the stylesheet, I
> get this information:
> Request URL:http://127.0.0.1:8080/site_media/css/design.css
> /mysite/media/css/design.css does not exist
>
> Whats wrong with my pass?
> Thanks a lot,
> greets Ben

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: bulk product import to satchmo

2009-11-18 Thread Bobby Roberts
Hi Francois -

there is no script for parsing.  I'm importing CSV files right into
the database through the import function in myphpadmin.  I've
populated the following tables:

product_price
product_product
product_productpricelookup
product_product_category

the items are not showing in the /admin list area for satchmo.

this really could be a general question and not a satchmo specific
one.  What could cause items in the database to NOT show up in the /
admin area via list or search?




On Nov 18, 5:06 am, Francois Verbeek  wrote:
> what's your model like? What's your import script like? What's your sheet 
> like?
> We need an idea of what you're trying to do before we can help.
>
> I've personally always preferred writing a parser for the xls file (usually 
> in csv form instead of xls, though)
> and directly create/use/save the model objects to populate the database 
> instead of accessing the tables directly.
> If you really want to make your life difficult or need exotic parsing of the 
> file (like multiple sheets, non-linear parsing, etc.) , using a win32com 
> connexion to Excel and generating a python script -- that would contain your 
> data-- can work.
>
> Francois
>
> - Original Message -
> From: "Bobby Roberts" 
> To: "Django users" 
> Sent: Tuesday, 17 November, 2009 9:19:21 PM
> Subject: bulk product import to satchmo
>
> I've posted this on the satchmo group but i'm not getting any love so
> I wanted to post it here to see if anyone has done what i'm trying to
> do.  My client has about 3500 products in an excel spreadsheet and i'm
> trying to at least import as much product data as possible so that he
> doesn't have to hand type all of this stuff again.  I've got the
> product_product table populated but there are no products listed on
> the product listing page in the admin so he can edit the items.  This
> leads me to believe that there are other tables which need to be
> populated in order for the items to show up on the listing page.  Has
> anyone ever done bulk importing from csv successfully?  If so, what
> fields are required to get it to show up in the /admin listing page?
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Problem with serving static files

2009-11-18 Thread Benjamin W.
Hi there,

I'm new to django and got my first little problem.
I want to use a css file in my template. So I read this:
http://docs.djangoproject.com/en/dev/howto/static-files/

I set up everything, but I don't get the file.
My config:

urls.py:
urlpatterns = patterns('',
(r'^polls/', include('mysite.polls.urls')),
(r'^site_media/(?P.*)$', 'django.views.static.serve',
{'document_root': '/mysite/media/'}),
)


base.html (css include)



Path to media:
C:\djanjo_projects\mysite\media

When I open the source code of the page and click on the stylesheet, I
get this information:
Request URL:http://127.0.0.1:8080/site_media/css/design.css
/mysite/media/css/design.css does not exist

Whats wrong with my pass?
Thanks a lot,
greets Ben

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




CommaSeparatedIntegerField - no suitable widget?

2009-11-18 Thread anentropic
I am trying to use a CommaSeparatedIntegerField in one of my
models...  there doesn't seem to be a suitable widget for editing this
field though?

Seems like one of the 'select multiple' widgets would be an obvious
choice. SelectMultiple seems the default widget for it in admin, but
it renders an empty list.  I wanted to use CheckboxSelectMultiple but
that renders nothing (same problem I guess)

It even renders nothing if I specify the 'choices' again on the form
field.

How are you supposed to use these things?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Looking for Django/Apache/Plesk consultant

2009-11-18 Thread Hooshyar
Hello Djangoists,

I am looking for a consultant who knows how to configure Django in
relationship to Apache. This is a paid gig. please contact me at my e-
mail hnara...@hanzinet.com we can discuss details.

Brief statement of the problem

I have had problem configuring Django to handle two projects under one
domain. The problem started when I moved the applications to a new
server. Somehow vhost.conf file is not processed properly. It only
runs the first project we typed. The second one is ignored. The
previous server, where everything worked, is RHE 5.0, running Plesk
8.0 and Django 0.96. The new server is a Linux box, running Plesk 9.2
and Django 0.96.

Thank you in advance. Looking forward to hearing from you.

Hooshyar

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Redirect problems

2009-11-18 Thread Zeynel
I've been trying to redirect

/admin/ to /admin/wkw1/lawyer

The suggestions from my previous post 
http://groups.google.com/group/django-users/msg/67c4594a4083bd45
did not work.

I read the redirect section in the documents as suggested

http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-simple-redirect-to

and tried this urls.py

from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^wkw1/$', 'sw1.wkw1.views.index'),
#(r'^admin/', include(admin.site.urls)),
)

urlpatterns += patterns('django.views.generic.simple',
   ('^admin/$', 'redirect_to', {'url': '/admin/wkw1/lawyer/'}),
   )

but this too results in a server error.

Any suggestions?

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-us...@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=.




Re: how to run django with fastcgi, but not run as user "root" on linux

2009-11-18 Thread Tom Evans
On Wed, Nov 18, 2009 at 8:25 AM, Fm  wrote:

> Hi all,
> I have write a script in /etc/rc.d/init.d so that Django can start
> with my server.
> It may look like
> start () {
>echo -n $"Starting $prog: "
> /usr/local/bin/python /home/admin/cc/manage.py runfcgi method=threaded
> host=127.0.0.1 port=12345
> }
>

/usr/bin/su nobody -c /usr/local/bin/python /home/admin/cc/manage.py runfcgi
method=threaded host=127.0.0.1 port=12345

I'd be surprised if your RC system didn't provide a cleaner way of setting
the user to run as though.

Cheers

Tom

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




how to run django with fastcgi, but not run as user "root" on linux

2009-11-18 Thread Fm
Hi all,
I have write a script in /etc/rc.d/init.d so that Django can start
with my server.
It may look like
start () {
echo -n $"Starting $prog: "
/usr/local/bin/python /home/admin/cc/manage.py runfcgi method=threaded
host=127.0.0.1 port=12345
}

Then I can see
ps aux|grep manage
root  2478  0.0  6.1  70700 22752 ?Sl   07:09   0:00 /usr/
local/bin/python /home/admin/cc/manage.py runfcgi method=threaded
host=127.0.0.1 port=12345


Now I don't want to run django as user root,because I think it may
cause security problem.
what should I do?
Can you give me an example to run as user nobody(or someone whose
shell is /sbin/nologin )?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




DJango

2009-11-18 Thread victor
Hi, All.

I'm newbie to DJango / BSD lincense.

I have to create web application + desktop widgets. Web application
will use django, and desktop widget will use django ORM. Can I do this
under djnago license:

1) Desktop widget is closed source.
2) Sell web application / desktop widget (maybe also closed source /
partially closed source)

Do I have to specify that I've used Django? Or just put somewhere "NO
GUARANTEE" statement?

Regards,
Victor.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: How to lay out large, *modular* website in Django.

2009-11-18 Thread zimnyx
Thank you for replies :-)

I forgot to mention important thing:
Those website modules will probably be run on separate hosts (they can
be put on different hosts or virtual hosts, but still use the same
database)
.. so one point in "What is common between them": "global
configuration (database uri, debug level, i18n, session etc.)" may be
misleading.

My current code layout is:
|-- my_django_projects
|-- foo_common
`-- foo_employees
`-- foo_mainwebsite
`-- foo_monitoring

In foo_common I put general settings, which are imported and can be
overwritten in specific project. foo_common contains also applications
that are used among all the projects. What I don't like is that models
definitions are spread all over the tree and using south migrations is
sensitive to human errors, like forgetting to set some migration
dependency. Second thing is that I need to run test separately for all
projects, or write some script/runner that will run all tests at one
go.

Cheers

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: bulk product import to satchmo

2009-11-18 Thread Francois Verbeek
what's your model like? What's your import script like? What's your sheet like?
We need an idea of what you're trying to do before we can help.

I've personally always preferred writing a parser for the xls file (usually in 
csv form instead of xls, though)
and directly create/use/save the model objects to populate the database instead 
of accessing the tables directly. 
If you really want to make your life difficult or need exotic parsing of the 
file (like multiple sheets, non-linear parsing, etc.) , using a win32com 
connexion to Excel and generating a python script -- that would contain your 
data-- can work. 

Francois

- Original Message -
From: "Bobby Roberts" 
To: "Django users" 
Sent: Tuesday, 17 November, 2009 9:19:21 PM
Subject: bulk product import to satchmo

I've posted this on the satchmo group but i'm not getting any love so
I wanted to post it here to see if anyone has done what i'm trying to
do.  My client has about 3500 products in an excel spreadsheet and i'm
trying to at least import as much product data as possible so that he
doesn't have to hand type all of this stuff again.  I've got the
product_product table populated but there are no products listed on
the product listing page in the admin so he can edit the items.  This
leads me to believe that there are other tables which need to be
populated in order for the items to show up on the listing page.  Has
anyone ever done bulk importing from csv successfully?  If so, what
fields are required to get it to show up in the /admin listing page?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Set model form initial value?

2009-11-18 Thread Ilya Polosuhin
Just use "initial" keyword on creation form
class myForm(forms.Form):
test = forms.CharField(label = _('test'), max_length=255, required =
True)

myForm(initial = {'test': 'test string'}).

If you use form that generated from model:
class myForm(forms.Form):

  class Meta:
model = myModel
...
myForm(initial = myModel(var1 = 'qq' )).

On Wed, Nov 18, 2009 at 4:19 AM, Nick Arnett  wrote:

> I can't see to figure out how to do something fairly simple - set the
> initial value of a model form field at runtime.  The form is a simple set of
> radio buttons that lets the user choose which project to work on.  I'm
> storing the selection in a session variable and that's working fine.  What I
> can't figure out, though it seems like it must be staring me in the face, is
> how to set the current choice that's stored in the session variable, so that
> when the form is displayed, the current project's radio button is selected.
>
> I've created custom forms and set initial values... but how do I do that
> with a model form?  Or should it be a custom form to do that?
>
> Thanks in advance,
>
> Nick
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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=.
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




how best to allow admin users to edit only one "site"

2009-11-18 Thread django_jedi
Hi all,

Let's say I have a django app that feeds content to multiple sites.  I
have an admin user for "Site1" and an admin user for "Site2".  I would
like to set things up so that the guy from "Site1" can't see/edit the
content for "Site2".

What's the best way to set this up?

Thanks for your 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-us...@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=.