Re: Without Apache

2007-08-06 Thread KpoH



Artiom Diomin пишет:
> webserver: nginx with fastcgi
>
>   

-- 
Artiom Diomin, Development Dep, "Comunicatii Libere" S.R.L.
http://www.asterisksupport.ru
http://www.asterisk-support.com


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



Re: Django tutorial with SVN trunk: descriptor 'upper' requires a 'str' object but received a 'unicode'

2007-08-06 Thread Brian Duff

Well... this patch got me past it. It seems that some of the table
names are unicode and other table names are str. I wonder if this is
because I upgraded my django version part way through the tutorial...

--- management.py   (revision 5818)
+++ management.py   (working copy)
@@ -65,11 +65,12 @@
 for model in models.get_models(app):
 all_models.append(model)
 if backend.uses_case_insensitive_names:
-converter = str.upper
+converter = unicode.upper
 else:
 converter = lambda x: x
-return set([m for m in all_models if converter(m._meta.db_table)
in map(converter, table_list)])

+return set([m for m in all_models if
converter(unicode(m._meta.db_table)) in map(converter, table_list)])
+
 def _get_table_list():
 "Gets a list of all db tables that are physically installed."
 from django.db import connection, get_introspection_module


On Aug 5, 8:26 pm, Brian Duff <[EMAIL PROTECTED]> wrote:
> I'm trying to follow the django tutorial with the latest SVN trunk (I
> had to upgrade from 0.96 because there appears to be an issue with
> 0.96 and Oracle databases). At the point 
> inhttp://www.djangoproject.com/documentation/tutorial01/
> that it instructs you to "python manage.py sql polls", I see:
>
> Traceback (most recent call last):
>   File "manage.py", line 11, in 
> execute_manager(settings)
>   File "/usr/local/lib/python2.5/site-packages/django/core/
> management.py", line 1725, in execute_manager
> execute_from_command_line(action_mapping, argv)
>   File "/usr/local/lib/python2.5/site-packages/django/core/
> management.py", line 1684, in execute_from_command_line
> output = action_mapping[action](mod)
>   File "/usr/local/lib/python2.5/site-packages/django/core/
> management.py", line 117, in get_sql_create
> known_models = set([model for model in
> _get_installed_models(_get_table_list()) if model not in app_models])
>   File "/usr/local/lib/python2.5/site-packages/django/core/
> management.py", line 71, in _get_installed_models
> return set([m for m in all_models if converter(m._meta.db_table)
> in map(converter, table_list)])
> TypeError: descriptor 'upper' requires a 'str' object but received a
> 'unicode'
>
> A quick scan through management.py seems to suggest that, true enough,
> converter is often str.upper. Any ideas how I can resolve this?
>
> Thanks,
> Brian


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



MySQL and InnoDB

2007-08-06 Thread Rob Hudson

Hi Django Users,

I'm using MySQL with Django but I dislike MySQL's default MyISAM
tables because there is no referential integrity.  So I googled how to
force Django to create InnoDB tables with MySQL and I found that I
need to add this to my settings.py:

DATABASE_OPTIONS = {
   "init_command": "SET storage_engine=INNODB",
}

I also saw that there was a comment stating to only do this when you
run syncdb and not when running in general.  I can understand that
it's only really needed when you run the CREATE statements, but does
anyone know if it adds any overhead if it's left in?  It's somewhat of
a PITA to have to remember to alter my settings if I'm adjusting my
data models.

Thanks,
Rob

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



elseif or elseifqual or elseifnotequal

2007-08-06 Thread james_027

Hi,

Just want to confirm if elseif and the alike doesn't exist in django's
template.

What tricks could be give to newbies if something like is needed ...

if bool:

elseif bool:

elseif boo:

it could be not nice to do something like this in django's template

{% if bool %}
{% else %}
{% if bool %}
{% else %}
{% if bool %}
{% endif %}
{% endif %}
{% endif  %}

THanks
james


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: elseif or elseifqual or elseifnotequal

2007-08-06 Thread Kai Kuehne

Hi James,

On 8/6/07, james_027 <[EMAIL PROTECTED]> wrote:
> Just want to confirm if elseif and the alike doesn't exist in django's
> template.
>
> What tricks could be give to newbies if something like is needed ...

Is switch ok? :)
http://www.djangosnippets.org/snippets/300/

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Something like a mini Crystal Reports with Django

2007-08-06 Thread Ben Ford
Hi again guys,
I've created a google code project called
django-reportsto share my
work thus far. As I mention on the welcome page, it's far from
complete, but it all works on my machine. I'll try and whip up some
documentation ASAP to help people get up and running, for now though just
read the source and IPython :-). Priorities are getting a reasonable
filtering mechanism together to make the user interface workable (and easy),
and to make up some tests. Please feel free to email me with any and all
questions/suggestions. I hope you all find it useful and that we can work
together to get it production ready! Mir, email me off list and I'll give
you the https password so you can access it too. I will also let Carole and
Toby know about this so that maybe we can explore reportlab and R
integration respectively.
Cheers,
Ben

On 06/08/07, Mir Nazim <[EMAIL PROTECTED]> wrote:
>
>
> Cool cool cool
>
> We will be waiting.
>
> One request, I am unable to access the svn with http protocol due my
> ISP not ready to configure its Firewall to allow all http methods. So
> could you please set it up under https or svn+ssh
>
> Thanks
>
> On Aug 6, 6:47 am, "Ben Ford" <[EMAIL PROTECTED]> wrote:
> > Hi guys,
> > Thanks for the interest! I'll split it up from my main app and put it
> into
> > SVN on my server. I'd really like comments on some of the design
> decisions
> > I've made, I was thinking about it last night and I think I may have got
> a
> > bit too clever! I'll post on here when I've got everything figured. :-)
> > Ben
> >
> > On 05/08/07, Mir Nazim <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> > > Ho ho,
> >
> > > Its generating a lot of interest.
> >
> > > On Aug 4, 3:18 pm, "Chris Hoeppner" <[EMAIL PROTECTED]> wrote:
> > > > Need another tester? Count me in.
> >
> > > > 2007/8/4, Mir Nazim < [EMAIL PROTECTED]>:
> >
> > > > > Me too me too.
> >
> > > > > Ben, Let us know if you need help with testing or some thing else.
> > > > > I will more interested in Models and View than template.
> >
> > > > > On Aug 3, 11:51 am, "Matt Davies" <[EMAIL PROTECTED]> wrote:
> > > > > > Ben, I'd be interested in looking at that application.
> >
> > > > > > Need someone to help with testing?
> >
> > > > > > On 03/08/07, Ben Ford <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > I'm working on a django app at the moment that allows you to
> > > define and
> > > > > > > save reports. It has a method similar to templatetags for
> loading
> > > user
> > > > > > > defined functions to add to the reports too. As it stands you
> can
> > > build and
> > > > > > > save these reports with a web front end, and download the
> results
> > > in CSV. I
> > > > > > > just need to write a front end for creating filters and it'll
> be
> > > good to go.
> > > > > > > I'll be happy to release it for the benefit of others when
> it's
> > > done.
> > > > > > > Ben
> >
> > > > > > > On 03/08/07, Mir Nazim < [EMAIL PROTECTED]> wrote:
> >
> > > > > > > > I understand that views need to be created. I am doing that
> > > these
> > > > > > > > days.
> >
> > > > > > > > What specifically I wanted to know is whether anyone else
> has
> > > worked
> > > > > > > > on a similar stuff. So he might want to share his
> experience.
> >
> > > > > > > > BRIT is Java. I would prefer something more python based
> > > solution.
> > > > > > > > even better is there is a django based one. If there is
> none,
> > > its
> > > > > > > > obvious I will have to create one.
> >
> > > > > > > > On Aug 2, 8:20 pm, Lucky B < [EMAIL PROTECTED] >
> wrote:
> > > > > > > > > You could try Eclipse BIRT for a WYSIWYG interface. But
> > > otherwise you
> > > > > > > > > can create a view however you want to report your data
> doing
> > > whatever
> > > > > > > > > manipulation you wanted. I don't see what else you would
> need
> > > other
> > > > > > > > > than to create a view.
> >
> > > > > > > > > On Aug 2, 5:17 am, Mir Nazim <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > > > Anybody has any views on this.
> >
> > > > > > > > > > --
> > > > > > > > > > PS: posting just to keep this topic fresh
> >
> > > > > > > > > > On Jul 31, 4:28 pm, Mir Nazim < [EMAIL PROTECTED]>
> wrote:
> >
> > > > > > > > > > > Hello
> >
> > > > > > > > > > > I was wondering has anybody done application that was
> > > something
> > > > > > > > like a
> > > > > > > > > > > mini crystal reports. Generating a report based of
> model
> > > items
> > > > > > > > > > > selected in a WYSIWYG(ok this is not important)
> > > fashion.  And
> > > > > > > > > > > generating a HTML tables based report with defined
> > > calculations
> > > > > > > > etc.
> >
> > > > > > > > > > > I understand that Django Admin has some kind of
> similar
> > > > > > > > facilities. I
> > > > > > > > > > > am looking into them. In the mean time thought that
> may be
> > > some
> > > > > > > > one
> > > > > > > > > > > else might be doing similar stuff somewhere.
> >
> > > > > > > --
> > > 

