EARN$1000-$25000 per week

2008-06-04 Thread bill gates

EARN$1000-$25000 per week
 SIMPLE ONLINE SURVEY
 WORK AT JUST 2 HOURS ONLY
 I EARN DAILY AROUND $350
 CREATE FREE ACCOUNT START YOUR EARNINGS
***
 http://www.AWSurveys.com/HomeMain.cfm?RefID=souravudaya

 http://www.AWSurveys.com/HomeMain.cfm?RefID=souravudaya

 http://www.AWSurveys.com/HomeMain.cfm?RefID=souravudaya
*** **
--~--~-~--~~~---~--~~
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: create model instance

2008-06-04 Thread djangoer

thanks very much Chris.

I googled and also find some related articles.

http://www.djangoproject.com/documentation/0.96/models/fixtures/
http://code.djangoproject.com/wiki/Fixtures

However, when I tried to reset and syncdb, I always had error
messages.

1.$ python manage.py reset myapp
Type 'yes' to continue, or 'no' to cancel: yes
Error: myapp couldn't be reset. Possible reasons:
  * The database isn't running or isn't configured correctly.
  * At least one of the database tables doesn't exist.
  * The SQL was invalid.
Hint: Look at the output of 'django-admin.py sqlreset myapp'. That's
the SQL this command wasn't able to run.
The full error: ERROR:  constraint
"reference_id_id_refs_id_4d6e9d1fab032af2" does not exist

2.$ python manage.py syncdb
Loading 'initial_data' fixtures...
Installing json fixture 'initial_data' from '/home/myproject/myapp/../
myapp/fixtures'.
Problem installing fixture '/home/myproject/myapp/../myapp/fixtures/
initial_data.json': ['This value must be either True or False.']

Please advise. Thanks much!



"Chris Czub" <[EMAIL PROTECTED]> wrote:
> http://www.djangoproject.com/documentation/models/fixtures/
>
> What you are looking for is an initial_data fixture. You need to serialize
> the default instance of the model you want as JSON and save it in
> initial_data.json and then it should prepopulate when you run syncdb.
>
> On Wed, Jun 4, 2008 at 2:31 PM, djangoer <[EMAIL PROTECTED]> wrote:
>
> > A quick newbie question,
>
> > is there any way that can create a default instance (a pre-specified
> > instance) in the database once the model is created. In other words,
> > when we first run the syncdb(or set up the website), an pre-defined
> > instance is created.
>
> > For example, we have a Book model,
>
> > class Book(models.Model):
> >author = models.CharField(maxlength = 50)
> >title = models.CharField(maxlength = 50)
>
> > When the website is first setup, we would like to have one default
> > "Book" instance in the DB, say Book("John.Smith","COMPUT101").
>
> > Your help is greatly appreciated.
--~--~-~--~~~---~--~~
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: Better Query Set Use

2008-06-04 Thread [EMAIL PROTECTED]

You can use Q objects to preform OR queries.  So it would look like
this:

from django.db.models import Q
games = Game.objects.filter(Q(home_team=searchTeam) |
Q(away_team=searchTeam)).filter(game_date__range(date_form.cleaned_data['startDate'],
date_form.cleaned_data['endData'])).order_by('games_date',
'start_time')

On Jun 4, 10:55 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> Hi there. Long-time PHP developer now getting into Python and Django.
>
> I'm using the latest version of Django from SVN and are building a query
> that does the following:
>
> Give me all the games where
> homeTeam = searchTeam OR awayTeam = searchTeam
> AND game_date is between start_date and end_date
> ORDER BY game_date, start_date.
>
> Here's the code for it
>
> games = Game.objects.filter(home_team=searchTeam,
> game_date__range=(date_form.cleaned_data['startDate'],
> date_form.cleaned_data['endDate'])).order_by('game_date', 'start_time') |
> Game.objects.filter(away_team=searchTeam,
> game_date__range=(date_form.cleaned_data['startDate'],
> date_form.cleaned_data['endDate'])).order_by('game_date', 'start_time')
>
> Now, it gets me the desired results but it just looks ugly.  I'm wondering
> if there is a better way to do this?  I spent some time googling around for
> answers but didn't find anything that could help me.
>
> Thanks in advance.
>
> --
> Chris Hartjes
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Better Query Set Use

2008-06-04 Thread Chris Hartjes
Hi there. Long-time PHP developer now getting into Python and Django.

I'm using the latest version of Django from SVN and are building a query
that does the following:

Give me all the games where
homeTeam = searchTeam OR awayTeam = searchTeam
AND game_date is between start_date and end_date
ORDER BY game_date, start_date.

Here's the code for it

games = Game.objects.filter(home_team=searchTeam,
game_date__range=(date_form.cleaned_data['startDate'],
date_form.cleaned_data['endDate'])).order_by('game_date', 'start_time') |
Game.objects.filter(away_team=searchTeam,
game_date__range=(date_form.cleaned_data['startDate'],
date_form.cleaned_data['endDate'])).order_by('game_date', 'start_time')

Now, it gets me the desired results but it just looks ugly.  I'm wondering
if there is a better way to do this?  I spent some time googling around for
answers but didn't find anything that could help me.

Thanks in advance.

-- 
Chris Hartjes

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



Free Mp3 Our Wav Tones , 3gp Mobile Videos Songs ( Newly Added )

2008-06-04 Thread ramya

Free Mp3 Our Wav Tones , 3gp Mobile Videos Songs ( Newly Added )
Free The Corss Video
Free music,movie,divx
Free Music Video
Free Your entertainment store is here! Watch the fresh & latest
videos
***
http://www.freewebs.com/mp3-information/
***

--~--~-~--~~~---~--~~
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: getting a problem while using templates

2008-06-04 Thread Peter Herndon

You need to set an environment variable DJANGO_SETTINGS_MODULE that
points to your settings.py.  Look up the documentation on settings for
more detail.  This isn't necessary when running the development
server, IIRC, but becomes necessary when running under
Apache/mod_python.



On 6/4/08, Sandy <[EMAIL PROTECTED]> wrote:
>
> hi
> iam new to django. i just installed the Django. can any one
> help me in setting the environment variables .
> actually i put a path like: C:\Python25\Lib\site-packages\django\ and
> site-packages\bin\django-admin.py
> but for both types iam unable to import templates.
>
> whenever i try this line
>
> from django.template.loader import get_template
>
> the following errors are coming:-
>
> Traceback (most recent call last):
>   File "", line 1, in 
> from django.template.loader import get_template
>   File "C:\Python25\Lib\site-packages\django\template\__init__.py",
> line 918, in 
> add_to_builtins('django.template.defaultfilters')
>   File "C:\Python25\Lib\site-packages\django\template\__init__.py",
> line 915, in add_to_builtins
> builtins.append(get_library(module_name))
>   File "C:\Python25\Lib\site-packages\django\template\__init__.py",
> line 904, in get_library
> mod = __import__(module_name, {}, {}, [''])
>   File "C:\Python25\Lib\site-packages\django\template
> \defaultfilters.py", line 5, in 
> from django.utils.translation import gettext
>   File "C:\Python25\Lib\site-packages\django\utils\translation
> \__init__.py", line 3, in 
> if settings.USE_I18N:
>   File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line
> 28, in __getattr__
> self._import_settings()
>   File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line
> 53, in _import_settings
> raise EnvironmentError, "Environment variable %s is undefined." %
> ENVIRONMENT_VARIABLE
> EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is
> undefined.
>
> thankyou in advance
>
> >
>

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



ASP.Net GridView Equivalent in Django

2008-06-04 Thread Ian

I am .Net developer looking to switch over to Python.

I have started looking at Django and was wondering if there is a
widget equivalent to ASP.Net's GridView in terms of richness of
functionality.

If someone knows of any and has some examples of its use I would
greatly appreciate it.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Odd behavior in admin interface with 404 AFTER record is updated!

2008-06-04 Thread puff

I'm having some difficulty with the admin interface that has me
stumped and could use a clue or two.

I've a table that looks like this:

class Destination(models.Model):
name = models.CharField( 'Name', max_length = LENGTH_NAMES_LONG,
primary_key = True,
help_text = 'Destination name in form /path')
   ...

The values of name are of the form
   aaa/bbb/ccc

When I use the admin interface to edit one of these the admin screen
displays OK and when I save my save method  executes (there is a print
in it) and the record is saved (I can examine it in MySQL and it's
there).  All seems well except that I get the following error screen
message:

Page not found (404)
Request Method: GET
Request URL:http://localhost:8000/admin/xx/destination/Standby_1/RAID/

destination object with primary key u'Standby_1/RAID' does not exist

You're seeing this error because you have DEBUG = True in your Django
settings file. Change that to False, and Django will display a
standard 404 page.

The name value was 'Standby_1/RAID/RAID_1'.  Can anyone provide any
clues about what is happening?


--~--~-~--~~~---~--~~
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 Admin Model View Page

2008-06-04 Thread Erik Stein


Ali --

I'm doing a lot of adaptions in newforms-admin, take a look at the  
ModelAdmin class and it's __call__ method.

-- erik

Am 04.06.2008 um 23:54 schrieb Ali Sogukpinar:

> I am working on a small CRM solution for our internal use. Admin
> application is providing almost all the functionality I need but I
> think it is a pity that you can not specify a template for reading a
> model and user rights for this action  out of the box.

--~--~-~--~~~---~--~~
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 self generated primary key.

2008-06-04 Thread Cliff

