LatestCommentsFeed causing AssertionError due to slicing

2007-05-27 Thread Cybo

Hi,

New to both Python and Django. Not sure if my problem is user error or
a bug... but here we go.

I'm trying to use feeds.py in contrib/comments/ to produce an rss feed
of comments for a blog. However, I'm getting this:

Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
in get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/syndication/
views.py" in feed
  19. feedgen = f(slug, request.path).get_feed(param)
File "/usr/lib/python2.5/site-packages/django/contrib/syndication/
feeds.py" in get_feed
  94. for item in self.__get_dynamic_attr('items', obj):
File "/usr/lib/python2.5/site-packages/django/contrib/syndication/
feeds.py" in __get_dynamic_attr
  51. return attr()
File "/usr/lib/python2.5/site-packages/django/contrib/comments/
feeds.py" in items
  36. qs = qs.filter(is_removed=False)
File "/usr/lib/python2.5/site-packages/django/db/models/query.py" in
filter
  368. return self._filter_or_exclude(None, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/db/models/query.py" in
_filter_or_exclude
  381. "Cannot filter a query once a slice has been taken."

  AssertionError at /rss/comments/
  Cannot filter a query once a slice has been taken.

After talking to some people on the #django irc channel, it would
appear that the problem is due to LatestCommentsFeed calling
LatestFreeCommentsFeed, which slices the result. Just posting this
here to confirm whether or not this is a bug...

Thanks!

Stuart Williams


--~--~-~--~~~---~--~~
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: ManyToMany relation seems to break

2007-05-27 Thread Doug B

Thanks to Malcolm, this was resolved.  The problem was because I was
trying to use a model before all models had fully been loaded.
Unfortunately it was due to my own mistake rather than anything that
would help with ticket 1796, but I'm grateful he stuck around to help
figure it out anyway.  Hopefully I'll get a chance to payback the
django's wonderful community in the future.

In my case, I had a mixin class that imported manager.py.  That mixin
class was used in several others apps models.py files.  Since the
relations between model classes are setup after all models are loaded,
things got a bit crazy when my EventManager class started to access
the EventClass and EventType models all of the models were fully
loaded.

The solution he recommended (which worked perfectly), was to use a
python 'propery' to run the load_meta() method the first time it was
accessed.  Since that propery wasn't accessed until runtime it gave a
chance for all the relationships to be setup before using the models.



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



ManyToMany relation seems to break

2007-05-27 Thread Doug B

I've got a problem I can't figure out, and from the silence in IRC I'm
either doing something really stupid or it's as strange as I think it
is.  I'd appreciate any assistance.

For a nice highlighted version try: http://dpaste.com/11163/

"""
I'm sorry this is so long. The nutshell version
is that I have two models related by M2M field.
I can use the shell to create one object. It
all works perfectly.

I exit the shell, run my code which causes a
weird Type Error when trying to do

model.m2mrelatedset.all()

That same query  worked for me in a shell.
What's even more bizarre, is that if I go back
to the shell I can't do it there anymore. I
have to drop and let syncdb recreate the tables.

I have two files of interest, manager.py, and models.py both in the
same app folder
"""
#--- models.py ---
class EventType(models.Model):
name = models.CharField(maxlength=72)
desc = models.CharField(maxlength=255,null=True)
timeout = models.IntegerField(default=60)
active = models.BooleanField(default=True)

class EventClass(models.Model):
types = models.ManyToManyField(EventType)
name = models.CharField(maxlength=72)
desc = models.CharField(maxlength=255,null=True)

class EventManager(object):
def meta_load(self):
meta = {}
klasses = EventClass.objects.all()
for k in klasses:
meta[k.name] = {'obj': k}
for e in k.types.all():
meta[k.name][e.name] = {'obj': e}
self.event_meta =  meta
--- snip the rest of this, because the only code that runs is
meta_load() ---

#--- manager.py ---
import models
events = models.EventManager()
#events.meta_load() #this is commented so I can run syncdb in next
step

#Deleted all related tables, and reinitialized with syncdb

In [1]: from event.models import EventClass,EventType
In [2]: kls = EventClass.objects.all()
In [3]: ec = EventClass(name='system',desc='Events defined in the
event module')
In [4]: ec.save()
In [5]: ec.types.all()
Out[5]: []

#Exited, and restarted shell

In [1]: from event.models import
EventClass,EventType
In [2]: ec =
EventClass.objects.get(pk=1)
In [3]: ec.id
Out[3]: 1
In [4]: ec.types.all()
Out[4]: []

#Exited, uncommented the line in manager.py that calls meta_load()

./manage.py validate
project.common: Cannot resolve keyword 'eventclass' into field
-- snipped other files that import manager.py ---

Now I go back to the shell:
In [1]: from event.models import EventClass,EventType
In [2]: ec = EventClass.objects.get(pk=1)
In [3]: ec.name
Out[3]: 'system'
In [4]: ec.id
Out[4]: 1
In [5]: ec.types.all()

#--- snip most of large traceback ---


/usr/lib/python2.4/site-packages/django/db/models/query.py in
lookup_inner(path, lookup_type, value, opts, table, column)
936 pass
937 else: # No match found.
--> 938 raise TypeError, "Cannot resolve keyword '%s' into
field" % name
939
940 # Check whether an intermediate join is required between
current_table

TypeError: Cannot resolve keyword 'eventclass' into field


--~--~-~--~~~---~--~~
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: Alternative approach to UserProfile

2007-05-27 Thread ZZorba

I'm also aware of trickiness of eval() methods,
so,, I could solve the problem in this way

"
profile_fields = "email email_backup brother sister".split()
for key in profile_fields:
getattr(request.user.get_profile(), key)
"

And, it works well.

Really approciate you both. :)

On 5월28일, 오전8시56분, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 5/27/07, EL AATIFI Sidi Mohamed <[EMAIL PROTECTED]> wrote:
>
>
>
> > > - The eval() technique suggested in another reply may work, but isn't
> > > really a good practice. eval() exists to make interactive prompts
> > > possible, not as a general programming technique. There is no
> > > protection on what eval() will do, so if an attacker can modify the
> > > string that is being eval()'d, they have complete access to your
> > > system. This is obviously very bad practice on a public-facing
> > > interface, like a web site.
>
> > I agree completely.
> > It should just be noted that in this case, there is no way to change the
> > expression passed to eval. Secondly getattr cannot in no case evaluate
> > an expression, or to reach a more deep fields.
>
> This may be the case, but using eval() for general programming is an
> extraordinarily habit to get into, there is almost always an
> alternative approach, and it _definitely_ doesn't need to be used in
> this case.
>
> 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: change db connection upon login

2007-05-27 Thread James Bennett

On 5/27/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> No, Django is not designed like that. All connections to the database
> are done as the user you specify in the settings file. You would need to
> reimplement connection and cursor management inside the
> django/db/backends/* if you wanted to do this.

See this thread on django-developers for more discussion:

http://groups.google.com/group/django-developers/browse_frm/thread/99821103689f8787/b8b75a50b0d2faa6

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



Re: Alternative approach to UserProfile

2007-05-27 Thread Russell Keith-Magee

On 5/27/07, EL AATIFI Sidi Mohamed <[EMAIL PROTECTED]> wrote:
>
>
> > - The eval() technique suggested in another reply may work, but isn't
> > really a good practice. eval() exists to make interactive prompts
> > possible, not as a general programming technique. There is no
> > protection on what eval() will do, so if an attacker can modify the
> > string that is being eval()'d, they have complete access to your
> > system. This is obviously very bad practice on a public-facing
> > interface, like a web site.
> >
> I agree completely.
> It should just be noted that in this case, there is no way to change the
> expression passed to eval. Secondly getattr cannot in no case evaluate
> an expression, or to reach a more deep fields.

This may be the case, but using eval() for general programming is an
extraordinarily habit to get into, there is almost always an
alternative approach, and it _definitely_ doesn't need to be used in
this case.

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: Unicode-branch: testers wanted

2007-05-27 Thread Malcolm Tredinnick

On Sun, 2007-05-27 at 13:34 -0700, itsnotvalid wrote:
> I got an error when I am using admin interface to submit some forms as
> following the Django book (CH6).
> 
> When the form in admin interface saving.
> Traceback (most recent call last):
> File "F:\python25\Lib\site-packages\django-svn\unicode\django\core
> \handlers\base.py" in get_response
>   77. response = callback(request, *callback_args, **callback_kwargs)
> File "F:\python25\Lib\site-packages\django-svn\unicode\django\contrib
> \admin\views\decorators.py" in _checklogin
>   55. return view_func(request, *args, **kwargs)
> File "F:\python25\Lib\site-packages\django-svn\unicode\django\views
> \decorators\cache.py" in _wrapped_view_func
>   39. response = view_func(request, *args, **kwargs)
> File "F:\python25\Lib\site-packages\django-svn\unicode\django\contrib
> \admin\views\main.py" in add_stage
>   258. LogEntry.objects.log_action(request.user.id,
> ContentType.objects.get_for_model(model).id, pk_value,
> force_unicode(new_object), ADDITION)
> File "F:\python25\Lib\site-packages\django-svn\unicode\django\utils
> \encoding.py" in force_unicode
>   32. s = unicode(s)
> 
>   UnicodeDecodeError at /admin/books/author/add/
>   'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in
> range(128)

This suggests that self.first_name hasn't been converted to a unicode
string for some reason and is still a sequence of UTF-8 bytes. That
shouldn't be happening.

> 
> Not sure if that is only my n00b skillz kicking on, it should be a
> direct result of the return string as here:
> 
> from django.db import models
> # ...
> class Author(models.Model):
> salutation = models.CharField(maxlength=10)
> first_name = models.CharField(maxlength=30)
> last_name = models.CharField(maxlength=40)
> email = models.EmailField()
> headshot = models.ImageField(upload_to= ('/tmp'))
> class Admin:
> pass
> 
> def __unicode__(self):
> return self.first_name # this string is what I am talking
> about
> 
> I am using postgresSQL in utf-8 so I thought some non-ascii input
> would pass through nicely in the admin interface. But it didn't.
> The item would still be saved into the database and viewable in the
> admin interface.

This is certainly a bit odd and it should be working. I've hammered on
the admin interface quite a bit, saving and loading all kinds of weird
data and so have some other testers. Your model looks like it should be
perfect, too.

I'll have a look at this today when I can make some time.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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: Cross validation of form fields (svn)

2007-05-27 Thread Malcolm Tredinnick

On Sun, 2007-05-27 at 23:21 +, [EMAIL PROTECTED] wrote:
> Hi all,
> 
> i'm running django svn and trying to validate two fields against each
> other. Problem is: if i pass both values it should pass validation,
> instead it displays both errors. If, instead, i pass one value and not
> another, it works as expected.

You are trying to do multi-field validation in the wrong place. The
clean_ functions are run one at a time as the fields are
processed in the order they are defined. At that point,
self.cleaned_data will only contain the fields that have been processed
so far.

Validation involving multiple fields is the responsibility of the form,
not any individual field. So do this type of checking in the clean()
method of your Form sub-class.

Have a look at this thread:
http://groups.google.com/group/django-users/browse_thread/thread/2ab9463bae7d8320/37fe68ea76416872?lnk=gst==48#37fe68ea76416872
for a detailed explanation.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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: change db connection upon login

2007-05-27 Thread Malcolm Tredinnick

On Sun, 2007-05-27 at 13:50 -0700, olivier wrote:
> Hi group,
> 
> I'm wondering if there a way to change the database connection upon
> login, to have the following pattern :
> 
> 1) Anonymous user is connected to my db server as 'default'. The
> database or schema for 'default' holds the tables for authentication.
> 
> 2) After authentication, username1's session is tied to a connection
> as 'username1', 'username2' is tied to a connection as 'username2',
> etc.., each user having his own database/schema.
> 
> It's probably not straightforward at all, since it raises a lot of
> issues, but I would be grateful for any hint.

No, Django is not designed like that. All connections to the database
are done as the user you specify in the settings file. You would need to
reimplement connection and cursor management inside the
django/db/backends/* if you wanted to do this.

Regards,
Malcolm



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



Cross validation of form fields (svn)

2007-05-27 Thread [EMAIL PROTECTED]

Hi all,

i'm running django svn and trying to validate two fields against each
other. Problem is: if i pass both values it should pass validation,
instead it displays both errors. If, instead, i pass one value and not
another, it works as expected.

Both fields are declared as required=False

Is this a bug?

Code is up here: http://dpaste.com/11154/

Thanks,
Lorenzo


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



change db connection upon login

2007-05-27 Thread olivier

Hi group,

I'm wondering if there a way to change the database connection upon
login, to have the following pattern :

1) Anonymous user is connected to my db server as 'default'. The
database or schema for 'default' holds the tables for authentication.

2) After authentication, username1's session is tied to a connection
as 'username1', 'username2' is tied to a connection as 'username2',
etc.., each user having his own database/schema.

It's probably not straightforward at all, since it raises a lot of
issues, but I would be grateful for any hint.

Cheers,

  Olivier


--~--~-~--~~~---~--~~
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: newforms and recaptcha => MultiWidget/MultiField?

2007-05-27 Thread Bram - Smartelectronix

SmileyChris wrote:
> 
> I did this yesterday:
> http://smileychris.tactful.co.nz/ramblings/recaptcha/

HOT Damn!!

Will try ASAP and report back.

  - bram


--~--~-~--~~~---~--~~
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: InvalidTemplateLibrary at /

2007-05-27 Thread Pashka R.

hohoho!!!

I won this stuff (Gsser helps a lot :) Its strange but
mod_python( or python or django or...) doesn't like symbolic links...
I had two links (to django version I want and to my libraries for
django (same for all my django projects) So errors gone when I
removed symlinks and added paths to my stuff into sys.path :)

//wbr Pashka R.


--~--~-~--~~~---~--~~
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: Alternative approach to UserProfile

2007-05-27 Thread Vinay Sajip


On May 27, 4:45 pm, EL AATIFI Sidi Mohamed <[EMAIL PROTECTED]> wrote:

Another possibility is mentioned here:

http://groups.google.com/group/django-users/browse_thread/thread/324eb0c2283bd5/7ad65aeac8bb72ac?lnk=gst=__getattribute__=1#7ad65aeac8bb72ac

Whereby you can avoid user.get_profile().attr and use user.attr
instead.

Regards,

Vinay Sajip


--~--~-~--~~~---~--~~
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: Multiple Profiles

2007-05-27 Thread Vinay Sajip



On May 14, 10:15 am, Bram - Smartelectronix <[EMAIL PROTECTED]>
wrote:
> In my opinion there's only one easy solution which doesn't create
> ridiculous overhead and that is to be able to add fields to the User
> model without having to hack the actual code of the User model. Does
> anyone agree with this?

That'll probably be possible if and when we have a more generalized
framework for object inheritance - then you could inherit from the
User and add fields in the subclass.

Regards,

Vinay


--~--~-~--~~~---~--~~
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: InvalidTemplateLibrary at /

2007-05-27 Thread Pashka R.

New details were found

if I opened non-root url (http://kids.dn.ua/info/project.html) and
after that root (http://kids.dn.ua/) -- all seems ok but it only
for an about one minute... and after that I get InvalidTemplateLibrary
error :((( I really don't understand how could it be?

may it be because I use not installed django?

p.s. and sorry for my english :)

//wbr Pashka R.


--~--~-~--~~~---~--~~
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: Alternative approach to UserProfile

2007-05-27 Thread EL AATIFI Sidi Mohamed


> - The eval() technique suggested in another reply may work, but isn't
> really a good practice. eval() exists to make interactive prompts
> possible, not as a general programming technique. There is no
> protection on what eval() will do, so if an attacker can modify the
> string that is being eval()'d, they have complete access to your
> system. This is obviously very bad practice on a public-facing
> interface, like a web site.
>   
I agree completely.
It should just be noted that in this case, there is no way to change the 
expression passed to eval. Secondly getattr cannot in no case evaluate 
an expression, or to reach a more deep 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-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
-~--~~~~--~~--~--~---



Hello Dear Friend!

2007-05-27 Thread nobi

Hi dear friends,
We are presenting to all of our friends like you the most
comprehensive & attractive

wllpapers, Avators, Smiles, Inshort EVERSHINE or SADABAHAR collections
for you... Try once

and Be Use to it for your graphic needs. You will always get So Much
New on each visit...
Keep Living a Happy life...

Visit the followng links

http://www.dzinekit.com
httP://www.hakabaka.com
Http://www.sadabahar.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: GeoDjango Admin interface - Invalid HEX given!

2007-05-27 Thread mikeyparker



On 25 May, 02:37, Justin Bronn <[EMAIL PROTECTED]> wrote:
> > I'm just moving an application that we were writing over to the GeoDjango 
> > branch
>
> Welcome!

Thanks

>
> >  However I am unable to add a new one using the admin ...
> >  when attempting to create a new instance.
>
> You found a bug in WKTField -- good catch.
>
> > Any help would be much appreciated. Thanks
>
> It has been fixed in r5336.

That's great. Thanks Justin.

>
> Regards,
> -Justin


--~--~-~--~~~---~--~~
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: Best-practices for form with image

2007-05-27 Thread Baurzhan Ismagulov

On Tue, May 22, 2007 at 06:56:31AM -0700, [EMAIL PROTECTED] wrote:
> And there are no best practices for using something as inherently
> inaccessible and annoying as a captcha.

So, what are the best practices to check whether the request has been
submitted by a human? FWIW, I've seen captchas with an audio option.

With kind regards,
-- 
Baurzhan Ismagulov
http://www.kz-easy.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: Feisty-updates now contains Python-2.5.1final

2007-05-27 Thread Sam Morris

On Sun, 27 May 2007 03:40:39 -0700, Vinay Sajip wrote:
> Thanks for the update, Mike, but I can't seem to get this latest version
> - the Python I can get is dated May 2:
> 
> [EMAIL PROTECTED]:~$ sudo apt-get update [snip]
> Get: 5 http://archive.ubuntu.com feisty-updates/main Packages [20.1kB]
> Get: 6 http://archive.ubuntu.com feisty-updates/restricted Packages
> [14B]
> Get: 7 http://archive.ubuntu.com feisty-updates/main Sources [4974B]
> Get: 8 http://archive.ubuntu.com feisty-updates/restricted Sources [14B]
> Fetched 57.8kB in 1s (40.4kB/s)
> Reading package lists... Done
> [EMAIL PROTECTED]:~$ sudo apt-get install python2.5 Reading package
> lists... Done
> Building dependency tree
> Reading state information... Done
> python2.5 is already the newest version. 0 upgraded, 0 newly installed,
> 0 to remove and 0 not upgraded. [EMAIL PROTECTED]:~$ python
> Python 2.5.1 (r251:54863, May  2 2007, 16:56:35) [GCC 4.1.2 (Ubuntu
> 4.1.2-0ubuntu4)] on linux2 Type "help", "copyright", "credits" or
> "license" for more information.


> It's labelled Python 2.5.1, but are we talking about the same version?

You can check by examining the version of the 'python' package that you 
have installed:

 $ dpkg --status python
 Package: python
 Status: install ok installed
 ...
 Version: 2.5.1-0ubuntu3
 ...

and you can see which versions of 'python' are available with:

 $ apt-cache policy python
 python:
   Installed: 2.5.1-0ubuntu3
   Candidate: 2.5.1-0ubuntu3
   Version table:
  *** 2.5.1-0ubuntu3 0
 500 http://gb.archive.ubuntu.com feisty-updates/main Packages
 100 /var/lib/dpkg/status
  2.5.1~rc1-0ubuntu3 0
 500 http://gb.archive.ubuntu.com feisty/main Packages

Here you can see I have 2.5.1 final installed.

-- 
Sam Morris
http://robots.org.uk/

PGP key id 1024D/5EA01078
3412 EA18 1277 354B 991B  C869 B219 7FDB 5EA0 1078


--~--~-~--~~~---~--~~
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: Cross-refering models across files

2007-05-27 Thread sansmojo

I figured out a weird way to do this a while back but decided it was a
bad idea.  It works, though:

models_a.py:
from django.db import models

class A(models.Model):
text = models.TextField()
number = models.IntegerField()

class Admin:
pass

models_b.py:
from django.db import models

class B(models.Model):
phone = models.PhoneNumberField()

class Admin:
pass

models.py:
from django.db import models

from models_a import A
from models_b import B

class ref_a_to_b(models.Model):
a = models.ForeignKey(A, edit_inline=True)
ref_to_b = models.ForeignKey(B, core=True)

class ref_b_to_a(models.Model):
b = models.ForeignKey(B, edit_inline=True)
ref_to_a = models.ForeignKey(A, core=True)

You could also not have these as edit_inline and have a separate form
in the admin for dealing with the relations.

On May 26, 3:20 pm, Tomas Kopecek <[EMAIL PROTECTED]> wrote:
> Tomas Kopecek napsal(a):
>
> > Tim Chase napsal(a):
> > I> does anybody knows, how to implement cross-refering models across files?
> >>   # in example_app/models_a.py
> >>   class A(models.Model):
> >> # no ref_to_b here
> >> ...
>
> >>   # in example_app/models_b.py
> >>   import a
> >>   class B(models.Model):
> >> ref_to_a = models.OneToOneField(a.A,
> >>   related_name='ref_to_b')
>
> >>   # in example_app/models.py
> >>   from models_a import *
> >>   from models_b import *
>
> > Is this correct method for future django releases? Documentation says on
> > one-to-one: "The semantics of one-to-one relationships will be changing
> > soon, so we don't recommend you use them." Maybe this is more question
> > for django-devel...
>
> Moreover, it is not sufficient (general enough) solution. if ref_to_b
> and ref_to_a are two independent many-to-one relations, I can't use
> one-to-one semantics.
>
> --
>
> Tomas Kopecek
> e-mail: permonik at mesias.brnonet.cz
>  ICQ: 114483784


--~--~-~--~~~---~--~~
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: Feisty-updates now contains Python-2.5.1final

2007-05-27 Thread Vinay Sajip


On May 27, 4:07 am, Mike Axiak <[EMAIL PROTECTED]> wrote:
> Yes, I'm sorry...let me be more clear:
>
> Feisty Fawn currently ships with Python 2.5.1c1.
> Python tried to change its API for dictionaries (which even broke
> pickle [1]) -- a change with which Django is not compatible [2].
> They decided to pull out this change for 2.5.1-final, and as of
> yesterday (5/25) Feisty-updates has 2.5.1-final.

Thanks for the update, Mike, but I can't seem to get this latest
version - the Python I can get is dated May 2:

[EMAIL PROTECTED]:~$ sudo apt-get update
[snip]
Get: 5 http://archive.ubuntu.com feisty-updates/main Packages [20.1kB]
Get: 6 http://archive.ubuntu.com feisty-updates/restricted Packages
[14B]
Get: 7 http://archive.ubuntu.com feisty-updates/main Sources [4974B]
Get: 8 http://archive.ubuntu.com feisty-updates/restricted Sources
[14B]
Fetched 57.8kB in 1s (40.4kB/s)
Reading package lists... Done
[EMAIL PROTECTED]:~$ sudo apt-get install python2.5
Reading package lists... Done
Building dependency tree
Reading state information... Done
python2.5 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
[EMAIL PROTECTED]:~$ python
Python 2.5.1 (r251:54863, May  2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

It's labelled Python 2.5.1, but are we talking about the same version?

Regards,

Vinay Sajip


--~--~-~--~~~---~--~~
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: Alternative approach to UserProfile

2007-05-27 Thread ZZorba

Wow. Thanks a lot-
It works pretty well exactly the way I wanted. :)

On 5월27일, 오후6시15분, EL AATIFI Sidi Mohamed <[EMAIL PROTECTED]> wrote:
> > "
> > profile_fields = "email email_backup brother sister".split()
> > for key in profile_fields:
> > request.user.get_profile().__getattr__(key)
> > "
>
> you can try this:
> "
>
> profile_fields = "email email_backup brother sister".split()
> for key in profile_fields:
> eval('request.user.get_profile().%s' % key)
>
> "


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

2007-05-27 Thread samira

Hello All. I want to use RSS and study Django document about it, but I
can't understand. can you help me and describe it for me?


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



InvalidTemplateLibrary at /

2007-05-27 Thread Pashka R.

Intro I have django project (using django 0.96) All was fine
when I develop it on my working computer... Right now I'm trying to
move it to ny hosting So what i have Django 0.95 installed on
the system, mod_python

I've copied my project and setup .htaccess file:

SetHandler python-program
PythonPath "['/path/to/my/project/projectname', '/path/to/my/project/
projectname/..'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings
PythonDebug On

next thing i've made is put a copy of django 0.96 to my project's
directory, so i have smth like /path/to/my/project/projectname/django

and now I get an error 'InvalidTemplateLibrary at /
Template library django.template.loader_tags does not have a variable
named 'register''... and only in '/' in '/someapp/params/' -- all
OK... you can see this in http://kids.dn.ua/ and 
http://kids.dn.ua/info/project.html

Have someone any idea how to fix this?

//wbr Pashka R.


--~--~-~--~~~---~--~~
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: Alternative approach to UserProfile

2007-05-27 Thread EL AATIFI Sidi Mohamed


> "
> profile_fields = "email email_backup brother sister".split()
> for key in profile_fields:
> request.user.get_profile().__getattr__(key)
> "
you can try this:
"

profile_fields = "email email_backup brother sister".split()
for key in profile_fields:
eval('request.user.get_profile().%s' % key)

"

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