Re: elseif or elseifqual or elseifnotequal

2007-08-06 Thread james_027

hi kai!

thanks a lot. this will help a lot.

cheers,
james

On Aug 6, 4:02 pm, "Kai Kuehne" <[EMAIL PROTECTED]> wrote:
> Hi James,
>
> On 8/6/07, james_027 <[EMAIL PROTECTED]> wrote:
>
> > Just want to confirm if elseif and the alike doesn't exist in django's
> > template.
>
> > What tricks could be give to newbies if something like is needed ...
>
> Is switch ok? :)http://www.djangosnippets.org/snippets/300/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Generating charts with ReportLab

2007-08-06 Thread Ben Ford
Hi Carole,
Just FYI as they are kind of related topics, I've created a project called
django-reports  with some of my
code for reporting on your django objects. I thought you might find it
interesting and integration with reportlabs would be a cool feature for the
future. See my other message to the group or the link for more details. To
everyone else: Sorry for the double message for those of you not using gmail
:-)
Ben


On 30/07/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> Hey Ben...thanks...I'll check that out.
>
> We'll most likely continue to use ReportLab for our project, as we are
> using the graphs in some reports we are going to export to PDF... but
> looks like an interesting read :)
>
> I'll also add the other two samples to the wiki this week...
> Carole
>
> On Jul 30, 4:29 am, "Ben Ford" <[EMAIL PROTECTED]> wrote:
> > Hey Carole,
> > A guy called Toby has put something together using R and rpy that does
> > graphs... I haven't been able to make it work as yet, but he's keen to
> move
> > on with it, and wants some testers and some help!
> > Check out:
> http://groups.google.com/group/django-users/browse_thread/thread/43ea...
> >
> > or just have a look through your gmail for *Re: Graphs and django.*
> > (The search string "contrib namespace r" worked for me.)
> > Ben
> >
> > On 30/07/07, David Reynolds <[EMAIL PROTECTED] > wrote:
> >
> >
> >
> >
> >
> > > On 28 Jul 2007, at 4:34 am, [EMAIL PROTECTED] wrote:
> >
> > > > I had the need to generate a few different types of charts using
> > > > ReportLab.  The wiki only had a sample of a Horizontal Bar Chart, so
> > > > I've added a new sample on how to produce a Line Chart...
> > > >http://code.djangoproject.com/wiki/Charts
> >
> > > > If anyone is interested in a sample for a Pie or Scatter chart, let
> me
> > > > know, and I can add samples of these as well.
> >
> > > I would say, go ahead and add them, as I'm sure many people will find
> > > them useful at some point.
> >
> > > Thanks,
> >
> > > David
> >
> > > --
> > > David Reynolds
> > > [EMAIL PROTECTED]
> >
> > --
> > Regards,
> > Ben Ford
> > [EMAIL PROTECTED]
> > +628111880346
>
>
> >
>


-- 
Regards,
Ben Ford
[EMAIL PROTECTED]
+628111880346

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: auth system - check if user already exists

2007-08-06 Thread LaundroMat

Of the top of my head, but would the following be helpful?
user, new = User.objects.get_or_create(username = user, email =
email)

The function returns either:
- a new user object and True if the user didn't exist yet (and had to
be created);
- an object with existing user data and False.

Mind that you still have to call user.save() in case of a new user.

On Aug 5, 11:42 pm, Aljosa Mohorovic <[EMAIL PROTECTED]>
wrote:
> i'm currently looking at django.contrib.auth and wondering what is the
> correct way to check if user already exists?
> before i call User.objects.create_user() i want to know that user with
> submitted username and email doesn't exist.
> my current situation is that i call
> User.objects.get(username__exact=user) and
> User.objects.get(email__exact=email) and if i get exception
> "DoesNotExist: User matching query does not exist." and i assume that
> it's ok to create new user.
>
> i'm sure there is a better way to check if user with submitted
> username or email already exists, please share your ways...
>
> Aljosa


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Enjoy it !

2007-08-06 Thread [EMAIL PROTECTED]

Enjoy it !
1) http://www.mmopawn.com
2) http://www.mmopawn.com
3) http://www.mmopawn.com
4) http://www.mmopawn.com
5) http://www.mmopawn.com
6) http://www.mmopawn.com
7) http://www.mmopawn.com

 a good site about world of warcraft -


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



database replication/failover...

2007-08-06 Thread Gábor Farkas

hi,

how do/did you approach/solve the "what happens if the database (server) 
dies?" problem?

what kind of replication/failover solutions do you use?