Hi jonknee
Thanks a lot for your reply. I'll give it a try now.
By the way, I'm happy with incrementing IDs, however, it will cause
conflicts when I need to import data from another database.
Thanks
Cliff

On Jun 4, 10:50 pm, jonknee <[EMAIL PROTECTED]> wrote:
> On Jun 4, 5:42 pm, "Cliff Liang Xuan" <[EMAIL PROTECTED]> wrote:
>
> > Basically I want to use a random 7 digit string as the primary key of table
> > Foo, because this id is system generated I don't want to show it in the
> > admin interface. How to achieve this, please?
>
> You should only have trusted users in the admin anyway, so I don't see
> what the problem is with incrementing IDs, but auto generation is
> easy. You just need to create your own save() method that sets the ID
> and then calls the existing save() method of the model class. For
> example:
>
> def save(self):
>     self.id = self.getRandom();
>     super(Foo, self).save()
>
> That should do the trick. Though depending on your use, you'll want to
> first check if self.id exists so it won't give a new one on each
> save(). I do the same thing for one of my models to use a UUID.
--~--~-~--~~~---~--~~
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 Admin Model View Page

2008-06-04 Thread Ali Sogukpinar

Hi Yml,

I am working on a small CRM solution for our internal use. Admin
application is providing almost all the functionality I need but I
think it is a pity that you can not specify a template for reading a
model and user rights for this action  out of the box.
It would be nice to have an action for presenting the details of a
model in the admin application.

I will check it out the databrowse application.

Thank you.

Ali


On Jun 4, 1:44 pm, yml <[EMAIL PROTECTED]> wrote:
> Hello,
> I would recommend you to look at : 
> databrowsehttp://www.djangoproject.com/documentation/databrowse/
> Here it is a short description extracted from the django
> documentation:
> """
> Databrowse is a Django application that lets you browse your data.
>
> As the Django admin dynamically creates an admin interface by
> introspecting your models, Databrowse dynamically creates a rich,
> browsable Web site by introspecting your models.
> """
> I hope that will help you.
> --yml
>
> On 4 juin, 11:52, Ali Sogukpinar <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I have an website and I would like to use Django admin app for
> > modifing my model objects.
>
> > Django admin app is out of the box providing C(R)UD actions for me.
> > But R (Read) action is implemented as list. You can see the list of
> > your objects and If you click on one the item in the list you will be
> > automaticall directed to change_form (Update action)
>
> > I would like to have an intermediate step where you see the details of
> > the object with its relations etc. and from this page you can goto
> > change_form if you really want to edit it.
>
> > Couldn't make it? Did any of you implemented such a functionality?
>
> > Thanks in Advance.
>
> > Ali
--~--~-~--~~~---~--~~
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 self generated primary key.

2008-06-04 Thread jonknee

On Jun 4, 5:42 pm, "Cliff Liang Xuan" <[EMAIL PROTECTED]> wrote:
> Basically I want to use a random 7 digit string as the primary key of table
> Foo, because this id is system generated I don't want to show it in the
> admin interface. How to achieve this, please?

You should only have trusted users in the admin anyway, so I don't see
what the problem is with incrementing IDs, but auto generation is
easy. You just need to create your own save() method that sets the ID
and then calls the existing save() method of the model class. For
example:

def save(self):
self.id = self.getRandom();
super(Foo, self).save()

That should do the trick. Though depending on your use, you'll want to
first check if self.id exists so it won't give a new one on each
save(). I do the same thing for one of my models to use a UUID.
--~--~-~--~~~---~--~~
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: custom css in password change form built using oldforms

2008-06-04 Thread Juanjo Conti

For the admin app?

On Wed, Jun 4, 2008 at 4:08 PM, Mayank Dhingra <[EMAIL PROTECTED]> wrote:
>
> Hi Guys,
>
> I needed a work around to add custom css in the default(oldforms)
> password change form
> that I am using . How to go about it ?
>
> Thanks
> >
>



-- 
Juanjo Conti

--~--~-~--~~~---~--~~
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 self generated primary key.

2008-06-04 Thread Cliff Liang Xuan
Hi,I've started using Django recently and really enjoyed it until I ran into
a problem that I cannot find a solution on the net. Really hope someone can
cast some light on me.
Basically I want to use a random 7 digit string as the primary key of table
Foo, because this id is system generated I don't want to show it in the
admin interface. How to achieve this, please?
This is my example code:
class Foo(models.Model):
id = models.CharField(primary_key = True, db_column='id', max_length=7)
name = models.CharField("Name", max_length=30)
def __unicode__(self):
return self.name
class Admin:
fields = (
(None, {'fields':('name',)}),)
Let's say the random string generation function is getRandom().
Many thanks
Cliff

--~--~-~--~~~---~--~~
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: Imports in other modules impact doctests

2008-06-04 Thread dchandek

An interesting variation I have encountered. I have custom managers
for my model classes in models.py. If I add doctests to the custom
manager methods, they run. But if I then add doctests to any model
methods, none of the doctests in models.py run -- neither the doctests
for the custom manager methods nor those for the model method
doctests.

--David

On May 12, 6:07 pm, davenaff <[EMAIL PROTECTED]> wrote:
> Over the weekend I ran into problems gettingdocteststo run.  I found
> that imports in other modules were causing the model classes to not be
> recognized by _doctest:
>
> http://groups.google.com/group/django-users/browse_thread/thread/10f8...
>
> I ran out of time before I was able to determine the ultimate cause of
> the problem, but put this hack in place:
> I changed line 895 of _doctest from:
>  return module.__name == object.__module__
> to:
>  return module.__name__.find(object.__module__) >=0
>
> Again, this is a hack, but I wanted to put it into public record in
> case others run into the same problem and need a quick fix (or if
> someone can suggest the proper solution).
>
> Dave
--~--~-~--~~~---~--~~
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: Capturing full URL string

2008-06-04 Thread John M

Well, thank God you took a look at the code and agreed on my
findings.  I'll just adjust my urls.py for now.