(i'm primarily interested in postgres..)

i'm not talking about database-replication solutions for performance 
reasons (scaling etc..).

i already collected some approaches that might be worth investigating 
(pgpool,slony,heartbeat,drbd for example), and would like to know if 
there are also some other solutions/approaches..

or, if someone has some experience that he's willing to share, i'd be 
glad to listen to "what worked" and "what did not work".

thanks,
gabor

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: mod_python/django problems

2007-08-06 Thread David Reynolds


On 4 Aug 2007, at 11:44 am, Graham Dumpleton wrote:


In your Apache configuration, do you have multiple VirtualHost
definitions for sites under the same parent domain and have a
ServerAlias directive in any which contains a wildcard which would
match a different VirtualHost containers ServerName directive? For
example:

  
  ServerName www.site.com
  ...
  

  
  ServerName site.com
  ServerAlias *.site.com
  ...
  

Do the mixing up of pages always relate to the virtual hosts which
contain the ServerAlias and the alternate virtual host the ServerAlias
matches, or are they totally unrelated sites with totally different
domain names?


They all have:



and none of them have wildcarded domain names.

It has been www.customerdomain1.tld that has appeared on  
www.customerdomain2.tld


Thanks,

David
--
David Reynolds
[EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature


Re: auth system - check if user already exists

2007-08-06 Thread Aljosa Mohorovic

i'm checking username and email because i want to avoid situations
where some user registers with same email using different username.

Aljosa


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: database replication/failover...

2007-08-06 Thread moe

hi gabor,

On Mon, Aug 06, 2007 at 11:02:08AM +0200, Gábor Farkas wrote:
> 
> hi,
> 
> how do/did you approach/solve the "what happens if the database (server) 
> dies?" problem?
> 
> what kind of replication/failover solutions do you use?
> (i'm primarily interested in postgres..)
> 
> i'm not talking about database-replication solutions for performance 
> reasons (scaling etc..).
> 
> i already collected some approaches that might be worth investigating 
> (pgpool,slony,heartbeat,drbd for example), and would like to know if 
> there are also some other solutions/approaches..

we have fairly good expirience (in terms of reliability)
with slony2 for 1->1 replication. it's not for the faint
of heart as there's some trigger-magic and rough edges
involved but seemed like the most tested solution at
the time.

> or, if someone has some experience that he's willing to share, i'd be 
> glad to listen to "what worked" and "what did not work".

among the ones you mentioned i would personally prefer
pgpool-ii over most anything else, simply because it
seems the least complex and the inherent drawbacks
(i.e. serial columns and in-db magic [pl/sql] should
 be avoided) don't bother me.

unfortunately it still doesn't seem to be available to the
unwashed masses and pgpool-i feels way too hacky for my taste.


hth, moe


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: mod_python/django problems

2007-08-06 Thread Gábor Farkas

Jacob Kaplan-Moss wrote:
> On 8/3/07, Aljosa Mohorovic <[EMAIL PROTECTED]> wrote:
>> on few blogs/web sites it is stated that > 30 django sites on one
>> server running apache/mod_python have some issues, like untraceable
>> errors and wrong site displaying for some domain.
>> any comments on this?
> 
> When something like this happens, it's usually because of a missing
> PythonInterpreter and/or DJANGO_SETTINGS_MODULE directive.
> 
> We've had far more than 30 sites on a single Apache, no problems. I
> use the past-tense since we've started running multiple instances of
> Apache (instead of one monolithic one with many vhosts) so that we
> have greater granular control over each individual site.
> 

did you go as far as having 1 apache / 1 app? or more like grouping 5-10 
sites into one apache?

did it change the memory-usage in any way?

(i mean, did 1 apache with 30 sites use the same amount of memory than 
30 apache with 1site/apache?)


thanks,
gabor

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: mod_python/django problems

2007-08-06 Thread Gábor Farkas

Matt Davies wrote:
> We've got over 70 sites running on lighttpd, no problems at all.
> 

with fastcgi/flup?

gabor

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: PAK Host Online(PHO) - Web Hosting, Free Domain Registration /Transfer, Website Builder & Web Marketing in Pakistan, Karachi, Lahore, Islamabad & Rawalpindi at http://www.pakhostonline.com/

2007-08-06 Thread Chris Hoeppner

I *hate* spammers.

2007/8/5, koom2020 <[EMAIL PROTECTED]>:
>
> PAKHostOnline.com offered Pakistan No.1 Web Hosting, DOMAIN
> Registration / Transfer, 99% UP-Time, 24/7 Technical Support at
> http://www.pakhostonline.com/
>
>
> >
>


-- 
Best Regards,
Chris Hoeppner - www.pixware.org // My weblog

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Replying to spam messages

2007-08-06 Thread Russell Keith-Magee

On 8/6/07, Chris Hoeppner <[EMAIL PROTECTED]> wrote:
>
> I *hate* spammers.

And I like ponies.

You aren't alone in hating spam, but unfortunately, its the price you
pay for having an open mailing list. Replying to these messages
doesn't help to stop the problem - it makes it WORSE it two very
specific ways:

1) It increases the level of pointless noise traffic on the list.
2) It increases the likelyhood that you yourself will be filtered into
the spam bucket, since your name gets associated with spammy content.

The second point isn't abstract. There are a number of users that feel
the need to reply to spam messages, and without exception, my spam
filter now puts any thread they start into my spam bucket rather than
my inbox.

So if you want your posts to get attention - PLEASE stop replying to
spam messages.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: MySQL and InnoDB

2007-08-06 Thread Matti Haavikko

Hi,

Can you get the same result with "default-storage-engine=InnoDB" in your 
my.cnf?

 - Haavikko

Rob Hudson wrote:
> Hi Django Users,
>
> I'm using MySQL with Django but I dislike MySQL's default MyISAM
> tables because there is no referential integrity.  So I googled how to
> force Django to create InnoDB tables with MySQL and I found that I
> need to add this to my settings.py:
>
> DATABASE_OPTIONS = {
>"init_command": "SET storage_engine=INNODB",
> }
>
> I also saw that there was a comment stating to only do this when you
> run syncdb and not when running in general.  I can understand that
> it's only really needed when you run the CREATE statements, but does
> anyone know if it adds any overhead if it's left in?  It's somewhat of
> a PITA to have to remember to alter my settings if I'm adjusting my
> data models.
>
> Thanks,
> Rob
>
> >
>
>   


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to specify engine type for particular table?

2007-08-06 Thread Peter Melvyn

Hi all,


I operate MySQL server with default-storage-engine set to InnoDB. But
I need full text search on some tables, which is unfortunatelly
supported by MyISAM engine only.

Is there a way to specify ENGINE=MyISAM option appended to CREATE
TABLE DDL command generated by manage.py?


Thanks, Peter

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



Re: related_name

2007-08-06 Thread Lic. José M. Rodriguez Bacallao
right now, I find out how but, anyway, I'll give U an example:

every ForeigmKey have a related_name parameter in its constructor, the
problem is how to change that value once we construct the ForeignKey object.
I did so changing the value of the: foreignkey_object.rel.related_name at
runtime.

On 8/4/07, Amirouche <[EMAIL PROTECTED]> wrote:
>
>
>
>
> On Aug 1, 10:07 pm, "Lic. José M. Rodriguez Bacallao"
> <[EMAIL PROTECTED]> wrote:
> > how can I change the "related_name" value in a ForeignKey field
> dynamically
> > at model creation time?
> >
>
> What do you really mean I don't understand, give an example
>
>
> >
>


-- 
Lic. José M. Rodriguez Bacallao
Cupet
-
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic por
profesionales
-

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Menu implementation

2007-08-06 Thread Lic. José M. Rodriguez Bacallao
yes

On 7/18/07, Carl Karsten <[EMAIL PROTECTED]> wrote:
>
>
> Lic. José M. Rodriguez Bacallao wrote:
> > Have anybody implemented a tree with django, for example, a menu?
> >
>
> tree = ui or data structurer?  (guessing the answer is yes to both)
>
> Carl K
>
> >
>


-- 
Lic. José M. Rodriguez Bacallao
Cupet
-
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic por
profesionales
-

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with __setattr__ and __getattribute__

2007-08-06 Thread Matti Haavikko

Hi,

I asked the same question earlier.
When ID is set to None and object is saved, the M2M fields are not 
copied. They must be copied separately.
Caveats: the code below uses django internals and is very lightly tested.

def copy_m2m_fields(src, dst):
for m2m_field in src._meta.many_to_many:
attname = m2m_field.get_attname()
src_manager = getattr(src, attname)
# idea from django/core/serializers/python.py,base.py
# ... collect primary keys
ids = [related._get_pk_val() for related in src_manager.iterator()]
# ... assign id list to target field
setattr(dst, attname, ids)
dst.save()


Jacob Kaplan-Moss wrote:
> Hi Dave --
>
> I'm not sure what's going on in your code example, but there's a
> *much* easier way of copying an object::
>
> >>> o = MyModel.objects.get(pk=1)
> >>> o.id = None
> >>> o.save()
>
> By setting the ID (or whatever your primary key is called) to ``None``
> and calling save() you'll force Django to insert a new object instead
> of updating the existing one. All that monkeying with ``__dict__``
> isn't really needed.
>
> /me makes note to think about adding an ``obj.copy()`` method...
>
> Jacob
>
> >
>
>   


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django : generic view object_list

2007-08-06 Thread Marco A.
Hi to all ,
I have created a view:

(r'^$', 'django.views.generic.list_detail.object_list', info_dict),

In the template I have :

this is just a test, !

{% if error_message %}{{ error_message }}{% endif %}



{% for User in info_dict %}
aaa
{{ User.user }} 
{% endfor %}


I cant see , nothing from this list,
I have tried to use User.objects.all but nothing change.
I doesnt see aaa ,so the for doesnt run.

I know that info_disct is a query_set but I can show it whit a for ?

I tried :

User[0].user  and User [0] but doesnt work

Thanks you very much to all for the help that I received and I recive from
this ML-group,

Ciao

Marco

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django : generic view object_list

2007-08-06 Thread Nebojša Đorđević

On 06.08.2007., at 14:12, Marco A. wrote:

> I have created a view:
>
> (r'^$', 'django.views.generic.list_detail.object_list', info_dict),
>
> In the template I have :
>
> this is just a test, !
>
> {% if error_message %}{{ error_message }}{%  
> endif %}
>
> 
>
> {% for User in info_dict %}

{% for User in object_list %}

http://www.djangoproject.com/documentation/generic_views/#django- 
views-generic-list-detail-object-list

`object_detail` puts all of the found objects in *object_list*.

-- 
Nebojša Đorđević - nesh, Studio Quattro - Niš - Serbia
http://studioquattro.biz/ | http://nesh.studio-quattro.info
http://www.ohloh.net/accounts/6315 | http://www.linkedin.com/in/neshdj
Registered Linux User 282159 [http://counter.li.org]


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django and mod_proxy

2007-08-06 Thread Przemek Gawronski

> Is that running by runserver:8000?

Yep!

> Is your django dev server serving static files?

Yes, django server is serving static files, in my urlpatterns = patterns('',
   (r'^js/(?P.*)$', 'django.views.static.serve',{'document_root':
  '/home/django/work/fw/media/'}),
   (r'^css/(?P.*)$', 'django.views.static.serve',{'document_root':
  '/home/django/work/fw/media/'}),

> What log file is show?

error_log (for apache):

[Mon Aug 06 14:25:01 2007] [error] [client xx.yy.zz.vv] File does not
exist: /usr/local/apache2/htdocs/css, referer: 
http://myserver.com/ezlecenie/zlecenia/strona1/
[Mon Aug 06 14:25:01 2007] [error] [client xx.yy.zz.vv] File does not
exist: /usr/local/apache2/htdocs/js, referer: 
http://myserver.com/ezlecenie/zlecenia/strona1/

So it's obviously looking on the main (running proxy) server for static
files, not on django server.

This is my mod_proxy setup:

ProxyRequests On
ProxyPass /ezlecenie/ http://192.168.1.2:8000/
ProxyPassReverse /ezlecenie/ http://192.168.1.2:8000/


Przemek
-- 
AIKIDO TANREN DOJO  -   Poland - Warsaw - Mokotow - Ursynow - Natolin
info: http://www.tanren.pl/ phone: +4850151 email: [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Replying to spam messages

2007-08-06 Thread Chris Hoeppner

Sorry, Russ. Won't happen again :)

2007/8/6, Russell Keith-Magee <[EMAIL PROTECTED]>:
>
> On 8/6/07, Chris Hoeppner <[EMAIL PROTECTED]> wrote:
> >
> > I *hate* spammers.
>
> And I like ponies.
>
> You aren't alone in hating spam, but unfortunately, its the price you
> pay for having an open mailing list. Replying to these messages
> doesn't help to stop the problem - it makes it WORSE it two very
> specific ways:
>
> 1) It increases the level of pointless noise traffic on the list.
> 2) It increases the likelyhood that you yourself will be filtered into
> the spam bucket, since your name gets associated with spammy content.
>
> The second point isn't abstract. There are a number of users that feel
> the need to reply to spam messages, and without exception, my spam
> filter now puts any thread they start into my spam bucket rather than
> my inbox.
>
> So if you want your posts to get attention - PLEASE stop replying to
> spam messages.
>
> Yours,
> Russ Magee %-)
>
> >
>


-- 
Best Regards,
Chris Hoeppner - www.pixware.org // My weblog

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Do I have to send shopping cart data to every template in my app?

2007-08-06 Thread Greg

Oggie,
Thanks for the reply.  So you're saying that it would be better to
send my shopping cart data to every template through my all my
view's?  If that's the case then I assume there is no way to send
request.session information using a custom template?

Thanks

On Aug 3, 4:36 pm, oggie rob <[EMAIL PROTECTED]> wrote:
> If you really need to use a tag, look 
> athttp://www.djangoproject.com/documentation/templates_python/#passing-...
> But I think you probably would find it easier to add an extra context
> processor & avoid the tag altogether.
>
>  -rob
>
> On Aug 3, 6:01 am, Greg <[EMAIL PROTECTED]> wrote:
>
> > Thanks for your help...I'm now able to create a custom tag.  However,
> > I now seem to have a another problem with custom tags.  How do I send
> > session information to each template.   I can't use
> > request.session['cart'] in my custom tag function because it doesn't
> > have a request parameter.  I always get the error 'global name request
> > is not defined'


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: startproject errors with Ubuntu

2007-08-06 Thread john

On Aug 5, 10:46 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 8/5/07, john <[EMAIL PROTECTED]> wrote:
>
> > thks - the tutorial shows the .py extension and that was giving the
> > error.
>
> The file's name is 'django-admin.py', not 'django-admin', and the
> tutorial is correct; the problem was that you did not have the
> executable bit set on django-admin.py, and so you did not have
> permission to execute that file from the command line.

Okay,  but who is the Ubuntu package manager contact  for django? -
how can we get the packaging straightened out so new people to django
don't face the same problem I did.  As I mentioned before, it seems
the packaging can be improved.

> On 8/5/07, john <[EMAIL PROTECTED]> wrote:
> Also I still think something might be wrong with the ubuntu packaging
> - I don't understand why the same django files (under /django/bin)
> should be in 3 locations:  /usr/lib/python-django/,  /usr/lib/
> python2.5/site-packages/, and /usr/share/python-support/python-
> django/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django app for managing sending email to users...

2007-08-06 Thread Fabien Schwob

Hello,

> I've set up django-mailer at Google Code:
>
> http://code.google.com/p/django-mailer/
>
> and written down a bunch of notes on the home page about use cases
> and functional requirements.
>
> If no one objects, we can continue discussion on this list, although
> I'm happy to start up django-mailer list at Google Groups if people
> prefer.

How is it possible to help ? I'm about to write somethink like
django-mailer for a website I maintain, so I think it's better to
contribute to django-mailer.

Does you already have an idea of the architecture of this future app ?

-- 
Fabien SCHWOB

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: startproject errors with Ubuntu

2007-08-06 Thread Brett Parker

On Mon, Aug 06, 2007 at 06:07:16AM -0700, john wrote:
> 
> On Aug 5, 10:46 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> > On 8/5/07, john <[EMAIL PROTECTED]> wrote:
> >
> > > thks - the tutorial shows the .py extension and that was giving the
> > > error.
> >
> > The file's name is 'django-admin.py', not 'django-admin', and the
> > tutorial is correct; the problem was that you did not have the
> > executable bit set on django-admin.py, and so you did not have
> > permission to execute that file from the command line.
> 
> Okay,  but who is the Ubuntu package manager contact  for django? -
> how can we get the packaging straightened out so new people to django
> don't face the same problem I did.  As I mentioned before, it seems
> the packaging can be improved.

Err, it's not an "official" ubuntu package, it's a compile of the debian
package you can find that with a simple "apt-cache show
python-django". Bugs, apparently, should be mailed to
"[EMAIL PROTECTED]", I'm in the "Original-Maintainer" field.

The packaging just uses python support - there's nothing clever going on
there - the only thing we (me and raphael, my sponsor for that package)
do is rename django-admin.py to django-admin and drop it in /usr/bin for
convienience. (Oh, and change /usr/bin/env python -> /usr/bin/python,
modify the bash completion to deal with django-admin.

If you've got any suggestions for the packaging, I'm willing to listen!

Thanks,
-- 
Brett Parker

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: startproject errors with Ubuntu

2007-08-06 Thread Forest Bond
On Sun, Aug 05, 2007 at 11:46:45PM -0500, James Bennett wrote:
> 
> On 8/5/07, john <[EMAIL PROTECTED]> wrote:
> > thks - the tutorial shows the .py extension and that was giving the
> > error.
> 
> The file's name is 'django-admin.py', not 'django-admin', and the
> tutorial is correct; the problem was that you did not have the
> executable bit set on django-admin.py, and so you did not have
> permission to execute that file from the command line.

The Ubuntu package ships a django-admin executable.  I'm not sure if it is just
a symlink to django-admin.py, or if it is django-admin.py renamed.  This is to
achieve compliance with Debian policy, which (I believe) recommends against
extensions like .py on commands.

I could, however, be mis-remembering all of this stuff.

John, you should remove the django installation in /usr/local if you have the
Ubuntu package installed.

-Forest
-- 
Forest Bond
http://www.alittletooquiet.net


signature.asc
Description: Digital signature


Re: startproject errors with Ubuntu

2007-08-06 Thread Brett Parker

On Mon, Aug 06, 2007 at 09:53:02AM -0400, Forest Bond wrote:
> On Sun, Aug 05, 2007 at 11:46:45PM -0500, James Bennett wrote:
> > 
> > On 8/5/07, john <[EMAIL PROTECTED]> wrote:
> > > thks - the tutorial shows the .py extension and that was giving the
> > > error.
> > 
> > The file's name is 'django-admin.py', not 'django-admin', and the
> > tutorial is correct; the problem was that you did not have the
> > executable bit set on django-admin.py, and so you did not have
> > permission to execute that file from the command line.
> 
> The Ubuntu package ships a django-admin executable.  I'm not sure if it is 
> just
> a symlink to django-admin.py, or if it is django-admin.py renamed.  This is to
> achieve compliance with Debian policy, which (I believe) recommends against
> extensions like .py on commands.

Absolutely correct:
http://www.debian.org/doc/debian-policy/ch-files.html#s-scripts

Because the django-admin script is put in to /usr/bin, it needs to
follow Debian policy! However - for the people that *really* want to use
django-admin.py, you can do:
export PATH=$PATH:/usr/lib/python-django/bin

Which holds the various django bin files.

Cheers,
-- 
Brett Parker

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: auth system - check if user already exists

2007-08-06 Thread LaundroMat

Are you sure you want to avoid that? I remember somebody here linking
to an article where this wasn't advised, because it's (apparently)
quite common for members of the same household to register with the
same e-mail address (but with another username ofcourse).

On Aug 6, 12:02 pm, Aljosa Mohorovic <[EMAIL PROTECTED]>
wrote:
> i'm checking username and email because i want to avoid situations
> where some user registers with same email using different username.
>
> Aljosa


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: XML serializer

2007-08-06 Thread birkin

Russ (and others),

> The Django serializers accept any iterable, not just query sets. You
> can pass in any list or set of Django object instances, and they 
> willserializefine.
>
> Yours,
> Russ Magee %-)