Should I submit a bug report?  (it'd be my first :) )

Thanks again for your time on this, I'm glad it was a bug and not my
mis-standing of django or the way this all works together.  Now I can
move on a continue my app.

John

On Jun 4, 12:59 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Wed, Jun 4, 2008 at 2:03 PM, John M <[EMAIL PROTECTED]> wrote:
> > Yes, I understand that, and I think it's a good thing, but when it
> > redirects, it mangles the parameters, would you agree?
>
> Yes, I think that's a bug in Django.  The code that is doing the
> APPEND_SLASH handling tries to use request.GET.urlencode() to restore the
> original query parameters to the new url it has generated (specifically
> here:http://code.djangoproject.com/browser/django/trunk/django/middleware/...).
> However this fails to reconstitute the original query parameters when they
> were not in fact valid utf-8 to begin with (as your info_hash is not).  Back
> when the GET QueryDict was constructed, this code:
>
> http://code.djangoproject.com/browser/django/trunk/django/http/__init...
>
> took the info_hash bytestring with repr
> '\x10\xc2\xe1\x96\xe0\x8d\x90\x05\xb7\xdf\xc6\xbc\x8e\xc2\x15\xe4=`\xcc\x84'
> and generated the unicode string with repr
> u'\x10\ufffd\ufffd\ufffd\x05\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0304' in
> its place.  The request was assumed to be encoded in utf-8 for want of any
> better information.  All those '\ufffd's are the Unicode replacement
> character, indicating that the input bytestring contained invalid utf-8
> sequences.  (For example, while the first byte \x10 is a valid 1-byte utf-8
> sequence, the next two bytes \xc2 \xe1 are not.  \xc2 is a valid first byte
> for a 2-byte sequence, but the 2nd byte must then begin with binary 10,
> where \xe1 begins binary 11. So those two bytes are tossed and '\ufffd' put
> in their place.)  At this point there is no way to go back to the original
> input since generating the replacement char in place of invalid input throws
> away the original information.  When the APPEND_SLASH code tries to
> urlencode() this unicode version of the query string, you see a lot of
> %EF%BF%BD because \xef\xbf\xbd is the 3-byte utf-8 encoding of the Unicode
> replacement character \ufffd.  Clear as mud?
>
> Anyway I think line 83 of django/middleware/common.py should be:
>
> newurl += '?' + request.META['QUERY_STRING']
>
> instead of:
>
> newurl += '?' + request.GET.urlencode()
>
> That will ensure that the query parameters included in the redirect url are
> identical to what was included in the original url.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Capturing full URL string

2008-06-04 Thread Karen Tracey
On Wed, Jun 4, 2008 at 2:03 PM, John M <[EMAIL PROTECTED]> wrote:

> Yes, I understand that, and I think it's a good thing, but when it
> redirects, it mangles the parameters, would you agree?
>

Yes, I think that's a bug in Django.  The code that is doing the
APPEND_SLASH handling tries to use request.GET.urlencode() to restore the
original query parameters to the new url it has generated (specifically
here:
http://code.djangoproject.com/browser/django/trunk/django/middleware/common.py#L83).
However this fails to reconstitute the original query parameters when they
were not in fact valid utf-8 to begin with (as your info_hash is not).  Back
when the GET QueryDict was constructed, this code:

http://code.djangoproject.com/browser/django/trunk/django/http/__init__.py#L156

took the info_hash bytestring with repr
'\x10\xc2\xe1\x96\xe0\x8d\x90\x05\xb7\xdf\xc6\xbc\x8e\xc2\x15\xe4=`\xcc\x84'
and generated the unicode string with repr
u'\x10\ufffd\ufffd\ufffd\x05\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0304' in
its place.  The request was assumed to be encoded in utf-8 for want of any
better information.  All those '\ufffd's are the Unicode replacement
character, indicating that the input bytestring contained invalid utf-8
sequences.  (For example, while the first byte \x10 is a valid 1-byte utf-8
sequence, the next two bytes \xc2 \xe1 are not.  \xc2 is a valid first byte
for a 2-byte sequence, but the 2nd byte must then begin with binary 10,
where \xe1 begins binary 11. So those two bytes are tossed and '\ufffd' put
in their place.)  At this point there is no way to go back to the original
input since generating the replacement char in place of invalid input throws
away the original information.  When the APPEND_SLASH code tries to
urlencode() this unicode version of the query string, you see a lot of
%EF%BF%BD because \xef\xbf\xbd is the 3-byte utf-8 encoding of the Unicode
replacement character \ufffd.  Clear as mud?

Anyway I think line 83 of django/middleware/common.py should be:

newurl += '?' + request.META['QUERY_STRING']

instead of:

newurl += '?' + request.GET.urlencode()

That will ensure that the query parameters included in the redirect url are
identical to what was included in the original url.

Karen

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



JQuery Ajax Widget for multiple and simple select

2008-06-04 Thread Juanjo Conti

I am trying to implement an ajax-widget with JQuery to handle simple
and multiple select that retrives options that match what the user has
typed.

Is there something of this all ready done out there? I'd like to see it.

Thanks,

-- 
Juanjo Conti

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



snycdb, MySQL & index length

2008-06-04 Thread morgi

Hi all,

Newbie to Django & hit a brick wall. I'm trying to run syncdb on my
models and it bails out on a couple of fields that I have where the
issue is maximum key lengths in MySQL.

First field is CharField, unique, max_length=500
Second is TextField, unique

In both cases syncdb fails with a MySQLdb
_mysql_exceptions.OperationalError (1071, "Specified key was too long:
max length is 767 bytes). What MySQL is expecting is obviously a key
length specified as part of the constraint/index (as per official
docs) but I can't see a way of doing this in Django.

I tried the reverse approach of using my existing table SQL scripts
from MySQL Workbench to generate the tables and then to write the
models to match. This works fine for most things but then you hit the
problem of running model unit tests where "manage.py tests" uses the
model to generate the test tables & this obviously fails on the key
length issue again.

"If I had any hair i'd be tearing it out..."

Am I missing something obvious (apart from "try Postgres") ?

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: Setting a ManyToMany default

2008-06-04 Thread Peter Rowell

> perhaps having an __init__ function in your Vineyard class could allow
> you to set pinot noir as the default, unless it is passed another type
> of wine.

Conceptually, what you said is correct, but TDIITD (The Devil Is In
The Details).

I believe that the "correct" way to do this is to set default values
in the n-value selector widget that displays in the admin add/edit
interface. I have spent a fair amount of time this morning trying to
figure out exactly how to do this.

The answer appears to be to create custom add & change manipulators
for Vineyard, something I've not done before. Well, now I have a hobby
for the weekend.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



custom css in password change form built using oldforms

2008-06-04 Thread Mayank Dhingra

Hi Guys,

I needed a work around to add custom css in the default(oldforms)
password change form
that I am using . How to go about it ?

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: Custom CSS for newforms using ModelForm

2008-06-04 Thread Mayank Dhingra

Thanks Eric that did the job


On Jun 3, 1:50 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
> Yes, that was it. ModelForms are nice because you don't have to
> specify the fields to put in the form, it does that automatically.
> However, as soon as you want to customize the widgets being used for
> the fields, you _do_ have to specify the fields in yourModelForm, and
> put the classes and whatnot into the widget. So in your case, your
> form will have to do something like this:
>
> class Model_1Form(ModelForm):
>  title =
> forms.CharField(widget=forms.TextInput(attrs={'class':'super'}))
>  # other fields that need to be customized
>  class Meta:
>  model = Model_1
>  # etc
>
> That ought to do it...
>
> E
>
> On Jun 3, 2008, at 3:02 PM, Mayank Dhingra wrote:
>
>
>
> > Actually I wanted to know how to
>
> > Say I have a model "Model_1" and I made a form from that model using
> >ModelForm
> > now how am I supposed to addcustomCSSto the fields of this model?
>
> > class Model_1Form(ModelForm):
> >class Meta:
> >model = Model_1
> >exclude = ('hash')
> >def save(self, request):
> >  something something
>
> > Let me know if I missed something.
> > Thanks
>
> > On Jun 3, 9:14 am, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
> >> Hey there,
>
> >> You probably want 
> >> this:http://www.djangoproject.com/documentation/newforms/#customizing-widg
> >> ...
>
> >> You'll have to specify the field types for your model, then widget
> >> types for each field, and the extra attributes go in the widget.
>
> >> Yrs,
> >> E
>
> >> On Jun 3, 2008, at 2:23 AM, Mayank Dhingra wrote:
>
> >>> Hi,
>
> >>> I was looking to addcustomcssto the fields of a (new)form that I
> >>> created usingModelForm
> >>> but couldn't find any mention or discussion on it.
>
> >>> Does any know know how can I achieve it ?
>
> >>> Thanks in advance,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ImageField get_X_url() method not respecting MEDIA_URL?

2008-06-04 Thread chris . czub

Thanks, that was it.

-Chris

On Jun 3, 5:44 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote:
> On Tue, Jun 3, 2008 at 5:15 PM, Chris Czub <[EMAIL PROTECTED]> wrote:
> > # URL that handles the media served from MEDIA_ROOT.
> > # Example: "http://media.lawrence.com;
> > MEDIA_URL = 'http://www.mysite.com/media'
>
> > which is correct - the url of the image SHOULD be
>
> >http://www.mysite.com/media/uploads/20080603151319/rrbk.jpg
>
> Unfortunately, that's not correct. Your MEDIA_URL setting needs a
> trailing slash in order for Python's urljoin() method to realize that
> it's a directory that needs to stay, not just a file that should be
> replaced. Change it to 'http://www.mysite.com/media/'and you should
> be fine.
>
> More recent (from just over a year ago) checkouts of Django have an
> additional comment added into the default settings.py to outline this
> more clearly.
>
> # URL that handles the media served from MEDIA_ROOT. Make sure to use a
> # trailing slash if there is a path component (optional in other cases).
> # Examples: "http://media.lawrence.com;, "http://example.com/media/;
>
> -Gul
--~--~-~--~~~---~--~~
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: create model instance

2008-06-04 Thread Chris Czub
http://www.djangoproject.com/documentation/models/fixtures/

What you are looking for is an initial_data fixture. You need to serialize
the default instance of the model you want as JSON and save it in
initial_data.json and then it should prepopulate when you run syncdb.

On Wed, Jun 4, 2008 at 2:31 PM, djangoer <[EMAIL PROTECTED]> wrote:

>
> A quick newbie question,
>
> is there any way that can create a default instance (a pre-specified
> instance) in the database once the model is created. In other words,
> when we first run the syncdb(or set up the website), an pre-defined
> instance is created.
>
> For example, we have a Book model,
>
> class Book(models.Model):
>author = models.CharField(maxlength = 50)
>title = models.CharField(maxlength = 50)
>
> When the website is first setup, we would like to have one default
> "Book" instance in the DB, say Book("John.Smith","COMPUT101").
>
> Your help is greatly appreciated.
> >
>

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



create model instance

2008-06-04 Thread djangoer

A quick newbie question,

is there any way that can create a default instance (a pre-specified
instance) in the database once the model is created. In other words,
when we first run the syncdb(or set up the website), an pre-defined
instance is created.

For example, we have a Book model,

class Book(models.Model):
author = models.CharField(maxlength = 50)
title = models.CharField(maxlength = 50)

When the website is first setup, we would like to have one default
"Book" instance in the DB, say Book("John.Smith","COMPUT101").

Your help is greatly appreciated.
--~--~-~--~~~---~--~~
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: Capturing full URL string

2008-06-04 Thread John M

Yes, I understand that, and I think it's a good thing, but when it
redirects, it mangles the parameters, would you agree?

J

On Jun 4, 10:35 am, Gregor Müllegger <[EMAIL PROTECTED]> wrote:
> This is because Django will redirect you to a page with an appended
> slash to your url if it's not already there -- how you have
> discovered.
>
> To understand why this is done you should read the following section
> in django's 
> documentation:http://www.djangoproject.com/documentation/middleware/#django-middlew...
>
> To prevent the trailing slahs, set in your settings module
> APPEND_SLASH to False.
>
> Gregor
--~--~-~--~~~---~--~~
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: Setting a ManyToMany default

2008-06-04 Thread Randy Barlow

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Peter Rowell wrote:
> I guess I don't understand where this constructor lives in the food
> chain. It can't exist prior to the first save() of the object because
> we don't have the id before that. I tried putting it *in* the save()
> and it did nothing. (BTW, that last one really bothers me.)
> 
> Or are you talking about a constructor for the edit form? That might
> work, if I can figure out how to inject it at the right place.
> 
> I think I need to stare at the db/forms code for a while.

Hmm, maybe I am wrong on this.  I'm new to Django/Python, but not to
object oriented design (I'm a C++ guy), so take what I say with a grain
of salt.  This may not be allowed in the models.py, but if it is,
perhaps having an __init__ function in your Vineyard class could allow
you to set pinot noir as the default, unless it is passed another type
of wine.  Would anybody care to comment on whether this is possible?

- --
Randy Barlow
Software Developer
The American Research Institute
http://americanri.com
919.228.4971
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhG05sACgkQw3vjPfF7QfUfbgCgl/fd6/xtpSOMZZb60zzqU75i
sZsAnjxp32Ua3WU2jB+Uc1iBIhoeEsQQ
=/LpA
-END PGP SIGNATURE-

--~--~-~--~~~---~--~~
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: Capturing full URL string

2008-06-04 Thread Matthias Kestenholz

Hi,

On Wed, 2008-06-04 at 09:30 -0700, John M wrote:
> I am running into some weirdness in an app im writing and so I thought
> I'd try to see how the basics of URL strings are handled.
> 
> So I wrote a one line hello world app, and wanted to see how the dev
> server output it's results.  I am still getting my feet wet with the
> whole web / http / HTML thing, these may be silly questions.
> 
> Here's my view.py
> from django.http import HttpResponse
> 
> def announce(request):
>   return HttpResponse("Hello")
> 
> the urls.py maps announce/$ to this view, and that is working.
> 
> What's odd, is when I goto my browser and do http://localhost:8000/announce,
> the dev server does this output:
> [04/Jun/2008 09:22:20] "GET /announce HTTP/1.1" 301 0
> [04/Jun/2008 09:22:20] "GET /announce/ HTTP/1.1" 200 5
> 
> I'm unclear as to what these are?  the 301 looks like it's 'fixing' my
> URL or something to redirect to /announce/ instead of just the /
> announce that I put in the URL?
> 
> The reason for all this, is I'm having trouble in another post about a
> torrent tracker im trying to write, and i'm not getting the parameters
> passed as I would expect.
> 
> Any information about this behavior would be great.

Did you read this page?

http://www.djangoproject.com/documentation/settings/#append-slash

--~--~-~--~~~---~--~~
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: Capturing full URL string

2008-06-04 Thread Gregor Müllegger

This is because Django will redirect you to a page with an appended
slash to your url if it's not already there -- how you have
discovered.

To understand why this is done you should read the following section
in django's documentation:
http://www.djangoproject.com/documentation/middleware/#django-middleware-common-commonmiddleware

To prevent the trailing slahs, set in your settings module
APPEND_SLASH to False.

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



DIsplay user list with full names in newforms-admin

2008-06-04 Thread Joost Cassee

Hi all,

A Django site I am developing will allow students to enroll in
courses. A user is a student if a member of the 'students' group. The
Couse model has a many-to-many relation with User. So far so good...

When a course administrator wants to add students to a course, the
widget shows the username of a user. Unfortunately, these people do
not know their students' usernames, just their real names. Is there a
way of rendering the student list from a different property of the
User model?

Thanks in advance!

- Joost
--~--~-~--~~~---~--~~
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: Help with request encoding (again)

2008-06-04 Thread John M

Karen,

I think I found my problem, and added a new post, maybe you can help?

http://groups.google.com/group/django-users/browse_thread/thread/fc47edb1b9f8ec8f#

Thanks again, you've really helped me see this through

John

On Jun 2, 1:01 pm, John M <[EMAIL PROTECTED]> wrote:
> Karen,
>
> Thanks so much for keeping up on this.  I'll run through the software
> to find the correct answer.  This is a side project, and my time gets
> in bursts, sorry for the late reply.
>
> John
>
> On May 29, 9:13 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
> > On Thu, May 29, 2008 at 11:52 PM, John M <[EMAIL PROTECTED]> wrote:
>
> > > Well, I thought it was working, but alas, now it's not, let me give
> > > you the latest...
>
> > > GET /announce/?uploaded=0=1=80_hash=%EF%BF%BDm%EF
> > > %BF%BDmfD%D8%9A%EF%BF%BD%EF%BF%BD%C7%86%EF%BF%BD8%EF%BF
> > > %BD=started=0=yoolrpcyku=0_id=-
> > > TR1210-exbira35le7h=51413=0
>
> > > In the code:
>
> > >print "Debug"
> > >print "query string " + parse_qs(request.META['QUERY_STRING'])
> > > ['info_hash'][0]
> > >hash = parse_qs(request.META['QUERY_STRING'])['info_hash']
> > > [0].encode('hex')
> > > assert False
>
> > > The output from the print statements:
> > > Debug
> > > query string parseqs�m�mfDؚ��dž�8�
>
> > > LOCAL Variables
> > > c
> > > {'addr': '127.0.0.1', 'peer_id': u'-TR1210-exbira35le7h', 'port':
> > > 51413}
> > > hash
> > > 'efbfbd6defbfbd6d6644d89aefbfbdefbfbdc786efbfbd38efbfbd'
>
> > > and the debug screen snippit
>
> > > QUERY_STRING
> > > 'uploaded=0=1=80_hash=%EF%BF%BDm%EF%BF%BDmfD%D8%9A
> > > %EF%BF%BD%EF%BF%BD%C7%86%EF%BF%BD8%EF%BF
> > > %BD=started=0=yoolrpcyku=0_id=-
> > > TR1210-exbira35le7h=51413=0'
>
> > > Any help would be great!
>
> > What's wrong with the hash it is calculating?  Lining up the %-encoded query
> > string with the hash produced it looks like everything is correct:
>
> >http://dpaste.com/53697/
>
> > What is the 'correct' result supposed to be?  Perhaps I misunderstood
> > exactly how you need to interpret info_hash?
>
> > Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Capturing full URL string

2008-06-04 Thread John M

Well, in investigating this further, I think I found the 'issue'.
There are a few threads with similar issues, where the pattern in
urls.py doesn't capture the trailing slash, and I guess by default,
django figures it will 'adjust' the URL and redirect to the 'correct'
URL, hence the initial 301, which I think for most cases is great.

My original urls.py was:

(r'^announce/$', 'track.views.announce'),

and that was causing a 301 if I went to 127.0.0.1:8000/announce.

If I added
(r'^announce$', 'track.views.announce')

so my urls.py looks like this:
(r'^announce/$', 'track.views.announce'),
(r'^announce$', 'track.views.announce')

when run with the urls.py above, it ran as expected without the 301
redirect.

So here's the rub, this is awesome for probably most applications, but
when django does the redirect under the dev server, with a complicated
escaped parameter it seems like it mangles the parameters on the
redirect.

To test this, I pointed a bittorrent client at my test announce client
(it doesn't do anything but return 'hello world', so the client will
just assume it's a bad tracker, but for purposes of testing

With the urls.py w/o adjusting for 301 'features':

urls.py
(r'^announce/$', 'track.views.announce')

runserver output:

[04/Jun/2008 09:47:29] "GET /announce?info_hash=%10%C2%E1%96%E0%8D
%90%05%B7%DF%C
6%BC%8E%C2%15%E4%3D%60%CC
%84_id=T03I-7oWWIp1FS9B=57328=0&
downloaded=0=0_peer_id=1=1=started=-UIpWN
HTTP/1.1" 30
1 0

[04/Jun/2008 09:47:29] "GET /announce/?
uploaded=0=1_peer_id=1_ha
sh=%10%EF%BF%BD%EF%BF%BD%EF%BF%BD%05%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF
%BD%EF%BF%B
D%EF%BF%BD%CC%84=started=0=-
UIpWN_id=T03I-7oWWIp1F
S9B=57328=0 HTTP/1.1" 200 5

with the urls.py adjusted to avoid the 301.
(r'^announce$', 'track.views.announce'),
(r'^announce/$', 'track.views.announce'),

runserver output:
[04/Jun/2008 09:49:36] "GET /announce?info_hash=%10%C2%E1%96%E0%8D
%90%05%B7%DF%C
6%BC%8E%C2%15%E4%3D%60%CC
%84_id=T03I-6HsE05d95lH=17242=0&
downloaded=0=0_peer_id=1=1=started=Jq-8Ta
HTTP/1.1" 20
0 5

Note the difference?

When django does the redirect for the 301 the parameters change,
specifically info_hash:

before 301
info_hash=%10%C2%E1%96%E0%8D%90%05%B7%DF%C6%BC%8E%C2%15%E4%3D%60%CC%84

After 301
info_hash=%10%EF%BF%BD%EF%BF%BD%EF%BF%BD%05%EF%BF%BD%EF%BF%BD%EF%BF%BD
%EF%BF%BD%EF%BF%BD%EF%BF%BD%CC%84

Am I right in my observations?

Is there anything I can do to avoid this in django?  HELP, THIS IS
REALLY HOLDING ME UP.  In the mean time, I'll capture the slashes
better.

Thanks,

John



On Jun 4, 9:30 am, John M <[EMAIL PROTECTED]> wrote:
> I am running into some weirdness in an app im writing and so I thought
> I'd try to see how the basics of URL strings are handled.
>
> So I wrote a one line hello world app, and wanted to see how the dev
> server output it's results.  I am still getting my feet wet with the
> whole web / http / HTML thing, these may be silly questions.
>
> Here's my view.py
> from django.http import HttpResponse
>
> def announce(request):
> return HttpResponse("Hello")
>
> the urls.py maps announce/$ to this view, and that is working.
>
> What's odd, is when I goto my browser and dohttp://localhost:8000/announce,
> the dev server does this output:
> [04/Jun/2008 09:22:20] "GET /announce HTTP/1.1" 301 0
> [04/Jun/2008 09:22:20] "GET /announce/ HTTP/1.1" 200 5
>
> I'm unclear as to what these are?  the 301 looks like it's 'fixing' my
> URL or something to redirect to /announce/ instead of just the /
> announce that I put in the URL?
>
> The reason for all this, is I'm having trouble in another post about a
> torrent tracker im trying to write, and i'm not getting the parameters
> passed as I would expect.
>
> Any information about this behavior would be great.
>
> Thanks
>
> 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
-~--~~~~--~~--~--~---



Re: why so slow?

2008-06-04 Thread blis102

Also, make sure, if you're using Firefox, make sure none of your
extensions (if you have any) are causing the slowness. This is often
the case.

Dana

On Jun 4, 1:04 am, morlandi <[EMAIL PROTECTED]> wrote:
> If you're using Firefox on Windows, try 
> this:http://weblogs.asp.net/dwahlin/archive/2007/06/17/fixing-firefox-slow...
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



BEST VIDEO SEX!!!!

2008-06-04 Thread sexy18

Best Video SEX!
http://rozrywka.yeba.pl/show.php?id=2737
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



BEST VIDEO SEX!!!!

2008-06-04 Thread sexy18

Best Video SEX!
http://rozrywka.yeba.pl/show.php?id=2737
--~--~-~--~~~---~--~~
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: Form wizard problem

2008-06-04 Thread tyman26

Unless I am really mistaken, I am pretty sure this is a bug.  The
"self.step" variable in "wizard.py" is never being updated after the
forms are submitted.  These are two possible fixes I found:

1.  In the method "def __call__(self, request, *args, **kwargs) :"
update the self.step variable after checking if the form is valid.
 **Coding
 Revision:
  if form.is_valid():
   ..
   if next_step == num:
.
   else:
form = self.get_form(next_step)
current_step = next_step
self.step = current_step   #this would be the
newly added code

2.  In the method "def render_template(self, request, form,
previous_fields, step, context=None):" replace "self.step" with the
functions "step" argument value instead.
 Coding*
 Previous:
  context.update(self.extra_context)
  return render_to_response(self.get_template(self.step),
dict(context,...
 Revision:
  context.update(self.extra_context)
  return render_to_response(self.get_template(step),
dict(context,...

If anyone can verify that they have the same problem, I will submit
this to a bug fix.  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
-~--~~~~--~~--~--~---



Capturing full URL string

2008-06-04 Thread John M

I am running into some weirdness in an app im writing and so I thought
I'd try to see how the basics of URL strings are handled.

So I wrote a one line hello world app, and wanted to see how the dev
server output it's results.  I am still getting my feet wet with the
whole web / http / HTML thing, these may be silly questions.

Here's my view.py
from django.http import HttpResponse

def announce(request):
return HttpResponse("Hello")

the urls.py maps announce/$ to this view, and that is working.

What's odd, is when I goto my browser and do http://localhost:8000/announce,
the dev server does this output:
[04/Jun/2008 09:22:20] "GET /announce HTTP/1.1" 301 0
[04/Jun/2008 09:22:20] "GET /announce/ HTTP/1.1" 200 5

I'm unclear as to what these are?  the 301 looks like it's 'fixing' my
URL or something to redirect to /announce/ instead of just the /
announce that I put in the URL?

The reason for all this, is I'm having trouble in another post about a
torrent tracker im trying to write, and i'm not getting the parameters
passed as I would expect.

Any information about this behavior would be great.

Thanks

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



Re: Setting a ManyToMany default

2008-06-04 Thread Peter Rowell

> How about writing your own constructor that takes an argument of type
> and has a default value assigned there?

I guess I don't understand where this constructor lives in the food
chain. It can't exist prior to the first save() of the object because
we don't have the id before that. I tried putting it *in* the save()
and it did nothing. (BTW, that last one really bothers me.)

Or are you talking about a constructor for the edit form? That might
work, if I can figure out how to inject it at the right place.

I think I need to stare at the db/forms code for a while.

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: use my own widgets when creating a form out of a model

2008-06-04 Thread Rishabh Manocha
What you want to do is perfectly doable. If (for example) you want the
street field to show up as a textarea with 40 columns in your form, you
would put something like this in your forms.py:

class PersonForm(ModelForm):
   street = forms.CharField(widget = forms.TextArea(attrs = {"cols":40}))
   class Meta:
   model = Person
   fields = ['name', 'notes', 'email', 'cellphone',
'officephone', 'skypename', 'street', 'number', 'suffix', 'zip',
'city', 'country', 'photo']

You can of-course do this with any field and use any widget for said field.

Best,

R

On Wed, Jun 4, 2008 at 6:49 PM, Wim Feijen <[EMAIL PROTECTED]> wrote:

>
> Hello people,
>
> Being able to work with Django is very helpful to me. However, I am
> unsure whether I can create a form out of a database model and then
> customize that form. Using widgets to increase the textarea to 40
> would be great! But after reading  the documentation I am convinced I
> cannot do that.
>
> One solution I can think of, is to loop over the fields in the form
> and start changing those? Is that possible? Then again, is that the
> proper way to do it?
>
> My models are below.
>
> Thanks for any help!
>
> Wim
>
> 
>
> class Person(models.Model):
>name = models.CharField(max_length=100)
>notes = models.CharField(max_length=100, blank=True)
>email = models.EmailField(max_length=100, blank=True)
>cellphone = models.CharField(max_length=100, blank=True)
>officephone = models.CharField(max_length=100, blank=True)
>chat = models.CharField(max_length=100, blank=True)
>skypename = models.CharField(max_length=100, blank=True)
>street = models.CharField(max_length=100, blank=True)
>number = models.CharField(max_length=100, blank=True)
>suffix = models.CharField(max_length=100, blank=True)
>zip = models.CharField(max_length=100, blank=True)
>city = models.CharField(max_length=100, blank=True)
>country = models.CharField(max_length=100, blank=True)
>photo = models.ImageField(upload_to='.', blank=True)
>company = models.ManyToManyField(Company)
>groups = models.ManyToManyField(Group)
>deleted = models.BooleanField(default=False)
>shared = models.ManyToManyField(User, related_name='shared')
>owner = models.ForeignKey(User)
>
>def __str__(self):
>return self.name
>
> class PersonForm(ModelForm):
>class Meta:
>model = Person
>fields = ['name', 'notes', 'email', 'cellphone',
> 'officephone', 'skypename', 'street', 'number', 'suffix', 'zip',
> 'city', 'country', 'photo']
>
> >
>

--~--~-~--~~~---~--~~
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: use my own widgets when creating a form out of a model

2008-06-04 Thread Richard Dahl
from:http://www.djangoproject.com/documentation/newforms/#widgets

class CommentForm(forms.Form):
name = forms.CharField(
widget=forms.TextInput(attrs={'class':'special'}))
url = forms.URLField()
comment = forms.CharField(
   widget=forms.TextInput(attrs={'size':'40'}))

hth,
-richard


On 6/4/08, Wim Feijen <[EMAIL PROTECTED]> wrote:
>
>
> Hello people,
>
> Being able to work with Django is very helpful to me. However, I am
> unsure whether I can create a form out of a database model and then
> customize that form. Using widgets to increase the textarea to 40
> would be great! But after reading  the documentation I am convinced I
> cannot do that.
>
> One solution I can think of, is to loop over the fields in the form
> and start changing those? Is that possible? Then again, is that the
> proper way to do it?
>
> My models are below.
>
> Thanks for any help!
>
> Wim
>
> 
>
> class Person(models.Model):
>name = models.CharField(max_length=100)
>notes = models.CharField(max_length=100, blank=True)
>email = models.EmailField(max_length=100, blank=True)
>cellphone = models.CharField(max_length=100, blank=True)
>officephone = models.CharField(max_length=100, blank=True)
>chat = models.CharField(max_length=100, blank=True)
>skypename = models.CharField(max_length=100, blank=True)
>street = models.CharField(max_length=100, blank=True)
>number = models.CharField(max_length=100, blank=True)
>suffix = models.CharField(max_length=100, blank=True)
>zip = models.CharField(max_length=100, blank=True)
>city = models.CharField(max_length=100, blank=True)
>country = models.CharField(max_length=100, blank=True)
>photo = models.ImageField(upload_to='.', blank=True)
>company = models.ManyToManyField(Company)
>groups = models.ManyToManyField(Group)
>deleted = models.BooleanField(default=False)
>shared = models.ManyToManyField(User, related_name='shared')
>owner = models.ForeignKey(User)
>
>def __str__(self):
>return self.name
>
> class PersonForm(ModelForm):
>class Meta:
>model = Person
>fields = ['name', 'notes', 'email', 'cellphone',
> 'officephone', 'skypename', 'street', 'number', 'suffix', 'zip',
> 'city', 'country', 'photo']
>
> >
>

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



Form wizard problem

2008-06-04 Thread tyman26

Hi,
  I am having a problem getting the form wizard to load a different
template for each form.  I used the example provided where they name
their templates template_0.html, template_1.html ... and so then
override the function like this:

def get_template(self, step):
return 'vlis/production/order/template_%s.html'  % step

I stepped through the code with a debugger and noticed that every time
it his "get_template(self, step)" the variable step always stays at
0.  Shouldn't this increment for every step in the form?  Not sure if
this is just me doing something wrong or possibly a glitch.  Any help
would be much appreciated.

Regards,

Tyson
--~--~-~--~~~---~--~~
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: Error saving unicode field

2008-06-04 Thread AndyB

Sigh. Apparently I made that change in February when I was having a
different trauma with unicode.

I think I now just get the fear when I see a unicode error and my
brain switches off to prevent damage.

Thanks Karen :(

On Jun 4, 3:26 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Wed, Jun 4, 2008 at 5:23 AM, AndyB <[EMAIL PROTECTED]> wrote:
>
> > I'm struggling to understand the following:
> >http://dpaste.com/54745/
>
> > It's a legacy database that's had the data imported with a variety of
> > tools - not all of them very well behaved when it comes to character
> > encoding. The offending character is a UK pound sign (163 in unicode
> > and latin1 I believe)
>
> > I initially thought that the field contained latin1 and therefore
> > wasn't happy being saved when Django was expecting Unicode but when I
> > construct a unicode string it compares as true to the character that
> > is causing the problem but gives an error when I save.
>
> > I then tried:
> > p.land_value_comments = unichr(163)
> > p.save()
>
> > and got the same error.
>
> > Then I tried creating a new record with just that single character in
> > it and that didn't work either.
>
> > Can anyone help me understand what's going on here? My dev server is
> > running MySQL 4.1.21 Could that be part of the problem?
>
> Your traceback shows:
>
> C:\Python24\lib\site-packages\MySQLdb\cursors.py in execute(self, query, args)
>     146         #query = query.encode(charset)
>     147         if args is not None:
> --> 148             query = query % db.literal(args)
>     149         try:
>     150             r = self._query(query)
>
> Why is line 146 commented out?  The code here looks like it basically
> matches up with the 1.2.1_p2 version of MySQLdb, but in the released code
> line 146 is not commented out 
> (seehttp://mysql-python.svn.sourceforge.net/viewvc/mysql-python/tags/MySQ...).
>
> Did you make that change in debugging this problem?  If so you need to undo
> it and anything else in MySQLdb and Django code that you changed so that
> people here can help debug with known quantities.  If you didn't make that
> change, you probably need to re-install MySQLdb because the version you are
> running doesn't appear to match any officially released one.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django bug or very strange behavior - new to Django don't know which

2008-06-04 Thread Karen Tracey
On Wed, Jun 4, 2008 at 6:37 AM, puff <[EMAIL PROTECTED]> wrote:

>
> The original code used a loop as you illustrated for the delete.
> Although I no longer have the original code, the annotated traces (see
> below) show the delete code in xx_xxraid was NOT invoked.  This
> strikes me as at least a deficiency if not a bug.
>

There is a ticket open for this, I believe:

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

It has not been reviewed yet.

Karen


>
>  initializexxNode
> todo: tell SS delete xxnode   (would have expected related
> delete message here but the xxraid model's delete method wasn't
> invoked)
> ...
>  initializeESRaid
> ---xxraids have 0  (since here all the xxraid
> s are gone)
>
>
> On Jun 4, 6:12 am, Jonathan Lukens <[EMAIL PROTECTED]> wrote:
> > It is my understanding that the delete method you are calling is a
> > QuerySet method, not a model method, and thus there is nothing
> > overriding it.  I'm sure that if you did this:
> >
> > for x in xxRaid.objects.all():
> > x.delete()
> >
> > Then your method will be called as desired.  The overrides are for the
> > DB API.
> >
>
> >
>

--~--~-~--~~~---~--~~
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: Error saving unicode field

2008-06-04 Thread Karen Tracey
On Wed, Jun 4, 2008 at 5:23 AM, AndyB <[EMAIL PROTECTED]> wrote:

>
> I'm struggling to understand the following:
> http://dpaste.com/54745/
>
> It's a legacy database that's had the data imported with a variety of
> tools - not all of them very well behaved when it comes to character
> encoding. The offending character is a UK pound sign (163 in unicode
> and latin1 I believe)
>
> I initially thought that the field contained latin1 and therefore
> wasn't happy being saved when Django was expecting Unicode but when I
> construct a unicode string it compares as true to the character that
> is causing the problem but gives an error when I save.
>
> I then tried:
> p.land_value_comments = unichr(163)
> p.save()
>
> and got the same error.
>
> Then I tried creating a new record with just that single character in
> it and that didn't work either.
>
> Can anyone help me understand what's going on here? My dev server is
> running MySQL 4.1.21 Could that be part of the problem?
>

Your traceback shows:

C:\Python24\lib\site-packages\MySQLdb\cursors.py in execute(self, query, args)
146 #query = query.encode(charset)
147 if args is not None:
--> 148 query = query % db.literal(args)
149 try:
150 r = self._query(query)

Why is line 146 commented out?  The code here looks like it basically
matches up with the 1.2.1_p2 version of MySQLdb, but in the released code
line 146 is not commented out (see
http://mysql-python.svn.sourceforge.net/viewvc/mysql-python/tags/MySQLdb-1.2.1_p2/MySQLdb/MySQLdb/cursors.py?revision=448=markup).


Did you make that change in debugging this problem?  If so you need to undo
it and anything else in MySQLdb and Django code that you changed so that
people here can help debug with known quantities.  If you didn't make that
change, you probably need to re-install MySQLdb because the version you are
running doesn't appear to match any officially released one.

Karen

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



TEMPLATE_CONTEXT_PROCESSORS and request context in django.contrib.auth.views

2008-06-04 Thread [EMAIL PROTECTED]

I'm using django.contrib.auth.views for user management like login
wrapped in my own views for example:

@login_required
def password_change(request):
return django.contrib.auth.views.password_change(request,
template_name='userpanel/password_change.html')

But my template context processor and my variables set in request
context aren't used. Is there a way to pass them to the
django.contrib.auth.views ?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



generic relations

2008-06-04 Thread Filippo Santovito

Hi all,
I've read http://www.djangoproject.com/documentation/models/generic_relations/
.
How can I share a tag between Animal and Vegetables?

--~--~-~--~~~---~--~~
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: Setting a ManyToMany default

2008-06-04 Thread Randy Barlow

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Peter Rowell wrote:
> class Varietal(models.Model):
>   name = models.CharField()
> 
> class Vineyard(models.Model):
>   name = models.CharField()
>   varietals = models.ManyToManyField(Varietal)
> 
> This site is devoted almost exclusively to Pinot Noir, so 90% of the
> Vineyards are planted to Pinot Noir, but some are also planted to
> Pinont Gris, Gamay Noir, etc.
> 
> 1. Is it possible to express a default for a ManyToMany field? How?
> Docs? Having a callable here (e.g., default=some_function) feels about
> right, but the problem is that it needs to be called when we are first
> creating the new object, which means it hasn't been saved yet, so it
> has no id, and therefore we don't have enough info to do a
> vineyard.varietals.add()

> Am I missing something really obvious?

How about writing your own constructor that takes an argument of type
and has a default value assigned there?

- --
Randy Barlow
Software Developer
The American Research Institute
http://americanri.com
919.228.4971
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhGn78ACgkQw3vjPfF7QfWkIwCfZNY2LsS5Z7qmIQMRdW/7WMKn
MgUAoKZnclcxqr9cS7/NTxp6ywFrrhei
=1cLs
-END PGP SIGNATURE-

--~--~-~--~~~---~--~~
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 framework is amazing..

2008-06-04 Thread Purab

fast, easy to learn. very cool features.
future of web application programming.


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



HOT BOOBS -

2008-06-04 Thread boobst9

HOT BOOBS -

http://tinyurl.com/5ctysp

CAMERON DIAZ - http://tinyurl.com/47qj39

MONICA BELLUCI - http://tinyurl.com/3thzcl

CHRISTINA RICCI - http://tinyurl.com/3hjlgo
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



use my own widgets when creating a form out of a model

2008-06-04 Thread Wim Feijen

Hello people,

Being able to work with Django is very helpful to me. However, I am
unsure whether I can create a form out of a database model and then
customize that form. Using widgets to increase the textarea to 40
would be great! But after reading  the documentation I am convinced I
cannot do that.

One solution I can think of, is to loop over the fields in the form
and start changing those? Is that possible? Then again, is that the
proper way to do it?

My models are below.

Thanks for any help!

Wim



class Person(models.Model):
name = models.CharField(max_length=100)
notes = models.CharField(max_length=100, blank=True)
email = models.EmailField(max_length=100, blank=True)
cellphone = models.CharField(max_length=100, blank=True)
officephone = models.CharField(max_length=100, blank=True)
chat = models.CharField(max_length=100, blank=True)
skypename = models.CharField(max_length=100, blank=True)
street = models.CharField(max_length=100, blank=True)
number = models.CharField(max_length=100, blank=True)
suffix = models.CharField(max_length=100, blank=True)
zip = models.CharField(max_length=100, blank=True)
city = models.CharField(max_length=100, blank=True)
country = models.CharField(max_length=100, blank=True)
photo = models.ImageField(upload_to='.', blank=True)
company = models.ManyToManyField(Company)
groups = models.ManyToManyField(Group)
deleted = models.BooleanField(default=False)
shared = models.ManyToManyField(User, related_name='shared')
owner = models.ForeignKey(User)

def __str__(self):
return self.name

class PersonForm(ModelForm):
class Meta:
model = Person
fields = ['name', 'notes', 'email', 'cellphone',
'officephone', 'skypename', 'street', 'number', 'suffix', 'zip',
'city', 'country', 'photo']

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



theory on using single project or multiple projects per site

2008-06-04 Thread Aljosa Mohorovic

if i have a site under example.com domain with structure:
www.example.com - public site - django project "portal"
admin.example.com - administration site - django project "admin"
shop.example.com - satchmo integration attempt - django project "shop"
... services, rss, and anything else you can think of

1. should i use one project for entire site or break it into projects
like in example above?

2. sharing secret key in project - 
http://www.djangoproject.com/documentation/settings/#secret-key
 - when i break example.com in more projects, i share database, media
settings for all projects but i don't know if i should share secret
key?
 - any advice on what to share between projects and what not?

3. sessions - what would you recommend, any special setup related to
sessions that can be applied to this kind of site structure?

4.  satchmo comes with admin app configured, so should i leave it
under shop.example.com or should i integrate in admin.example.com

5. have anything related to project theory to share?

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: manage.py sync db failing

2008-06-04 Thread Greg Newman
Never mind.  Found my issue.  Required a good pot of coffee.

On Wed, Jun 4, 2008 at 7:52 AM, greg.newman <[EMAIL PROTECTED]>
wrote:

> I'm trying to syncdb in a project and am getting the following error
> running python 2.5.1 with django 0.96.
> Anyone have a clue why?  Need more info, let me know.
>
> greg-3:examples greg$ python manage.py syncdb
> Traceback (most recent call last):
>  File "manage.py", line 16, in 
>execute_manager(settings)
>  File "/Library/Python/2.5/site-packages/django/core/management.py",
> line 1657, in execute_manager
>project_directory = setup_environ(settings_mod)
>  File "/Library/Python/2.5/site-packages/django/core/management.py",
> line 1649, in setup_environ
>project_module = __import__(project_name, {}, {}, [''])
> ValueError: Empty module name
>



-- 
Greg Newman
Rails Developer & Designer
Owner, carbon8.us
Blog, 20seven.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: Accessing model fields by name

2008-06-04 Thread eelcoh



On Jun 4, 1:30 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:

> > I am using setattr(self, fieldname, value) to set a value on a field
> > for which i do not know anything but the name. Is that common django
> > idiom, or are there better ways to do this?

> This isn't a Django-specific feature, it's part of Python itself - and
> yes, it's a common idiom.

OK, thanks. It just felt a bit 'low level'. That's why i wouldn't have
been surprised if django had some other mechanism for accessing fields
by (string) name.

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



manage.py sync db failing

2008-06-04 Thread greg.newman

I'm trying to syncdb in a project and am getting the following error
running python 2.5.1 with django 0.96.
Anyone have a clue why?  Need more info, let me know.

greg-3:examples greg$ python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 16, in 
execute_manager(settings)
  File "/Library/Python/2.5/site-packages/django/core/management.py",
line 1657, in execute_manager
project_directory = setup_environ(settings_mod)
  File "/Library/Python/2.5/site-packages/django/core/management.py",
line 1649, in setup_environ
project_module = __import__(project_name, {}, {}, [''])
ValueError: Empty module name

--~--~-~--~~~---~--~~
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 Admin Model View Page

2008-06-04 Thread yml

Hello,
I would recommend you to look at : databrowse
http://www.djangoproject.com/documentation/databrowse/
Here it is a short description extracted from the django
documentation:
"""
Databrowse is a Django application that lets you browse your data.

As the Django admin dynamically creates an admin interface by
introspecting your models, Databrowse dynamically creates a rich,
browsable Web site by introspecting your models.
"""
I hope that will help you.
--yml

On 4 juin, 11:52, Ali Sogukpinar <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have an website and I would like to use Django admin app for
> modifing my model objects.
>
> Django admin app is out of the box providing C(R)UD actions for me.
> But R (Read) action is implemented as list. You can see the list of
> your objects and If you click on one the item in the list you will be
> automaticall directed to change_form (Update action)
>
> I would like to have an intermediate step where you see the details of
> the object with its relations etc. and from this page you can goto
> change_form if you really want to edit it.
>
> Couldn't make it? Did any of you implemented such a functionality?
>
> Thanks in Advance.
>
> Ali
--~--~-~--~~~---~--~~
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: show reverse relationship on admin pages

2008-06-04 Thread Russell Keith-Magee

On Wed, Jun 4, 2008 at 5:27 PM, AndyB <[EMAIL PROTECTED]> wrote:
>
> Hi Russ,
>
> Do you mean you can define a custom forms and get it to appear as the
> default change form in admin? Is there currently any documentation on
> this?

Thats the idea. The move to newforms is significant, but the change
that will have the biggest effect is the ease with which the admin
interface can be customized.

As for documentation - this is one of the missing pieces at the
moment. There is the start of formal documentation:

http://code.djangoproject.com/browser/django/branches/newforms-admin/docs/admin.txt

But this doesn't cover much beyond basic setup. There are more details
in the wiki:

http://code.djangoproject.com/wiki/NewformsAdminBranch

but even this doesn't cover all the changes. The best option (and I
admit it's less than optimal) is to look at the code - in particular:

http://code.djangoproject.com/browser/django/branches/newforms-admin/django/contrib/admin/options.py

which is the code that defines the ModelAdmin class. This will let you
know all the options that are available, and should give you an idea
of the methods that could be overridden in your own Admin deployment.

> There seems to be no end to delights you can get from newforms-
> admin ;)

There is a very good reason why we are making such a big change, and
why it is taking a while to get right - but once it is done, it will
be worth the wait.

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: Django bug or very strange behavior - new to Django don't know which

2008-06-04 Thread puff

The original code used a loop as you illustrated for the delete.
Although I no longer have the original code, the annotated traces (see
below) show the delete code in xx_xxraid was NOT invoked.  This
strikes me as at least a deficiency if not a bug.

 initializexxNode
todo: tell SS delete xxnode   (would have expected related
delete message here but the xxraid model's delete method wasn't
invoked)
...
 initializeESRaid
---xxraids have 0  (since here all the xxraid
s are gone)


On Jun 4, 6:12 am, Jonathan Lukens <[EMAIL PROTECTED]> wrote:
> It is my understanding that the delete method you are calling is a
> QuerySet method, not a model method, and thus there is nothing
> overriding it.  I'm sure that if you did this:
>
> for x in xxRaid.objects.all():
> x.delete()
>
> Then your method will be called as desired.  The overrides are for the
> DB API.
>

--~--~-~--~~~---~--~~
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 bug or very strange behavior - new to Django don't know which

2008-06-04 Thread Jonathan Lukens

It is my understanding that the delete method you are calling is a
QuerySet method, not a model method, and thus there is nothing
overriding it.  I'm sure that if you did this:

for x in xxRaid.objects.all():
x.delete()

Then your method will be called as desired.  The overrides are for the
DB API.


On Jun 3, 6:53 pm, puff <[EMAIL PROTECTED]> wrote:
> An hour later I know what caused the behavior and it seems to me to be
> a Django bug or at least deficiency.
>
> This behavior occurred during an initialization of the application.
>
> First the table xx_xxnode was initialized by deleting all of its
> records and then reloading the table from an external source.  It has
> a character field primary key.
>
> Then the table xx_xxraid needs to be initialized.  xx_xxraid has a
> foreign key to the table xx_xxnode.  However, when xx_xxnode's records
> were deleted, Django also deleted the linked records in xx_xxraid
> since the keys were no longer valid.  All of which is OK and if I read
> the documents closely is in fact documented.
>
> However, there is a problem.  The model for xx_xxraid overrides the
> delete method.  While the records in xx_xxraid are in fact being
> deleted as an (appropriate) side effect of the delete of xx_node's
> records the delete method of xx_xxraid is NOT being invoked.  It seems
> likely that add and delete are overrides associated with the admin
> interface NOT, sadly, with the DB API.
>
> No joy, but at least I know what is going on.
>
> On Jun 3, 5:36 pm, puff <[EMAIL PROTECTED]> wrote:
>
> > RAW sql statement SELECT COUNT(*) FROM `xx_xxraid` shows table has 12
> > records.
>
> > In application statement
> >      print '---xxx raids have', ESRaid.objects.count()
> > prints 0!  Why?
>
> > I've imported connections and
> >      print connection.queries[-1]
> > just after the count prints
> >     {'time': '0.000', 'sql': u'SELECT COUNT(*) FROM `es_esraid`'}
> > So it looks like the correct SQL is being executed.
>
> > Curiously,
> >     xxRaid.objects.all().delete()
> >  indeed deletes all 12 of the table records.  However, a delete method
> > in the model is never executed?
>
> > What am I missing.
--~--~-~--~~~---~--~~
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 Model View Page

2008-06-04 Thread Ali Sogukpinar

Hi,

I have an website and I would like to use Django admin app for
modifing my model objects.

Django admin app is out of the box providing C(R)UD actions for me.
But R (Read) action is implemented as list. You can see the list of
your objects and If you click on one the item in the list you will be
automaticall directed to change_form (Update action)

I would like to have an intermediate step where you see the details of
the object with its relations etc. and from this page you can goto
change_form if you really want to edit it.

Couldn't make it? Did any of you implemented such a functionality?

Thanks in Advance.

Ali

--~--~-~--~~~---~--~~
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-tagging installation problem

2008-06-04 Thread M.Ganesh

Myles Braithwaite wrote:
> I have a patch for version 0.2.1 to get it working with django trunk.
>
> http://media.mylesbraithwaite.com/uploads/files/2008-05-29/django-tagging-0.2.1_fix_for_django_trunk.patch
>  
> ---
> *Myles Braithwaite*
> [EMAIL PROTECTED]
>
> Please consider the trees before print this email.
>
> On 2-Jun-08, at 11:05 PM, M.Ganesh wrote:
>
>>
>> Hi,
>>
>> Running 'python manage.py syncdb' after including 'tagging' in the
>> INSTALLED_APPS throws the following error.
>>
>> My django version : (0, 97, 'pre') r7543 (trunk)
>> Python version : Python 2.5.1 (r251:54863, Mar  7 2008, 03:41:45)
>> django tagging version : (0, 2.1001, None)
>>
>> How do I fix this?
>>
>> Thanks in advance
>>
>> Regards Ganesh
>>
>> Traceback (most recent call last):
>>  File "manage.py", line 11, in 
>>execute_manager(settings)
>>  File
>> "/usr/lib/python2.5/site-packages/django/core/management/__init__.py",
>> line 272, in execute_manager
>>utility.execute()
>>  File
>> "/usr/lib/python2.5/site-packages/django/core/management/__init__.py",
>> line 219, in execute
>>self.fetch_command(subcommand).run_from_argv(self.argv)
>>  File
>> "/usr/lib/python2.5/site-packages/django/core/management/base.py", line
>> 72, in run_from_argv
>>self.execute(*args, **options.__dict__)
>>  File
>> "/usr/lib/python2.5/site-packages/django/core/management/base.py", line
>> 85, in execute
>>self.validate()
>>  File
>> "/usr/lib/python2.5/site-packages/django/core/management/base.py", line
>> 112, in validate
>>num_errors = get_validation_errors(s, app)
>>  File
>> "/usr/lib/python2.5/site-packages/django/core/management/validation.py",
>> line 28, in get_validation_errors
>>for (app_name, error) in get_app_errors().items():
>>  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
>> line 126, in get_app_errors
>>self._populate()
>>  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
>> line 55, in _populate
>>self.load_app(app_name, True)
>>  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
>> line 70, in load_app
>>mod = __import__(app_name, {}, {}, ['models'])
>>  File "/usr/lib/python2.5/site-packages/tagging/models.py", line 9, in
>> 
>>from tagging.managers import TagManager, TaggedItemManager
>>  File "/usr/lib/python2.5/site-packages/tagging/managers.py", line 6,
>> in 
>>from django.db.models.query import QuerySet, parse_lookup
>> ImportError: cannot import name parse_lookup
>>
Thanks Myles, I've already switched to svn version of django-tagging. 
Thanks for offering the patch

Regards Ganesh


--~--~-~--~~~---~--~~
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: show reverse relationship on admin pages

2008-06-04 Thread AndyB

Hi Russ,

Do you mean you can define a custom forms and get it to appear as the
default change form in admin? Is there currently any documentation on
this?

There seems to be no end to delights you can get from newforms-
admin ;)

AndyB

On Jun 4, 7:33 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Tue, Jun 3, 2008 at 11:20 PM, lee <[EMAIL PROTECTED]> wrote:
>
> > I have a filter interface to select teams associated with traders on
> > the trader change page on the admin site.  On the team change page I
> > would like a similar filter interface to view/change traders
> > associated with that team.
>
> > Is that possible, or something that I would have to add.  If so, do
> > you know where I need to make this modification?
>
> The current trunk admin interface doesn't provide a way to show the
> reverse direction for m2m or foreign key fields.
>
> It should be a lot easier to implement in newforms-admin by defining a
> custom model form. However, to the best of my knowledge, adding
> automated support for this sort of thing isn't on the to-do list for
> the initial release.
>
> 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
-~--~~~~--~~--~--~---



Error saving unicode field

2008-06-04 Thread AndyB

I'm struggling to understand the following:
http://dpaste.com/54745/

It's a legacy database that's had the data imported with a variety of
tools - not all of them very well behaved when it comes to character
encoding. The offending character is a UK pound sign (163 in unicode
and latin1 I believe)

I initially thought that the field contained latin1 and therefore
wasn't happy being saved when Django was expecting Unicode but when I
construct a unicode string it compares as true to the character that
is causing the problem but gives an error when I save.

I then tried:
p.land_value_comments = unichr(163)
p.save()

and got the same error.

Then I tried creating a new record with just that single character in
it and that didn't work either.

Can anyone help me understand what's going on here? My dev server is
running MySQL 4.1.21 Could that be part of the problem?

regards,
Andy Baker
--~--~-~--~~~---~--~~
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: Outside a web server, as a service

2008-06-04 Thread alex

Thanks Karen!

alex

On Jun 2, 5:18 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Mon, Jun 2, 2008 at 3:33 AM, Alexandre Parenteau <[EMAIL PROTECTED]>
> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I'm a newbie with Django, and I'm having trouble accessing django
> > database outside the web server.
>
> > I'm using mod_python+apache+MySQL without any problem.
>
> > However I need for my project to *also* access the database *outside*
> > of mod_python. I wrote a script service.py which is supposed to access
> > periodically the database, as a background service:
>
> > > python  service.py --service
>
> > This service.py file looks like this (the code was borrowed from
> > settings.py):
>
> > > CUT
> > from django.core.management import setup_environ
> > try:
> >    import settings # Assumed to be in the same directory.
> > except ImportError:
> >    import sys
> >    sys.stderr.write("Error: Can't find the file [...])
> >    sys.exit(1)
>
> > print setup_environ(settings)
>
> > from djangoserver.myserver.models import Job, Dummy, ...
>
> > # XXX: (Temporary) workaround for ticket #1796: force early loading of all
> > # models from installed apps.
> > from django.db.models.loading import get_models
> > loaded_models = get_models()
>
> > [...]
> > < CUT
>
> > The script service.py then looks for jobs to work on:
>
> > > CUT
> >        while 1:
>
> >                hadJob = doOneRun()
> >                if not hadJob:
> >                        time.sleep(0.100)
>
> >                # WORK AROUND: just to defeat the sql cache
> >                d = Dummy(foo="1")
> >                d.save()
> >                d.delete()
> > < CUT
>
> > As you might see, I run into the problem that the Job table was not
> > getting re-fetched my MySQL. I found a work around by creating a Dummy
> > model, and by forcing an update on the table (d.save()).
>
> > Could someone point me to a way to do a background job with Django? Is
> > there a cache I need to flush in order for Django to re-query the
> > database?
>
> I think you must be using InnoDB tables?  If so you are not running into any
> Django cache but rather MySQL/InnoDB's default transaction isolation level
> of repeatable read.  Your problem sounds identical to the one posted here:
>
> http://groups.google.com/group/django-users/browse_thread/thread/e25c...
>
> and I expect it has the same possible fixes.
>
> Karen- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: why so slow?

2008-06-04 Thread morlandi

If you're using Firefox on Windows, try this:
http://weblogs.asp.net/dwahlin/archive/2007/06/17/fixing-firefox-slowness-with-localhost-on-vista.aspx
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



getting a problem while using templates

2008-06-04 Thread Sandy

hi
iam new to django. i just installed the Django. can any one
help me in setting the environment variables .
actually i put a path like: C:\Python25\Lib\site-packages\django\ and
site-packages\bin\django-admin.py
but for both types iam unable to import templates.

whenever i try this line

from django.template.loader import get_template

the following errors are coming:-

Traceback (most recent call last):
  File "", line 1, in 
from django.template.loader import get_template
  File "C:\Python25\Lib\site-packages\django\template\__init__.py",
line 918, in 
add_to_builtins('django.template.defaultfilters')
  File "C:\Python25\Lib\site-packages\django\template\__init__.py",
line 915, in add_to_builtins
builtins.append(get_library(module_name))
  File "C:\Python25\Lib\site-packages\django\template\__init__.py",
line 904, in get_library
mod = __import__(module_name, {}, {}, [''])
  File "C:\Python25\Lib\site-packages\django\template
\defaultfilters.py", line 5, in 
from django.utils.translation import gettext
  File "C:\Python25\Lib\site-packages\django\utils\translation
\__init__.py", line 3, in 
if settings.USE_I18N:
  File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line
28, in __getattr__
self._import_settings()
  File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line
53, in _import_settings
raise EnvironmentError, "Environment variable %s is undefined." %
ENVIRONMENT_VARIABLE
EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is
undefined.

thankyou in advance

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



Re: show reverse relationship on admin pages

2008-06-04 Thread Russell Keith-Magee

On Tue, Jun 3, 2008 at 11:20 PM, lee <[EMAIL PROTECTED]> wrote:
>
> I have a filter interface to select teams associated with traders on
> the trader change page on the admin site.  On the team change page I
> would like a similar filter interface to view/change traders
> associated with that team.
>
> Is that possible, or something that I would have to add.  If so, do
> you know where I need to make this modification?

The current trunk admin interface doesn't provide a way to show the
reverse direction for m2m or foreign key fields.

It should be a lot easier to implement in newforms-admin by defining a
custom model form. However, to the best of my knowledge, adding
automated support for this sort of thing isn't on the to-do list for
the initial release.

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: Dynamic choice on Model

2008-06-04 Thread Peter Rowell

> How can I cast this 2 values dictionary into a 2 values tuple?

Why are you creating a dict here?
Try something like this:

choices = []
for i in range(100):
  choices.append( (i, i+1) )
SONGNO_CHOICES = choices

Or more concisely:

SONGNO_CHOICES= [ (i,i+1) for i in range(100) ]

This gives you a sequence (AKA a list, AKA an array) of two-tuples.

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