I thought the same thing from this line in the serialization
documentation:

(Actually, the second argument can be any iterator that yields Django
objects, but it'll almost always be a QuerySet).

But this isn't working for me; please tell me what I'm doing wrong
below.

>>>
>>> from django.core import serializers
>>> serializers.serialize( "xml", ['abc','def','ghi'] )
Traceback (most recent call last):
  File "", line 1, in ?
  File "/sw/lib/python2.4/site-packages/django/core/serializers/
__init__.py", line 67, in serialize
s.serialize(queryset, **options)
  File "/sw/lib/python2.4/site-packages/django/core/serializers/
base.py", line 36, in serialize
self.start_object(obj)
  File "/sw/lib/python2.4/site-packages/django/core/serializers/
xml_serializer.py", line 42, in start_object
raise base.SerializationError("Non-model object (%s) encountered
during serialization" % type(obj))
SerializationError: Non-model object () encountered during
serialization
>>>

Now really, my goal is not to serialize a list, but rather a non-model
object-instance. If I try passing in an instance of a class (in a list
so it's iterable) that last error-line reads:

SerializationError: Non-model object () encountered
during serialization

If I try passing in (now in desperate curiosity-stage) the class
itself (again, in a list) I get:

SerializationError: Non-model object () encountered
during serialization

It seems to *really* want a model-object! Pointers very welcome!

-Birkin


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DateField() , AttributeError: 'str' object has no attribute 'strftime'

2007-08-06 Thread justquick

I have recently been working on a model and found this problem:

class Image(Model):
name = CharField(maxlength=255)
owner = ForeignKey('user')
file = ImageField(upload_to='Image/%Y-%m/', blank=True, null=True)
description = TextField()
datetime = DateTimeField(auto_now_add=True)

class Admin:
search_fields = ('description','name')
list_filter = ('datetime',)

def __str__(self): return self.name

Add the app to my installed apps list and then any attempt to run
manage.py results in:

Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/usr/lib/python2.5/site-packages/django/core/management.py",
line 1725, in execute_manager
execute_from_command_line(action_mapping, argv)
  File "/usr/lib/python2.5/site-packages/django/core/management.py",
line 1616, in execute_from_command_line
action_mapping[action](int(options.verbosity),
options.interactive)
  File "/usr/lib/python2.5/site-packages/django/core/management.py",
line 510, in syncdb
_check_for_validation_errors()
  File "/usr/lib/python2.5/site-packages/django/core/management.py",
line 1195, in _check_for_validation_errors
num_errors = get_validation_errors(s, app)
  File "/usr/lib/python2.5/site-packages/django/core/management.py",
line 1046, in get_validation_errors
for r in rel_opts.get_all_related_objects():
  File "/usr/lib/python2.5/site-packages/django/db/models/options.py",
line 146, in get_all_related_objects
if f.rel and self == f.rel.to._meta:
AttributeError: 'str' object has no attribute '_meta'


Seems to be only a problem with ImageField, FileField still works

Fedora Core 7
Django  (0, 97, 'pre') (SVN)
Python 2.5
MySql 5.0.37



On Aug 5, 8:27 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 8/4/07, Frank Singleton <[EMAIL PROTECTED]> wrote:
>
>
>
> > AttributeError: 'str' object has no attribute 'strftime'
>
> Hi Frank,
>
> You're the second person in recent history to report this problem -
> however, I've been unable to replicate it. The last user was on
> Windows, and I had mentally put it down as a configuration issue; the
> fact that you're seeing it on Linux suggests that it might be a larger
> problem.
>
> The short version: The database backend (sqlite/pysqlite) should be
> returning datetime objects for records containing date fields, but for
> some reason, it seems to be returning strings for some users.
>
> If you can provide a simple test case that exhibits the problem (e.g.,
> minimal model, set of instructions for generating the error, complete
> set of version details for OS, database, etc), I'll have another look
> and see what I can see.
>
> Yours,
> Russ Magee %-)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: auth system - check if user already exists

2007-08-06 Thread Aljosa Mohorovic

On Aug 6, 4:55 pm, LaundroMat <[EMAIL PROTECTED]> wrote:
> Are you sure you want to avoid that? I remember somebody here linking
> to an article where this wasn't advised, because it's (apparently)
> quite common for members of the same household to register with the
> same e-mail address (but with another username ofcourse).

good point but in my situation users will mostly be companies so i
want to ensure that nobody with same email registers twice.

Aljosa


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Using filter(...) to bring back all records?

2007-08-06 Thread Greg

Hello,
I have a form that will contain 3 select input types.  The user is
going to have the ability to narrow down the products by selecting a
value in these 3 select boxes (Price, Size, Color).  However, the user
also has the ability to not select anything.  In this case I would
want to return all the records.  Is there a way in django that I can
do this?  This is what I currently have for Price:

a = Price.objects.filter(id=request['price'])

If the user selected a price then the request['price'] would equal the
id of the price record.  However, if the user didn't select a price.
Then I'd want request['price'] to be a value that wouldn't exclude any
record in the Price table.  Such as:

a = Price.objects.filter(id=*) # So request['price'] would equal *
in this example

I can't use a = Price.objects.all(), because I won't know beforehand
if the user selected a price to search for.


Thanks


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



Re: Using filter(...) to bring back all records?

2007-08-06 Thread Tõnis Kevvai

You could try this:

kwargs = {}
if request['price']:
  kwargs['id'] = request['price']
a = Price.objects.filter(**kwargs)

-- 
Tõnis Kevvai
"How can entropy be reversed?"


On 8/6/07, Greg <[EMAIL PROTECTED]> wrote:
>
> Hello,
> I have a form that will contain 3 select input types.  The user is
> going to have the ability to narrow down the products by selecting a
> value in these 3 select boxes (Price, Size, Color).  However, the user
> also has the ability to not select anything.  In this case I would
> want to return all the records.  Is there a way in django that I can
> do this?  This is what I currently have for Price:
>
> a = Price.objects.filter(id=request['price'])
>
> If the user selected a price then the request['price'] would equal the
> id of the price record.  However, if the user didn't select a price.
> Then I'd want request['price'] to be a value that wouldn't exclude any
> record in the Price table.  Such as:
>
> a = Price.objects.filter(id=*) # So request['price'] would equal *
> in this example
>
> I can't use a = Price.objects.all(), because I won't know beforehand
> if the user selected a price to search for.
>
>
> Thanks
>
>
> >
>

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



Re: Using filter(...) to bring back all records?

2007-08-06 Thread Tim Chase

> I have a form that will contain 3 select input types.  The user is
> going to have the ability to narrow down the products by selecting a
> value in these 3 select boxes (Price, Size, Color).  However, the user
> also has the ability to not select anything.  In this case I would
> want to return all the records.  Is there a way in django that I can
> do this?  This is what I currently have for Price:
> 
> a = Price.objects.filter(id=request['price'])


Request objects are chainable and lazy, so you can do something like

   a = Price.objects.all()
   if 'price' in request:
 a = a.filter(id=request['price'])

this can lead to code like

   a = Price.objects.all()
   for criterion in ('price', 'color', 'size'):
 if criterion in request:
   a = a.filter(id=request[criterion])

or if the field each form-field maps to differs from "id"

   field_map = [
 ('price', 'id'),
 ('color': 'field2'),
 ('size', 'field3'),
 ]
   for fieldname, formfieldname in field_map:
 if formfieldname in request:
   a = a.filter(**{fieldname: request[formfieldname]})

which leaves "a" filtered by price/size/color based on any of the 
request parameters.

IMHO, a Price object is an odd partitioning of data, as it sounds 
more like an attribute of some other model.  But given that as 
your data model, the above should do what you describe.

-tim





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



full-text indexing

2007-08-06 Thread cesco

Hi,

is there any rough estimate on when the full-text indexing branch will
be integrated into trunk?

Thanks
Francesco


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: startproject errors with Ubuntu

2007-08-06 Thread john

On Aug 6, 9:48 am, Brett Parker <[EMAIL PROTECTED]> wrote:
> On Mon, Aug 06, 2007 at 06:07:16AM -0700, john wrote:
>
> > On Aug 5, 10:46 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> > > On 8/5/07, john <[EMAIL PROTECTED]> wrote:
>
> > > > thks - the tutorial shows the .py extension and that was giving the
> > > > error.
>
> > > The file's name is 'django-admin.py', not 'django-admin', and the
> > > tutorial is correct; the problem was that you did not have the
> > > executable bit set on django-admin.py, and so you did not have
> > > permission to execute that file from the command line.
>
> > Okay,  but who is the Ubuntu package manager contact  for django? -
> > how can we get the packaging straightened out so new people to django
> > don't face the same problem I did.  As I mentioned before, it seems
> > the packaging can be improved.
>
> Err, it's not an "official" ubuntu package, it's a compile of the debian
> package you can find that with a simple "apt-cache show
> python-django". Bugs, apparently, should be mailed to
> "[EMAIL PROTECTED]", I'm in the "Original-Maintainer" field.
>
> The packaging just uses python support - there's nothing clever going on
> there - the only thing we (me and raphael, my sponsor for that package)
> do is rename django-admin.py to django-admin and drop it in /usr/bin for
> convienience. (Oh, and change /usr/bin/env python -> /usr/bin/python,
> modify the bash completion to deal with django-admin.
>
> If you've got any suggestions for the packaging, I'm willing to listen!


just as suggestions:
1) the /django/bin/ files are in 3 locations (perhaps because I
loaded from respository and from tarball) - the 3 locations are:
a) /usr/lib//python2.5/site-packages/ 
b) /usr/lib/python-django/..   (the folder is symlinked but all
the files are still underneath)
c) /usr/share/python-support/.

if there's a good reason for them to be in all 3 places fine, just is
confusing

2) whether ".py" or not to be ".py" doesn't really matter - just an
explanation on the tutorial for debian/ubuntu users will help avoid
the constant frustration I had trying to get it to run (and to avoid
future support msgs on the same issue).

thks for the support - I am now exploring Django and seeing if it can
convert me from rails.

john


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



The Django Book

2007-08-06 Thread Mourner

Hi,

I hope the community here knows the answer to this question: is this
gorgeous project available at http://www.djangobook.com/en/beta/ not
dead?

It's very sad to see that it hasn't been updated since January.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: The Django Book

2007-08-06 Thread Greg Donald

On 8/6/07, Mourner <[EMAIL PROTECTED]> wrote:
> I hope the community here knows the answer to this question: is this
> gorgeous project available at http://www.djangobook.com/en/beta/ not
> dead?
>
> It's very sad to see that it hasn't been updated since January.

You get what you pay for.

And pretty soon there will be a Django book you can pay for  :)


-- 
Greg Donald
http://destiney.com/

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



Re: The Django Book

2007-08-06 Thread Tim Chase

> I hope the community here knows the answer to this question: is this
> gorgeous project available at http://www.djangobook.com/en/beta/ not
> dead?
> 
> It's very sad to see that it hasn't been updated since January.


he's resting.  Remarkable book, the Norwegian Django book.  'e's 
stunned.  Probably pining for the fjords.

:)

My understanding is that the djangobook project has either

1) been put on hold until the 1.0 API solidifies or
2) doing some pre-press stuff that's not interesting and thus not 
public

as determined by searching here:

http://groups.google.com/group/django-users/search?q=django-book+1.0&start=10&sa=N&scoring=d&hl=en

-tim




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Do I have to send shopping cart data to every template in my app?

2007-08-06 Thread oggie rob

No, you don't need to use the same template. You are just filling in
some data on every request using the context processor. Its like this:

1) Write a context processor that adds shopping cart info to every
context. Now it can be accessed via {{ cart.items }} or however you
set it up
2) Write templates to use these. For example, if you only want the
shopping cart info in, say, half of your pages, have those pages
extend a template that contains {{ cart.items }} in the header. For
the others, don't.
3) Alternatively, if you *don't* want shopping cart info in all of
your contexts, you can use the additional argument to RequestContext
for just those views where it is used. The docs reference an
"ip_address_processor" that is added this way.

And in answer to your questions:
a) I don't know if it is better to send your shopping cart data to
every template. That depends on your application.
b) Of course there is a way. It is included as request.session in
every view, if you have the session middleware activated. If this
solves your display questions, it is probably easier than creating a
custom processor anyway.

HTH,
 -rob

On Aug 6, 6:29 am, Greg <[EMAIL PROTECTED]> wrote:
> Oggie,
> Thanks for the reply.  So you're saying that it would be better to
> send my shopping cart data to every template through my all my
> view's?  If that's the case then I assume there is no way to send
> request.session information using a custom template?
>
> Thanks
>
> On Aug 3, 4:36 pm, oggie rob <[EMAIL PROTECTED]> wrote:
>
> > If you really need to use a tag, look 
> > athttp://www.djangoproject.com/documentation/templates_python/#passing-...
> > But I think you probably would find it easier to add an extra context
> > processor & avoid the tag altogether.
>
> >  -rob
>
> > On Aug 3, 6:01 am, Greg <[EMAIL PROTECTED]> wrote:
>
> > > Thanks for your help...I'm now able to create a custom tag.  However,
> > > I now seem to have a another problem with custom tags.  How do I send
> > > session information to each template.   I can't use
> > > request.session['cart'] in my custom tag function because it doesn't
> > > have a request parameter.  I always get the error 'global name request
> > > is not defined'


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django Admin Sorting

2007-08-06 Thread Chris Sabanty

Hey all,

A few questions about sorting fields with automatically generated
Django admin pages.
1. When you want to sort by a field generated by a function, is it
possible to have it sort both ascending and descending?

I have a column called name, which is populated by a function that
appends first_name and last_name. I added the attribute
admin_order_field = 'last_name' to the name function. However, it only
sorts it one direction (descending).

2. Is it possible to add sorting for foreign keys?

I have a foreign key called role that displays properly. I also tried
creating a dummy function called sortableRole that used a notation
similar to search_fields: admin_order_field = 'role__name'. I'm
guessing this functionality isn't built into Django yet.

Any help would be greatly appreciated.

Chris


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: The Django Book

2007-08-06 Thread Jeremy Dunck

On 8/6/07, Tim Chase <[EMAIL PROTECTED]> wrote:
> My understanding is that the djangobook project has either
>
> 1) been put on hold until the 1.0 API solidifies or
> 2) doing some pre-press stuff that's not interesting and thus not
> public
>

There's some non-public pre-press stuff going on, and there's
significant editing already done.  I don't think there'll be another
site update until the book is ready for press; at that point, the
preferred url will be / rather than /beta (or similar).

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: full-text indexing

2007-08-06 Thread Jarek Zgoda

On 6 Sie, 19:47, cesco <[EMAIL PROTECTED]> wrote:

> is there any rough estimate on when the full-text indexing branch will
> be integrated into trunk?

Well, at least PyLucene full-text search code is unusable in current
form found in this branch. Any threading GCJ-compiled code can not be
embedded in threaded or forking environment. That means, in most of
web servers currently in use in this world.

Cheers
J.


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



DB ProgrammingError

2007-08-06 Thread Michal

Hello,
is there some shortcut in Django to "reset" database engine to accept 
next DB queries, when I receive error like "ProgrammingError: ERROR: 
current transaction is aborted, commands ignored until end of 
transaction block" in shell?

I often meet situation, when try some new code in ./manage.py shell and 
construct DB query, which give me message above. In this situation I 
must quit from ipython, start it, again import all necessary objects and 
continue with hacking (very tedious).
It will be nice to call something like "reset_db_connection" and 
immediately continue in work.

Is there some similar function please? (I read somewhere how to do this, 
but forgot it, and solution wasn't so straightforward).

What do you do in situations like this please?


Regards
Michal

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DB ProgrammingError

2007-08-06 Thread James Bennett

On 8/6/07, Michal <[EMAIL PROTECTED]> wrote:
> Is there some similar function please? (I read somewhere how to do this,
> but forgot it, and solution wasn't so straightforward).

You will need to find some way to issue a ROLLBACK statement to your
database. One such way is

from django.db import connection
connection.connection.rollback()


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

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



DB queries with filter and exclude

2007-08-06 Thread Michal

Hello,
I have defined two models, one reffered from another with ManyToManyField.

This referrer is used to categorising objects with 0, 1 or more tags. 
Now I want to get all objects, which have set tag "food" *and* *have 
not* set tag "cake".

Example:

object | tags
---+--
  obj1  | food, meat
  obj2  | food, meat
  obj3  | food
  obj4  | food, cake
  obj5  | food, cake
  obj6  | food, vegetable
  obj7  | garden, vegetable

This get all objects with tag="food" set (obj1..obj5):

   Obj.objects.filter(tags__in=[Tags.objects.filter(name='food')])

This get all objects, which haven't set tag "cake" (obj1..obj3, obj6..obj7):

   Obj.objects.exclude(tags__in=[Tags.objects.filter(name='cake')])

When I try to combine DB queries together, I don't get what I expect 
(obj1..obj3, obj6):

 
Obj.objects.filter(tags__in=[Tags.objects.filter(name='food')]).objects.exclude(tags__in=[Tags.objects.filter(name='cake')])

How to construct queries like this please?


Regards
Michal

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Accessing data from a tuple in a template?

2007-08-06 Thread Shane Graber

On one of my models (in models.py), I have the something like the
following defined below a class:

STATUS_CHOICES = (
(1, 'Ham'),
(2, 'Turkey'),
(3, 'Beef'),
)

The Django admin interface is smart enough to pick up the text from
the tuple and use it when displaying the dropdown menu when presented
to the user and use the numeric value to store the selection in the
database.  How does one access the text instead of the number when
writing my own templates?  I've looked through the documentation and I
must just be missing the paragraph on how to get at this information.

Any help would be appreciated.  Thanks!

Shane

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Accessing data from a tuple in a template?

2007-08-06 Thread daev

http://www.djangoproject.com/documentation/db-api/#get-foo-display


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DB queries with filter and exclude

2007-08-06 Thread Tim Chase

> Now I want to get all objects, which have set tag "food" *and* *have 
> not* set tag "cake".
> 
> This get all objects with tag="food" set (obj1..obj5):
> 
>Obj.objects.filter(tags__in=[Tags.objects.filter(name='food')])
> 
> This get all objects, which haven't set tag "cake" (obj1..obj3, obj6..obj7):
> 
>Obj.objects.exclude(tags__in=[Tags.objects.filter(name='cake')])
> 
> When I try to combine DB queries together, I don't get what I expect 
> (obj1..obj3, obj6):


Django's ORM doesn't handle this sort of thing very gracefully, 
so it requires dropping down to a little SQL with .extra() calls.

Something like

  Obj.objects.extra(where=["""
 app_model.id IN (
   SELECT model_id
   FROM app_tags
   WHERE name = ?
 )
 """, ['food']).extra(where["""
 app_model.id NOT IN (
   SELECT model_id
   FROM app_tags
   WHERE name = ?
 )
 """, ['cake'])

it's ugly and hackish, but when things scale up, this is the only 
way to get it to work (I've got several hundred thousand records 
in my app that does logic like this, so I need all the 
speed-boost I can get)

if your tagsets return small collections, you could use 
sets...something like

  food = set(t.obj_id for t in Tags.objects.filter(name='food'))
  cake = set(t.obj_id for t in Tags.objects.filter(name='cake'))
  Obj.objects.filter(id__in=food - cake)

(that last line might need to be "tuple(food-cake)")

but as noted, this doesn't scale well once "food" or "cake" tags 
thousands of things (or maybe even hundreds of things).

-tim





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django/Ellington online internships/San Diego Reader

2007-08-06 Thread xmlman

Django/Ellington online internships now available at the San Diego
Reader, America's largest alternative newsweekly. Contact
[EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DB queries with filter and exclude

2007-08-06 Thread [EMAIL PROTECTED]

Given your view code above, what would the template code look like to
return something like this:

object | tags
---+--
  obj1  | food, meat
  obj2  | food, meat
  obj3  | food
  obj4  | food, cake
  obj5  | food, cake
  obj6  | food, vegetable
  obj7  | garden, vegetable



On Aug 6, 1:46 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > Now I want to get all objects, which have set tag "food" *and* *have
> > not* set tag "cake".
>
> > This get all objects with tag="food" set (obj1..obj5):
>
> >Obj.objects.filter(tags__in=[Tags.objects.filter(name='food')])
>
> > This get all objects, which haven't set tag "cake" (obj1..obj3, obj6..obj7):
>
> >Obj.objects.exclude(tags__in=[Tags.objects.filter(name='cake')])
>
> > When I try to combine DB queries together, I don't get what I expect
> > (obj1..obj3, obj6):
>
> Django's ORM doesn't handle this sort of thing very gracefully,
> so it requires dropping down to a little SQL with .extra() calls.
>
> Something like
>
>   Obj.objects.extra(where=["""
>  app_model.id IN (
>SELECT model_id
>FROM app_tags
>WHERE name = ?
>  )
>  """, ['food']).extra(where["""
>  app_model.id NOT IN (
>SELECT model_id
>FROM app_tags
>WHERE name = ?
>  )
>  """, ['cake'])
>
> it's ugly and hackish, but when things scale up, this is the only
> way to get it to work (I've got several hundred thousand records
> in my app that does logic like this, so I need all the
> speed-boost I can get)
>
> if your tagsets return small collections, you could use
> sets...something like
>
>   food = set(t.obj_id for t in Tags.objects.filter(name='food'))
>   cake = set(t.obj_id for t in Tags.objects.filter(name='cake'))
>   Obj.objects.filter(id__in=food - cake)
>
> (that last line might need to be "tuple(food-cake)")
>
> but as noted, this doesn't scale well once "food" or "cake" tags
> thousands of things (or maybe even hundreds of things).
>
> -tim


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DB queries with filter and exclude

2007-08-06 Thread Tim Chase

> Given your view code above, what would the template code look like to
> return something like this:
> 
> object | tags
> ---+--
>   obj1  | food, meat
>   obj2  | food, meat
>   obj3  | food
>   obj4  | food, cake
>   obj5  | food, cake
>   obj6  | food, vegetable
>   obj7  | garden, vegetable

you'd simply iterate over the resulting Obj's and then iterate 
over its tags:

  
   objecttags
   {% for obj in objs %}
   
 {{ obj }}
 
  {% for tag in obj.tag_set %}
   {{ tag }}{% if forloop.last %}{% else %}, {% endif %}
  {% endfor %}
 
   
   {% endfor %}
  

My code doesn't change anything but how "objs" gets populated or 
how the template displays "objs"

-tim




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: full-text indexing

2007-08-06 Thread Amirouche

I think that full text search works with mysql and with a patched
version for postgresql [1] (prefered way!)
But this is not my prefered way to use full text search I think,
because:
1. no ranking by revelance support (at least for postgres)
2. most of the time you want to search throught a model and not only
on one field... so filter(myattribute__search='mything') is not
really... interresting...

I come back with some bits


[1] http://code.djangoproject.com/ticket/4676


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: full-text indexing

2007-08-06 Thread ludo

On Aug 6, 7:47 pm, cesco <[EMAIL PROTECTED]> wrote:
> Hi,
>
> is there any rough estimate on when the full-text indexing branch will
> be integrated into trunk?

You can already use full text indexing in Django with the excellent
Sphinx search engine [1]. There's some code on DjangoSnippets [2], and
I have a slimmer version that additionally uses Sphinx's abstract
engine to generate contextual excerpts for results.

Sphinx is pretty easy to set up, and *very* fast. It integrates nicely
with MySQL and PostgreSQL, or with a bit of fiddling with anything
that can be exported as XML.

Ludo


[1] http://sphinxsearch.com/
[2] http://www.djangosnippets.org/snippets/231/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DB queries with filter and exclude

2007-08-06 Thread [EMAIL PROTECTED]

Wow, thanks for the reply. I can't get this to work though--I get an
"iteration over non-sequence". Can you take a look?

model...

class Author(models.Model):
first_name = models.CharField(maxlength=30)
last_name = models.CharField(maxlength=40)

def __str__(self):
return '%s %s' % (self.first_name, self.last_name)

class Book(models.Model):
title = models.CharField(maxlength=100)
authors = models.ManyToManyField(Author)

def __str__(self):
return self.title

view...

def authors(request):
a = Author.objects.all()
return render_to_response('books/authors.html', {'authors':a,})

template...


{% for author in authors %}
{{ author }}


{% for book in author.book_set %}
{{ book }}{% if forloop.last %}{% else %}, {% endif %}
{% endfor %}



{% endfor %}



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: XML serializer

2007-08-06 Thread Russell Keith-Magee

On 8/6/07, birkin <[EMAIL PROTECTED]> wrote:
>
> > The Django serializers accept any iterable, not just query sets. You
> > can pass in any list or set of Django object instances, and they 
> > willserializefine.
> >
> I thought the same thing from this line in the serialization
> documentation:
>
> (Actually, the second argument can be any iterator that yields Django
> objects, but it'll almost always be a QuerySet).
>
> But this isn't working for me; please tell me what I'm doing wrong
> below.
>
> >>> from django.core import serializers
> >>> serializers.serialize( "xml", ['abc','def','ghi'] )

Read carefully. "The second argument can be any iterator that yields
_Django objects_".

['abc','def','ghi'] is a list of strings. Hence, the error:

> SerializationError: Non-model object () encountered during
> serialization

If you want to serialize non-model objects, use the underlying
serialization frameworks (simplejson, etc).

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: full-text indexing

2007-08-06 Thread Russell Keith-Magee

On 8/7/07, cesco <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> is there any rough estimate on when the full-text indexing branch will
> be integrated into trunk?

The short answer is that there isn't really a rough estimate for
anything on Django - and especially not on branch merges. It will be
done when it is done.

In particular, the full-text indexing branch has been stale since the
end of the 2006 summer of code, so I wouldn't hold your breath for a
merge. Someone will need to do a lot of work on this branch before it
joins the trunk.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to split up views into different files...

2007-08-06 Thread [EMAIL PROTECTED]

I'd like to have a separate view files for each model just to make
everything a little neater. What's the best way to do this?


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



Re: How to split up views into different files...

2007-08-06 Thread oggie rob

There are no restrictions at all on this. Remember that the view is
called via urls.py, so you define your different views & files there.

Just a point of interest, though - models don't always match up with
views. In fact, most of my views contain at least two or three models.
Rather than break them up by model, I choose to break them into
separate files by function (e.g. calendar-like function, wizard-like
views, etc). This has let me keep my view files at a manageable size
and imports/references/conflicts to a minimum.

 -rob

On Aug 6, 8:40 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I'd like to have a separate view files for each model just to make
> everything a little neater. What's the best way to do this?


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



Re: How to split up views into different files...

2007-08-06 Thread Doug B

You can make a 'views' subfolder in your app folder, and make sure it
contains an __init__.py file (can be empty).

My personal opinion is that going overboard trying to make your python
file structure 'neater' will eventually bite you in the ass. It wasn't
too bad for views, but became import hell with models and utility
files.   I spent the better part of a day a few weeks ago getting rid
of most of my subfolders because they were nothing but a hassle.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



weird django orm behavior

2007-08-06 Thread james_027

Hi,

I have this models ...

class Employee(models.Model):
emplyoee_contract = models.ForeignKey('EmployeeContract',
null=True, related_name='contracted_employee')
employee_assignment = models.ForeignKey('EmployeeAssignment',
null=True, related_name='assigned_employee')


class EmployeeAssignment(models.Model):
employee = models.ForeignKey(Employee)
assignment_from = models.DateField()
assignment_to = models.DateField()
area = models.CharField(maxlength=3, choices=AREA_LIST)
position = models.CharField(maxlength=20)
edit_by = models.ForeignKey(Profile, null=True)

class EmployeeContract(models.Model):
employee = models.ForeignKey(Employee)
contract_to = models.DateField()
contract_from = models.DateField()
notes = models.CharField(blank=True, maxlength=200)
status = models.CharField(maxlength=3,
choices=EMPLOYEE_CONTRACT_STATUS_LIST)
edit_by = models.ForeignKey(Profile, null=True)

and I have something like this in my view

e = Employee()
for key in f.cleaned_data.keys():
e.__setattr__(key, f.cleaned_data[key])
e.save()
c =  EmployeeContract()
for key in f.cleaned_data.keys():
c.__setattr__(key, f.cleaned_data[key])
c.employee = e
c.status = 'ACT'
c.save()


a = EmployeeAssignment()
for key in f.cleaned_data.keys():
a.__setattr__(key,
f.cleaned_data[key])
a.employee = e
a.assignment_from = c.contract_from
a.assignment_to = c.contract_to
a.save()
e.employee_assignment = a
e.employee_contract = c
e.save()

all the data are valid, the problem here is that the
employee.employee_contract is not get assign. everything got save
successfully. here is the sql django's running

{'time': '0.015', 'sql': u'INSERT INTO `manning_employee`
(`lastname`,`firstname`,`middlename`,`gender`,`birthday`,`contact_no`,`address`,`notes`,`pay_by`,`hour_rate`,`allowance`,`account_no`,`sss`,`phil_health`,`pag_ibig`,`emplyoee_contract_id`,`employee_assignment_id`)
VALUES (Dy,Willie,,M,1977-02-18,,Laguna,,HRR,
34.37,50.00,None,None)'},
{'time': '0.000', 'sql': u'INSERT INTO `manning_employeecontract`
(`employee_id`,`contract_to`,`contract_from`,`notes`,`status`,`edit_by_id`)
VALUES (13,2007-10-21,2007-03-18,,ACT,None)'},
{'time': '0.000', 'sql': u'INSERT INTO `manning_employeeassignment`
(`employee_id`,`assignment_from`,`assignment_to`,`area`,`position`,`edit_by_id`)
VALUES (13,2007-03-18,2007-10-21,ADM,Supervisor,None)'},
{'time': '0.000', 'sql': u'SELECT COUNT(*) FROM `manning_employee`
WHERE `id`=13'}, {'time': '0.000', 'sql': u'UPDATE `manning_employee`
SET
`lastname`=Dy,`firstname`=Willie,`middlename`=,`gender`=M,`birthday`=1977-02-18,`contact_no`=,`address`=Laguna,`notes`=,`pay_by`=HRR,`hour_rate`=34.37,`allowance`=50.00,`account_no`=,`sss`=,`phil_health`=,`pag_ibig`=,`emplyoee_contract_id`=None,`employee_assignment_id`=10
WHERE `id`=13'}]

as you can see the last update statement has employee_contract_id =
None ... which I don't know what make it happen?

anything wrong with my models or views?

Thanks
james


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---