We have a lot of good things here! ~ ~ Come and see

2008-05-13 Thread lee

 HOMEPAGE:  http://www.brandedsite.com

 CONTACT:   [EMAIL PROTECTED]

 PAYMENT:   Western Union / Bank of china / paypal

  We are a proffesional asian wholesaler of --wholesale cheap

Nike Sneakers:   Air Force One,Air Jordans1-22,
Jordan2.2,Jordan2.5,3.5,4.5,  6.5,7.5,13.5,15.5,21.5.  Air Max90,
95,97,Air Max95 360, Air Max 180,women Air Max95,97 .Air max TN.
Bape,Dunk, Shox, Adidas,Football shoes,Jame,Kobe,Junior
Series,Puma,Timberland,Prada,Women Jordan,LV shoes,
Fashion baboosh,Lacoste shoes,gucci,Chanel,sand
shoes,D,high-heel shoes,NBA,NIKE,soccer,Max one,converse,

 Clothes:   bape hoodies,jacket,dust coat,shirt, CLH hoody, rmc
jeans,short jeans,lacoast shirt,
diesel jeans,paul smith,red monkey jeans,5ive jungle
hoody,AMANI shirt,antik jeans
enyce jeans,roca wear,lrg jeans,hoodie,shirt,polo t-
shirt,evise hoody,coat,ED hardy
hoody,skirt,BBC hoody,jeans,shirt,10deep jeans,shirt,AK t-
shirt,LA t-shirt,new york city t-shirt,kidrobot hoody,
ggg shirt,hoodies,jeans,APE jeans,hoody,F1 coat
shirt,Gucci jeans,hoody,shirt,BRM shirt,G-STAV shirt,T y-shirt,
D jeans,shirt,Artful Dudger shirt,hoody

Brand Bag:   backpack,purse,Adidas bag,cover nut,NIKE bag,GIORGIO
handbag,CHLOE handbag,CHENEL handbag,LV handbag,coach
gucci handbag,JUICY handbag,VERSACE tie,

Brand Belt:  Gucci belt, polo belt

Brand  Hat:   football club hat,adidas,puma,new
bape,lrg ,evisu,new era, NBA , nike,new era ,A,usa , gucci hat,bape,
ED hardy

Brand Watch:  ARMANI watch ,BMW watch , club watch ,MONTBLANC
watch


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



Break mobile phone brand fashion trend

2008-05-13 Thread lee

http://www.brandedsite.com/

[EMAIL PROTECTED]

Nike Air Jordan 1 ,Nike Air Jordan 2 Shoes,Nike Air Jordan 3,Nike Air
Jordan 4 Shoes ,Nike Air Jordan 5 Chaussure Shoes,Nike Air Jordan 6
Catalog ,Nike Air Jordan 7 Shoes Catalog ,
Nike Air Jordan 8 Customized ,Nike Air Jordan 9 Shoes
Customized ,Nike
Air Jordan 10 Wholesalers,Nike Jordan 11 Shoes Wholesalers,Nike Air
Jordan 12 retailer,Nike Air Jordan 13 Shoes Factory ,Nike Air Jordan
14 Shoes Sell,Nike Air Jordan 16 Exporter ,Nike Air Jordan 17 Shoes
Exporter, Nike Air Jordan 18 Offer, Nike Air Jordan 19 Shoes
Offer,Nike Air Jordan 20 Manufacture,Nike Jordan 21 Shoes
Manufacture,Nike Jordan 22 CUSTOMIZED ,
We Import& Wholesale Nike
footwear and Nikes Sneakers Jordans Sneakers to this market:
USA,America,US,United States,UK,England,United Kingdom,IT,Italy,
NT,Netherlands,China,Chinese,Germany,DE,Greece,GR,France,
FR,Spain,Portugal,Switzerland,Switzerland,Brazil,Chile,Peru,C
Korea,Australia,Hongkong,Canada,Mexico,Etc
Nike shoes | china nike shoes | air jordan sneakers | cheap gucci
shoes | cheap prada sneakers | gucci sneakers | mix jordan sneakers |
chanel sandals | gucci sandals | dior sandals | wholesale jordan
sneakers | nike running shoes | nike stock shoes | air jordan at
whlesale price | nike shoes air jordan supplier from in china |
Lacoste Trainers | puma trainers | louis vuitton purse | prada purse
|
gucci handbags | chanel purse | coach purse | nike bas kerball shoes
|
Nike Sneakers| cheap nike sneakers | nike shoes from china | nike
replica | copy nike sneakers | nike factory stores | nike stores
Nike wholesale - Nike shoes wholesale
nike jordan sneakers wholesale( www.brandedsite.com)
We (http: //www.brandedsite.com)
Wholesale Cheap Jordan
Shoes,Michael
Jordan Shoes,Nike Jordan Basketball shoes, ... Jordan Shoes,Air
Jordan
Sneakers,Air Jordan Wholesale All of the Air Jordan sneakers have
Nike
Air in the shoes.Authentic quality Jordan Sneakers Custom Jordan
Sneakers Wholesale Jordan Sneakers gucci sneakers prada sneakers in
www.brandedsite.com,lv
chanel coach dior DG DSQUARED2 DIESEL,miumiu handbags
sneakers,shoes,t-
shirts,jeans,jackets.We sale new Nike Sneakers,Air Jordan
Sneakers,AIR
FORCE 1S,Nike Dunks SB,Bape Sta from nike outlets and factory
stores,also Nike wholesale-Jordan Shoes,sneakers! china online store!
Cheap Lacoste Trainers Please,Lacoste Trainers for Women,Lacoste
Shoes
Online,Lacoste Shoes for Women,Buy Lacoste Trainers Online,Lacoste
Sneakers(www.brandedsite.com)
Lacoste Footwear,Black Lacoste Trainers,Lacoste Trinity
Trainers(www.brandedsite.com)
Lacoste Leisure Shoe, cheap nike dunks,cheap gucci
sneakers(www.brandedsite.com)
cheap sunglasses factory,wholesale nike tshirts,cheap air jordans
(www.brandedsite.com)
nike sb china wholesale,cheap puma sneakers,sneaker wholesale
china,jordans sneakers,gucci shirts wholesale,cheap bape
trainers,shoe
wholesalers in china,cheap nike sneakers,DISCOUNT nike
SNEAKERS,Tennis
Sneakers,gucci Sneakers, Prada Sneakers,Shoes Jordan's +
Wholesale,jordan wholesale manufacturers,nike customes,cheap
wholesale
jordans nike,cheap tiffany necklace,gucci shoes shop,Wholesale
Distributor Authentic Nike Shoes,wholesale air forces and
jordans,dsquared manufacturers,dsquared womens shoes,dsquared2
jeans,dsquared2
shoes
ed hardy caps,ed hardy caps cheap,ed hardy for cheap,ed hardy hats
for
cheap
addidas wholesalers distributor(www.brandedsite.com)
bulk air force ones for sale(www.brandedsite.com)
Burberry Handbags made in China(www.brandedsite.com)
BUY ARMANI SHOES(www.brandedsite.com)
Buy holesale from china GUCCI(www.brandedsite.com)
buy jordans made in china(www.brandedsite.com)
buy nike shoes at wholesale price(www.brandedsite.com)

We sell nokia lcd, include: 1100, 1220 , 1221, 1260, 2100, 2115,
2116i, 2260, 2270,2285 , 2600 , 2651 , 3100, 3108 , 3120 , 3155 ,
3155i , 3200 , 3220 , 3300 , 3560 , 3585 , 3586 , 3586i , 3590 ,
3595 , 3600 , 3650 , 3660, 5100, 5140 , 6010, 6015i , 6019i, 6020 ,
6021, 6100, 6101, 6102, 6170 , 6200, 6220, 6225, 6230, 6230i, 6235i,
6255i, 6256i, 6310 , 6560, 6585 , 6590 , 6600 , 6610 , 6620 , 6650 ,
6670 , 6682 , 6800 , 6810 , 6820 , 6822 , 7200 , 7210 , 7250 , 7260 ,
7270 , 7280 , 7610 , 8310 , 8800 , 9500 etc.

We sell all kinds of sport shoes.Such as nike shoes,Jordan,nike air
force,nike air max 2003,nike air max 2004,nike air max 360,nike air
max 97,nike air max 95,nike air max plus tn,nike air max running,nike
ducks,nike kobe,nike shox R4,nike shox R5 and so on.If there are
anything you are interested,please contact us at once.We will offer
you the best product and service as soon as we receiving your order.

Nokia 8800 Housing 5930pcs In Stock - www.brandedsite.com China
Nokia 6131 Flex Cable 7560pcs In Stock - www.brandedsite.com China
Nokia 5300 LCD 8000pcs In Stock - www.brandedsite.com China
Nokia 6111 LCD 4960pcs In Stock - www.brandedsite.com China
Nokia N80 Housing 3900pcs In Stock - www.brandedsite.com China
Nokia 6102 Keypad 9650pcs In Stock - 

Re: do sessions work when redirecting?

2008-05-13 Thread Mike Chambers

fyi, bug logged here with test case:

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

mike


Mike Chambers wrote:
> ok. more info on this. (Sorry about all of the emails, but I am really 
> trying to track this down, and see if it is a bug).
> 
> If I try to include the request.POST data QueryDict in the session, then 
> no session data is saved between requests (i.e. it wipes other session 
> data):
> 
> 
> request.session['form_post_data'] = request.POST.copy()
> request.session['foo'] = "bar"
> 
> Then, in another request:
> 
> print request.session.keys()
> 
> prints []
> 
> But:
> 
> request.session['foo'] = "bar"
> 
> then in another request:
> 
> print request.session.keys()
> 
> prints ['foo']
> 
> So, at this point, Im thinking it is a bug.
> 
> mike
> 
> 
> Mike Chambers wrote:
>> I ended up getting this to work with (what feels like) a hack:
>>
>>
>> To save the session:
>>
>> -- 
>> request.session['form_post_query_string'] = request.POST.urlencode()
>> return HttpResponseRedirect(request.META['HTTP_REFERER'])
>> -- 
>>
>>
>> then to later access it and use it:
>>
>> -- 
>> from django.http import QueryDict
>>
>> q = QueryDict(request.session['form_post_query_string'])
>> comment_form = CommentForm(q)
>> -- 
>>
>> Anyone know why I cant store request.POST.copy() in the session?
>>
>> Is that a bug?
>>
>> mike
>>
>> Mike Chambers wrote:
>>> Thanks for the input.
>>>
>>> I am narrowing down the issue. Basically, If i try to place a copy of 
>>> the request.POST data into the session, nothing will get stored:
>>>
>>> i.e.
>>>
>>> -- 
>>> post_copy = request.POST.copy()
>>> request.session['form_post_data'] = post_copy
>>> return HttpResponseRedirect(request.META['HTTP_REFERER'])
>>> -- 
>>>
>>> After this
>>>
>>> request.session.keys() returns [] (an empty list)
>>>
>>> if I do:
>>>
>>> post_copy = request.POST.copy()
>>> request.session['form_post_data'] = post_copy
>>> print request.session.get('form_post_data')
>>> return HttpResponseRedirect(request.META['HTTP_REFERER'])
>>>
>>> this outputs:
>>> -- 
>>> >> [u''], u'user_url': [u'']}>
>>> -- 
>>>
>>> However, it it still not actually saved and available during a 
>>> seperate request.
>>>
>>> mike
>>>
>>>
>>> Rajesh Dhawan wrote:


 On May 13, 3:23 pm, Mike Chambers <[EMAIL PROTECTED]> wrote:
> I am running into an issue where my session values are not 
> remembered if
> I do an HTTP redirect.
>
> If I do:
>
> -- 
> request.session['a'] = ''
> return HttpResponseRedirect(request.META['HTTP_REFERER']
> -- 
>
> The session variable a will not be available once the browser is 
> redirected.
>
> If I do:
>
> -- 
> request.session['a'] = ''
> render_to_response(...)
> -- 
>
> Then the session is available as expected.
>
> I have tried to set:
>
> request.session.modified = True
>
> but that does not change the behavior.
>
> Can session variables be set when doing a redirect?

 Absolutely.

 You should ensure that request.META['HTTP_REFERER'] doesn't redirect
 to a different domain name that happens to map to the same
 application. For example, if you set the session in a view at
 http://127.0.0.1/myview/ and that view redirects to 
 http://localhost/myview2/,
 you will not be able to access the previous session.
>>>


--~--~-~--~~~---~--~~
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: loaddata .. columns app_label, model are not unique

2008-05-13 Thread Carl Karsten

Russell Keith-Magee wrote:
> On Wed, May 14, 2008 at 1:09 AM, Carl Karsten <[EMAIL PROTECTED]> wrote:
>>  [EMAIL PROTECTED]:~/dev/sites/ridgemoor$ ./manage.py loaddata rm.json
>>  Installing json fixture 'rm' from absolute path.
>>  Problem installing fixture 'rm.json': columns app_label, model are not 
>> unique
>>
>>  How do I debug this?
> 
> The error is telling you what is wrong - you are loading data into a
> model that has a unique_together clause, but you are loading data that
> is not unique together.
> 
> However, I can go a little further in this specific case - you have
> contenttypes in your fixture.
> 
> Loading contenttypes by fixture is problematic because all the
> contenttypes you will ever need are created automatically as part of
> the syncdb. Consider the following sequence of events.
> 
> 1. Create a project, populate INSTALLED_APPS, run syncdb.
> 2. Generate a fixture
> 3. Add a new application to INSTALLED APPS
> 4. Flush the database, rerun syncdb.
> 5. Attempt to load the fixture created in 2.
> 
> Since you changed the applications in INSTALLED_APPS in (3), the order
> of the contenttypes created in 4 can change (and in your case, _has_
> changed). As a result, the database IDs assigned to the content types
> are not consistent, and when you load your fixture, you can end up
> with two content type entries for the same content type.
> 
> The simple solution - don't serialize content types. You don't need to
> anyway, because they are automatically created by the syncdb process.

What are the chances of getting a dumpdata hack to exclude certain apps?

I know it isn't too hard to figure out what apps I want to backup, but it 
sounds 
like the 'exclude' feature might be useful even once this issue is resolved.

> 
> The only catch on this is if you are using content types in some way,
> and you need to serialize a reference to a content type. The most
> likely reason for needing this is if you have a generic relation. In
> this case, you are slightly stuck - you can't serialize the generic
> relation without guaranteeing the IDs for the content types, but you
> can't guarantee the IDs for the content types. This is a known issue,
> http://code.djangoproject.com/ticket/7052.
> 
> The only workaround in the meantime is to regenerate or manually tweak
> your fixtures every time you modify INSTALLED_APPS. The order in which
> contenttypes are created is consistent if you never modify
> INSTALLED_APPS, so as long as you are willing to update your fixtures
> whenever you modify INSTALLED_APPS, it is possible to live with this
> problem.
> 

if INSTALLED_APPS is the same on both boxes, shouldn't it work?  (I have a 
feeling the answer is "maybe" given there might be a problem with the order 
apps 
were added or something.)

Thanks for the in depth answer.

Carl K

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



ANNOUNCE: Security bugfix releases

2008-05-13 Thread James Bennett

In accordance with our security policy[1], a set of releases is being
issued tonight to fix a security vulnerability reported to the Django
project. This message contains a description of the vulnerability, a
description of the changes made to fix it, pointers to the the
relevant patches for each supported version of Django and pointers to
the resulting releases. A copy of this information will also be posted
on the official Django weblog, and the relevant areas of the Django
website are being updated to reflect the new releases.

Description of vulnerability:

The Django administration application will, when accessed by a user
who is not sufficiently authenticated, display a login form and ask
the user to provide the necessary credentials before displaying the
requested page. This form will be submitted to the URL the user
attempted to access, by supplying the current request path as the
value of the form's "action" attribute.

The value of the request path was not being escaped, creating an
opportunity for a cross-site scripting (XSS) attack by leading a user
to a URL which contained URL-encoded HTML and/or JavaScript in the
request path.


Affected versions:

* Django development trunk
* Django 0.96
* Django 0.95
* Django 0.91


Resolution:

The login form has been changed to escape the request path before use
as the form's submission action.

The relevant changesets for affected versions of Django are:

* Django development trunk: Changeset 7521
(http://code.djangoproject.com/changeset/7521)
* Django 0.96: Changeset 7527 (http://code.djangoproject.com/changeset/7527)
* Django 0.95: Changeset 7528 (http://code.djangoproject.com/changeset/7528)
* Django 0.91: Changeset 7529 (http://code.djangoproject.com/changeset/7529)

The following releases have been issued based on the above changesets:

* Django 0.96.2:
http://media.djangoproject.com/releases/0.96/Django-0.96.2.tar.gz
* Django 0.95.3:
http://media.djangoproject.com/releases/0.95/Django-0.95.3.tar.gz
* Django 0.91.2:
http://media.djangoproject.com/releases/0.91/Django-0.91.2.tar.gz

All users of affected versions of Django are strongly encouraged to
apply the relevant patch or upgrade to the relevant patched release as
soon as possible.


Release manager's note:

If you maintain a third-party Django package and you did *not* receive
the announcement of these release from me earlier tonight, please
email me directly as soon as possible.

Also, please note that potential security vulnerabilities should be
reported directly to the Django project, at
[EMAIL PROTECTED], as outlined in our security policy[1].
Following this procedure helps us to maintain high standards of
response and disclosure, and makes the process of investigating and
resolving security issues much easier for everyone involved.


[1] 
http://www.djangoproject.com/documentation/contributing/#reporting-security-issues


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

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



Re: Python issues on mac. Python not working.

2008-05-13 Thread Scott SA

On 5/13/08, Jason Ourscene ([EMAIL PROTECTED]) wrote:

>I installed everything through macports initially, but would like to
>be on a newer version of python which i found is bundled with leopard.
>I completely removed all the files and things associated with
>macports. Now when i type python in the terminal i get.. ~bash:
>python: command not found
>
>I tried to figure out a way to link it all back together but cant seem
>to get it.
>
>Anyone know of a way to do this?

Your environment variables are now wrong.

First of all, have you logged into a fresh terminal session? It is possible 
(though remote) that could fix the problem.

From the command prompt, type

echo $PATH

Will give you the basics.

The default python install will be in /Library/Frameworks/Python/... etc.

but it will likely be running from /usr/bin/python or /usr/local/bin/python 
something else...

Try
/usr/env python

and see if that gives a little joy.

I'm not really 'up' on the finer details of setting evn. variables under OS-X, 
but hopefully this will give you a place to start from.

S

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



Python issues on mac. Python not working.

2008-05-13 Thread Jason Ourscene

I installed everything through macports initially, but would like to
be on a newer version of python which i found is bundled with leopard.
I completely removed all the files and things associated with
macports. Now when i type python in the terminal i get.. ~bash:
python: command not found

I tried to figure out a way to link it all back together but cant seem
to get it.

Anyone know of a way to do this?

Thanks!
Jason
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



can django.core.urlresolvers.reverse work with included URLconfs?

2008-05-13 Thread @@
Hi,
It seems the revese method can't work with included URLconfs?

for example :
the root URLconfs is like this
urlpatterns = patterns('',
(r'^app/',include('django_website.apps.blog.urls.blog')),
)

the app URLconfs is like this
urlpatterns = patterns('',
(r'^test/a-test', 'app.view', name='test'),
)

When i want to get the "test" url
from django.core.urlresolvers import reverse
reverse('test')

i will get /test/a-test/ instead of /app/test/a-test/

Did i miss something or is there other workarounds?

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: Thread-safe or not?

2008-05-13 Thread rcs_comp

On May 13, 5:20 pm, TP <[EMAIL PROTECTED]> wrote:
> How about specifically whether mod_wsgi can be used to run many
> threads serving web requests for Django?

My understanding is that you can only run one instance of Django per
Application Group/Pool.  You can read here for more info:

http://groups.google.com/group/django-developers/browse_thread/thread/ebcbb544d42849c6
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



IE7, IE6, and Safari session save issue

2008-05-13 Thread Seth Buntin

Okay I am going to try to explain this the best I can.  The issue I am
having is only with IE7, IE6, and Safari.  I believe it is a way the
session information isn't being saved.  This issue doesn't happen with
r7020 but is happening with r7526.  The problem doesn't occur when
running from Django's development server.

Here is the bit of code (Cart model):

@classmethod
def get_session_cart(cls, request, customer=None):
try:
cart = cls.objects.get(id=request.session['cart'])
except (Cart.DoesNotExist, KeyError):
cart = cls()
cart.customer = customer
cart.save()
request.session['cart'] = cart.id
return cart

I don't assume I have to tell what I am doing here but the idea is to
get the cart object if it exists.  I run this command when adding to
cart and when I display the cart.  In IE6&7 and Safari it throws a
KeyError and creates a new cart session.  When adding to cart it
actually adds the product correctly but also throws the KeyError when
displaying the cart.  I can't figure out what I am doing wrong.  If I
add the setting to save the session on every request it doesn't work
in any browser.  Any ideas?
--~--~-~--~~~---~--~~
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 Image Uploads: Fake Model Fields?

2008-05-13 Thread Nick Retallack

Currently it seems like it could be pretty disastrous to let users
upload their own files, as you can see from this ticket:
http://code.djangoproject.com/ticket/2983

Of course, one solution is to name your files after the pk of the
record they're associated with, so new uploads will overwrite old
ones.  This is a bit difficult to implement, but it's been done:
http://code.djangoproject.com/wiki/CustomUploadAndFilters

However, this ends up still saving this useless filename in your
database.  Why bother saving something you can intuit?  Ideally, I'd
like to have a model field for this that didn't even touch the
database.

example of what I'd like:
class UserProfile(Model):
  name = CharField(max_length=50)
  mugshot = FakeImageField(upload_to="user%d/
mug",max_width=200,max_height=200,resize="scale")
  background = FakeImageField(upload_to="user%d/
bg",max_width=200,max_height=200,resize="scale")
  some_file = FakeFileField(upload_to="user%d/file",max_size=1000)

Which would generate this sql, totally ignoring those fake fields:
CREATE TABLE "appname_userprofile" ("name" varchar(50) NOT NULL)

But we'd see file inputs when we displayed the ModelForm for this, and
end up with file uploads like "user42/mug.png" -- That is, it could
insert the pk into the pattern, and know exactly where to find out
file.

I've been futzing around trying to implement this.  I can get it to
subclass FileField but generate no sql pretty easily, just by saying
this:
def get_internal_type(self): return ''

However, it chokes when I try to save the modelform, because it tries
to insert values into non-existant database columns.  Somehow I also
need to tell the database cursor to ignore these fields.  Either that,
or I need to find a way to reverse-engineer a model field so that it
will be acceptable in a modelform, without it attempting to insert
anything into the database.

Here's an interesting code snippet that seems to sidestep the issue
entirely http://dpaste.com/49806/

Some final thoughts on the matter:  Oh crap -- the user could still
litter their directory with files that have different extensions --
for example, bg.png, bg.gif, bg.jpg, bg.jpeg, etc.  We may need to
implement a deleting feature after all.
--~--~-~--~~~---~--~~
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: Ignore query on views?

2008-05-13 Thread Romo

perfect! with _set and a for i can do what i was looking for!

thank you soo much!

On May 13, 9:16 am, Adi Jörg Sieker <[EMAIL PROTECTED]> wrote:
> On 13.05.2008, at 06:32, RoMo wrote:
>
>
>
> > I'm sorry for not understand what you were saying about the error with
> > get if i have more than 1 post lol... kinda silly I'm sorry...
>
> > Should I use .filter(Author=user)?
>
> filter is used to retrieve many records, get is used to retrieve 1  
> record.
>
> if your are working with a ForeignKey on your Post model like so:
>
> def Post(models.Model):
>         name = CharField()
>         author = model.ForgeinKey(Author)
>
> and user is an object of type Author then this should give you all the  
> Posts for one Author.
>
> user.post_set.all()
> and
> user.post_set.count() will give you number of posts of the user.
>
> all this information is in the docs 
> at:http://www.djangoproject.com/documentation/db-api/
>
> specificallyhttp://www.djangoproject.com/documentation/db-api/#related-objectsandhttp://www.djangoproject.com/documentation/db-api/#count
>
> adi
>
>
>
>
>
> > I tried with that and i get the next error:
>
> > Incorrect integer value: '[]' for column 'Author_id'
> > at row 1
>
> > On May 12, 12:40 pm, Romo <[EMAIL PROTECTED]> wrote:
> >> It works!!
>
> >> Thanks a lot for your help, Adi!
>
> >> cheers
>
> >> On May 12, 12:25 pm, Adi Jörg Sieker <[EMAIL PROTECTED]> wrote:
>
> >>> On 12.05.2008, at 18:57, RoMo wrote:
>
>  Hello guys!
>
>  First of all I don't know if I'm asking the right question, but  
>  i'll
>  try to explain myself the best I can:
>
>  I would like to know if in a view there is a way that after a  
>  "try:"
>  and evaluate the expression as false, it justs ignores that query  
>  and
>  display a message error, but keep loading everything else.
>
>  For example:
>
>  try:
>         posts = Post.objects.get(Author=user)
>     except Record.DoesNotExist:
>         //Missing code Here//
>
>  What I would like to do is: check if user has posted something,  
>  if he
>  hasn't just displays a "you haven't posted anything yet" where the
>  Post should be and it keeps loading everything else normally.
>
> >>> what about:
>
> >>> try:
> >>>         posts = Post.objects.get(Author=user)
> >>>         # btw get will raise an AssertionError if more than record  
> >>> is found.
> >>>         # i.e. if a user posted more than one post
> >>> except Record.DoesNotExist:
> >>>         posts = None
>
> >>> return RequestContext(foo,bar, {'posts' : posts})
>
> >>> and in your template:
>
> >>> {%if posts %}
> >>>         display the posts
> >>> {% else %}
> >>>         No haven't posted anything
> >>> {% endif %}
>
> >>> regards
> >>>    adi
>
> >>> --
> >>> Adi J. Sieker         mobile: +49 - 178 - 88 5 88 13
> >>> Freelance developer   skype:  adijsieker
> >>> SAP-Consultant        web:    http://www.sieker.info/profile
> >>>                        openbc:https://www.openbc.com/hp/
> >>> AdiJoerg_Sieker/
>
> --
> Adi J. Sieker         mobile: +49 - 178 - 88 5 88 13
> Freelance developer   skype:  adijsieker
> SAP-Consultant        web:    http://www.sieker.info/profile
>                        openbc:https://www.openbc.com/hp/
> AdiJoerg_Sieker/
--~--~-~--~~~---~--~~
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-ratings

2008-05-13 Thread David Cramer

I didn't see it until you linked it, but it also poses some of the
same limitations that django-voting has. I want an end-all solution,
that also fit's all the needs I've ever come up with :)

On May 13, 7:31 pm, "Alvaro Mouriño" <[EMAIL PROTECTED]> wrote:
> On Tue, May 13, 2008 at 11:23 PM, David Cramer <[EMAIL PROTECTED]> wrote:
>
> >  I'm building a new pluggable ratings app (django-voting doesn't come
> >  close to covering what my specs are). It's built around a similar
> >  architecture to what we used on Curse. What I'm looking for right now
> >  is feedback on my proposed API and 
> > usage:http://code.google.com/p/django-ratings/
>
> Did you try django-rating [0]?
>
> [0]http://django-rating.googlecode.com/
> --
> AlvArohttp://tuxie.debianuruguay.org/?page_id=110
--~--~-~--~~~---~--~~
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-ratings

2008-05-13 Thread Alvaro Mouriño

On Tue, May 13, 2008 at 11:23 PM, David Cramer <[EMAIL PROTECTED]> wrote:
>
>  I'm building a new pluggable ratings app (django-voting doesn't come
>  close to covering what my specs are). It's built around a similar
>  architecture to what we used on Curse. What I'm looking for right now
>  is feedback on my proposed API and usage: 
> http://code.google.com/p/django-ratings/
>
Did you try django-rating [0]?

[0] http://django-rating.googlecode.com/
-- 
AlvAro
http://tuxie.debianuruguay.org/?page_id=110

--~--~-~--~~~---~--~~
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 Auto-Incrementing Columns

2008-05-13 Thread David Cramer

In MySQL and PostgreSQL you can go into the database and modify the
auto increment sequence value to start at something else. There's no
way to set that via Django at the moment.

On May 13, 4:49 pm, jwwest <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Is there a way to create a column that has a unique id per row like
> id, but where I can specify the number it starts from? Basically I'm
> working on a ecommerce system and I would like the sales order numbers
> to start from say, 1000. I'd use ID, but as far as I know, it starts
> from 1.
>
> - James
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django-ratings

2008-05-13 Thread David Cramer

I'm building a new pluggable ratings app (django-voting doesn't come
close to covering what my specs are). It's built around a similar
architecture to what we used on Curse. What I'm looking for right now
is feedback on my proposed API and usage: 
http://code.google.com/p/django-ratings/

The solution, as I said, is built off of the same architecture that I
built for Curse, so it will be very scalable, and at the same time,
this should fit most needs for rating (whether you want a Digg clone,
a common review site, or the standard 5-star bunch).
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



problem with DateQuerySet

2008-05-13 Thread Eric Abrahamsen

I've got a perplexing problem that I don't even know where to start  
fixing. Creating a DateQuerySet for one of my models produces an empty  
list every time. Here's at the prompt:

 >>> apps = Appearance.objects.all()
 >>> for ap in apps:
... print ap.app_date
...
2009-02-11 09:00:00
2008-06-22 09:00:00
2008-03-09 12:30:00
2008-03-08 19:00:00
2008-03-06 19:30:00
2008-01-29 19:30:00
2007-11-08 19:30:00
2007-11-07 18:30:00

 >>> app_years = Appearance.objects.dates('app_date','year')
 >>> print app_years
[]

It does that for year, month and day. The app_date field for is  
nullable, but looking in the source a DateQuerySet seems to know to  
filter for null date fields (and there are currently no instances with  
null date values, anyway). I can't imagine what else could be  
affecting this, and don't even know where to start poking. I'm running  
r7520. If anyone could provide pointers...

Thanks,
Eric

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



Re: do sessions work when redirecting?

2008-05-13 Thread Juanjo Conti

On Tue, May 13, 2008 at 7:04 PM, Mike Chambers <[EMAIL PROTECTED]> wrote:
>
>  Anyone know why I cant store request.POST.copy() in the session?

Not sure way, but I save it as a regular dict like this:

request.session['POST'] = dict(request.POST.items())

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



Re: Problem with Deserializing JSON

2008-05-13 Thread Russell Keith-Magee

On Wed, May 14, 2008 at 5:11 AM, mwebs <[EMAIL PROTECTED]> wrote:
>
>  I get a String like this: "1,2,3"
...
>  I just get a valueError: Extra data: line 1 column 1 - line 1 column 5
>  (char 1 - 5)

"1,2,3" isn't a valid JSON data structure. However, "[1,2,3]" is a
list of integers.

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: Problem with Deserializing JSON

2008-05-13 Thread Russell Keith-Magee

On Wed, May 14, 2008 at 5:11 AM, mwebs <[EMAIL PROTECTED]> wrote:
>
>  Hello,
>
>  I have some problems deserializing a json.object. I am quite new in
>  using json, an I think the json is not formatted correctly.
>
>  When I print:
>
>  request.POST[elems]
>
>  I get a String like this: "1,2,3"
>
>  But when I try to to do
>
>  for elem in serializers.deserialize("json", data ):
>
>  I just get a valueError: Extra data: line 1 column 1 - line 1 column 5
>  (char 1 - 5)
>
>
>  Thank you.
>  Toni
>  >
>

--~--~-~--~~~---~--~~
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: loaddata .. columns app_label, model are not unique

2008-05-13 Thread Russell Keith-Magee

On Wed, May 14, 2008 at 1:09 AM, Carl Karsten <[EMAIL PROTECTED]> wrote:
>
>  [EMAIL PROTECTED]:~/dev/sites/ridgemoor$ ./manage.py loaddata rm.json
>  Installing json fixture 'rm' from absolute path.
>  Problem installing fixture 'rm.json': columns app_label, model are not unique
>
>  How do I debug this?

The error is telling you what is wrong - you are loading data into a
model that has a unique_together clause, but you are loading data that
is not unique together.

However, I can go a little further in this specific case - you have
contenttypes in your fixture.

Loading contenttypes by fixture is problematic because all the
contenttypes you will ever need are created automatically as part of
the syncdb. Consider the following sequence of events.

1. Create a project, populate INSTALLED_APPS, run syncdb.
2. Generate a fixture
3. Add a new application to INSTALLED APPS
4. Flush the database, rerun syncdb.
5. Attempt to load the fixture created in 2.

Since you changed the applications in INSTALLED_APPS in (3), the order
of the contenttypes created in 4 can change (and in your case, _has_
changed). As a result, the database IDs assigned to the content types
are not consistent, and when you load your fixture, you can end up
with two content type entries for the same content type.

The simple solution - don't serialize content types. You don't need to
anyway, because they are automatically created by the syncdb process.

The only catch on this is if you are using content types in some way,
and you need to serialize a reference to a content type. The most
likely reason for needing this is if you have a generic relation. In
this case, you are slightly stuck - you can't serialize the generic
relation without guaranteeing the IDs for the content types, but you
can't guarantee the IDs for the content types. This is a known issue,
http://code.djangoproject.com/ticket/7052.

The only workaround in the meantime is to regenerate or manually tweak
your fixtures every time you modify INSTALLED_APPS. The order in which
contenttypes are created is consistent if you never modify
INSTALLED_APPS, so as long as you are willing to update your fixtures
whenever you modify INSTALLED_APPS, it is possible to live with this
problem.

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: do sessions work when redirecting?

2008-05-13 Thread Mike Chambers

ok. more info on this. (Sorry about all of the emails, but I am really 
trying to track this down, and see if it is a bug).

If I try to include the request.POST data QueryDict in the session, then 
no session data is saved between requests (i.e. it wipes other session 
data):


request.session['form_post_data'] = request.POST.copy()
request.session['foo'] = "bar"

Then, in another request:

print request.session.keys()

prints []

But:

request.session['foo'] = "bar"

then in another request:

print request.session.keys()

prints ['foo']

So, at this point, Im thinking it is a bug.

mike


Mike Chambers wrote:
> I ended up getting this to work with (what feels like) a hack:
> 
> 
> To save the session:
> 
> -- 
> request.session['form_post_query_string'] = request.POST.urlencode()
> return HttpResponseRedirect(request.META['HTTP_REFERER'])
> -- 
> 
> 
> then to later access it and use it:
> 
> -- 
> from django.http import QueryDict
> 
> q = QueryDict(request.session['form_post_query_string'])
> comment_form = CommentForm(q)
> -- 
> 
> Anyone know why I cant store request.POST.copy() in the session?
> 
> Is that a bug?
> 
> mike
> 
> Mike Chambers wrote:
>> Thanks for the input.
>>
>> I am narrowing down the issue. Basically, If i try to place a copy of 
>> the request.POST data into the session, nothing will get stored:
>>
>> i.e.
>>
>> -- 
>> post_copy = request.POST.copy()
>> request.session['form_post_data'] = post_copy
>> return HttpResponseRedirect(request.META['HTTP_REFERER'])
>> -- 
>>
>> After this
>>
>> request.session.keys() returns [] (an empty list)
>>
>> if I do:
>>
>> post_copy = request.POST.copy()
>> request.session['form_post_data'] = post_copy
>> print request.session.get('form_post_data')
>> return HttpResponseRedirect(request.META['HTTP_REFERER'])
>>
>> this outputs:
>> -- 
>> > [u''], u'user_url': [u'']}>
>> -- 
>>
>> However, it it still not actually saved and available during a 
>> seperate request.
>>
>> mike
>>
>>
>> Rajesh Dhawan wrote:
>>>
>>>
>>> On May 13, 3:23 pm, Mike Chambers <[EMAIL PROTECTED]> wrote:
 I am running into an issue where my session values are not 
 remembered if
 I do an HTTP redirect.

 If I do:

 -- 
 request.session['a'] = ''
 return HttpResponseRedirect(request.META['HTTP_REFERER']
 -- 

 The session variable a will not be available once the browser is 
 redirected.

 If I do:

 -- 
 request.session['a'] = ''
 render_to_response(...)
 -- 

 Then the session is available as expected.

 I have tried to set:

 request.session.modified = True

 but that does not change the behavior.

 Can session variables be set when doing a redirect?
>>>
>>> Absolutely.
>>>
>>> You should ensure that request.META['HTTP_REFERER'] doesn't redirect
>>> to a different domain name that happens to map to the same
>>> application. For example, if you set the session in a view at
>>> http://127.0.0.1/myview/ and that view redirects to 
>>> http://localhost/myview2/,
>>> you will not be able to access the previous session.
>>
>>>

--~--~-~--~~~---~--~~
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 Auto-Incrementing Columns

2008-05-13 Thread jwwest

Hi all,

Is there a way to create a column that has a unique id per row like
id, but where I can specify the number it starts from? Basically I'm
working on a ecommerce system and I would like the sales order numbers
to start from say, 1000. I'd use ID, but as far as I know, it starts
from 1.

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



Re: Having a Many-to-One relationship with multiple other models

2008-05-13 Thread Michael Burton

I started composing a reply to your response, and then realized that I
had erroneously constructed a mental one-to-one model of the
relationship rather than one-to-many.  You're absolutely right, what I
was trying to do doesn't make any sense.  Whoops :)

Mike




On May 13, 2:28 pm, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> Michael, I think I understand what you're getting at, given your comment
> referring to the "unnecessary table and associated join".  I think you want
> to be able to say "ManyToOneField" in Place and have it reach back into the
> Photo model and insert a NULLable "place_id" column.  That's problematic for
> several reasons:
>
>    1. The Photo model is no longer self-contained.  You can't look at the
>    model and infer the table layout.  So, for example, you can't just syncdb 
> on
>    the Photo model's application and get the table you want.  Without 
> knowledge
>    of other applications (potentially in other projects!) you don't know what
>    the table will look like.
>    2. It produces inelegant tables at best (I'm too lazy to confirm
>    whether it actually violates any normalization rules).  If you have many
>    models referring to Photo in this way, it will have equally many columns,
>    most of which will be NULL in any case.
>
> If you want it to work this way, I think it is best that you are explicit
> about the presence of the foreign keys and code ForeignKey(x, null=True)
> within the Photo model.  But if you want the "directionality" to go the way
> you indicate, I do think it is correct and more elegant to have the
> intermediate join table.
>
>   -- Scott
>
>
>
> On Tue, May 13, 2008 at 3:41 PM, Michael Burton <[EMAIL PROTECTED]> wrote:
>
> > Sure.  OOM relationships can typically be broken down along two
> > dimensions: cardinality and directionality.
>
> > cardinality:      DIRECTIONALITY
> > --
> > One-to-one:       ONE-WAY, BI-WAY
> > One-to-many:      ONE-WAY, BI-WAY
> > Many-to-many:     ONE-WAY, BI-WAY
>
> > The cardinality is pretty obvious, it's just one-to-one, one-to-many,
> > or many-to-many, as we'd all expect.  Django assumes that all
> > relationships are bi-directional, meaning that if there's a
> > relationship between A and B then you can access that relationship
> > from A and you can also access it from B.
>
> > However, in some cases (like the one I originally asked the question
> > about), it's useful to have a one-way relationship, such that you can
> > access B from A, but not the other way around.  In this case, the
> > directionality would be one-way.
>
> > I'm making up all the terminology here, but hopefully the idea comes
> > across.  Django assumes bidirectionality[1], but it would be nice to
> > be able to make uni-directional relationships for those cases, like
> > Photo, where the photo can be owned by multiple different models in a
> > one-to-many way.
>
> > To keep the models clean my plan is to use your many-to-many
> > suggestion, but it does result in an unnecessary table and associated
> > join, which is a bummer but tolerable.
>
> > Thanks again,
> > Mike
>
> > [1] From
> >http://www.djangoproject.com/documentation/db-api/#how-are-the-backwa...
> > :
> > "Other object-relational mappers require you to define relationships
> > on both sides. The Django developers believe this is a violation of
> > the DRY (Don't Repeat Yourself) principle, so Django only requires you
> > to define the relationship on one end."
>
> > On May 13, 12:03 pm, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> > > Michael, can you elaborate on what you mean by "forcing bi-directional
> > > relationships"?
>
> > > The ManyToManyField approach really is, I think, the "right" way to do
> > it.
> > > If you think about it, a hypothetical ManyToOneField in your case would
> > work
> > > almost exactly like the ManyToManyField.  The join table would be
> > structured
> > > exactly the same, except it would have an additional UNIQUE(photo_id)
> > > qualifier.
>
> > >   -- Scott
>
> > > On Tue, May 13, 2008 at 2:56 PM, Michael Burton <[EMAIL PROTECTED]>
> > wrote:
>
> > > > Thanks much, Scott.  They both seem a bit hacky, but it gives me
> > > > something to work with anyway.
>
> > > > I recognize the motivation for forcing bi-directional relationships in
> > > > Django was done to keep things DRY[1], but does anyone know if there's
> > > > been any discussion about maybe relaxing this constraint?  Seems a
> > > > little restrictive, and I don't think most other web frameworks go
> > > > this route for that very reason...
>
> > > > Mike
>
> > > > [1]
> > > >http://www.djangoproject.com/documentation/db-api/#how-are-the-backwa.
> > ..
>
> > > > On May 13, 11:32 am, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> > > > > Michael, you have two alternatives:
>
> > > > >    1. Create ManyToManyField fields in the UserProfile and Place
> > models,
> > > > >    pointing to Photo.  "ManyToManyField" may seem a bit odd since
> > you
> > > 

Search Result Pagination

2008-05-13 Thread Michael Ellis

Hello all. I'm having trouble getting pagination working on search
results in a custom view.

I have djapian/xapian full-text indexing working and I have some
pagination code cobbled together from various sources. I can get the
search results and all the pagination (result count, page x of y, etc)
happening on my template, but I'm getting ALL the search results on
the the first page even if I paginate by 1. Also, if I click to page
two, I get nothing but the blank search form.

I'm pretty sure the problem lies in my views.py (below). Any help
would be appreciated.

views.py--

from myproject.Catalog.models import Product_index
from xapian import QueryParser
from django import newforms as forms
from django.core.paginator import Paginator, InvalidPage
from django.template.context import RequestContext, Context
from django.core.context_processors import request
from django.http import Http404

class SearchForm(forms.Form):
query = forms.CharField(label="")

def search(request):
if request.method == 'POST':
query = request.POST.get('query')
f = SearchForm(request.POST)
search_flags = QueryParser.FLAG_PHRASE | 
QueryParser.FLAG_BOOLEAN
results = Product_index.search(query, flags=search_flags)

paginator = Paginator(results, 1)

try:
pager = int(request.GET.get('pager', '1'))
results = paginator.page(pager)

except InvalidPage:
raise Http404

return render_to_response('Catalog/search.html', {
'paginator': paginator,
'results': results,
'form': f,
'is_paginated': paginator.num_pages > 1,
'has_next': results.has_next(),
'has_previous': results.has_previous(),
'current_page': pager,
'next_page': pager + 1,
'previous_page': pager - 1,
'pages': paginator.num_pages,
'count' : paginator.count,
},
context_instance = RequestContext(request))

else:
f = SearchForm()
return render_to_response('Catalog/search.html', {'form': f})

end views.py--

urls.py--
...
urlpatterns = patterns('',
(r'^Catalog/search/$','myproject.Catalog.views.search'),
)

end urls.py


Let me know if there's any other relevant info I should add to this
post.

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



Re: do sessions work when redirecting?

2008-05-13 Thread Mike Chambers

I ended up getting this to work with (what feels like) a hack:


To save the session:

--
request.session['form_post_query_string'] = request.POST.urlencode()
return HttpResponseRedirect(request.META['HTTP_REFERER'])
--


then to later access it and use it:

--
from django.http import QueryDict

q = QueryDict(request.session['form_post_query_string'])
comment_form = CommentForm(q)
--

Anyone know why I cant store request.POST.copy() in the session?

Is that a bug?

mike

Mike Chambers wrote:
> Thanks for the input.
> 
> I am narrowing down the issue. Basically, If i try to place a copy of 
> the request.POST data into the session, nothing will get stored:
> 
> i.e.
> 
> -- 
> post_copy = request.POST.copy()
> request.session['form_post_data'] = post_copy
> return HttpResponseRedirect(request.META['HTTP_REFERER'])
> -- 
> 
> After this
> 
> request.session.keys() returns [] (an empty list)
> 
> if I do:
> 
> post_copy = request.POST.copy()
> request.session['form_post_data'] = post_copy
> print request.session.get('form_post_data')
> return HttpResponseRedirect(request.META['HTTP_REFERER'])
> 
> this outputs:
> -- 
>  [u''], u'user_url': [u'']}>
> -- 
> 
> However, it it still not actually saved and available during a seperate 
> request.
> 
> mike
> 
> 
> Rajesh Dhawan wrote:
>>
>>
>> On May 13, 3:23 pm, Mike Chambers <[EMAIL PROTECTED]> wrote:
>>> I am running into an issue where my session values are not remembered if
>>> I do an HTTP redirect.
>>>
>>> If I do:
>>>
>>> -- 
>>> request.session['a'] = ''
>>> return HttpResponseRedirect(request.META['HTTP_REFERER']
>>> -- 
>>>
>>> The session variable a will not be available once the browser is 
>>> redirected.
>>>
>>> If I do:
>>>
>>> -- 
>>> request.session['a'] = ''
>>> render_to_response(...)
>>> -- 
>>>
>>> Then the session is available as expected.
>>>
>>> I have tried to set:
>>>
>>> request.session.modified = True
>>>
>>> but that does not change the behavior.
>>>
>>> Can session variables be set when doing a redirect?
>>
>> Absolutely.
>>
>> You should ensure that request.META['HTTP_REFERER'] doesn't redirect
>> to a different domain name that happens to map to the same
>> application. For example, if you set the session in a view at
>> http://127.0.0.1/myview/ and that view redirects to 
>> http://localhost/myview2/,
>> you will not be able to access the previous session.
> 
>>

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



Re: do sessions work when redirecting?

2008-05-13 Thread Mike Chambers

Thanks for the input.

I am narrowing down the issue. Basically, If i try to place a copy of 
the request.POST data into the session, nothing will get stored:

i.e.

--
post_copy = request.POST.copy()
request.session['form_post_data'] = post_copy
return HttpResponseRedirect(request.META['HTTP_REFERER'])
--

After this

request.session.keys() returns [] (an empty list)

if I do:

post_copy = request.POST.copy()
request.session['form_post_data'] = post_copy
print request.session.get('form_post_data')
return HttpResponseRedirect(request.META['HTTP_REFERER'])

this outputs:
--

--

However, it it still not actually saved and available during a seperate 
request.

mike


Rajesh Dhawan wrote:
> 
> 
> On May 13, 3:23 pm, Mike Chambers <[EMAIL PROTECTED]> wrote:
>> I am running into an issue where my session values are not remembered if
>> I do an HTTP redirect.
>>
>> If I do:
>>
>> --
>> request.session['a'] = ''
>> return HttpResponseRedirect(request.META['HTTP_REFERER']
>> --
>>
>> The session variable a will not be available once the browser is redirected.
>>
>> If I do:
>>
>> --
>> request.session['a'] = ''
>> render_to_response(...)
>> --
>>
>> Then the session is available as expected.
>>
>> I have tried to set:
>>
>> request.session.modified = True
>>
>> but that does not change the behavior.
>>
>> Can session variables be set when doing a redirect?
> 
> Absolutely.
> 
> You should ensure that request.META['HTTP_REFERER'] doesn't redirect
> to a different domain name that happens to map to the same
> application. For example, if you set the session in a view at
> http://127.0.0.1/myview/ and that view redirects to http://localhost/myview2/,
> you will not be able to access the previous session.

> 

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



Re: Problem with Deserializing JSON

2008-05-13 Thread mwebs

Hi,

its just the same error when using django.utils.simplejson.

any idea, whats going wrong?

On 13 Mai, 23:30, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> On May 13, 5:11 pm, mwebs <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello,
>
> > I have some problems deserializing a json.object. I am quite new in
> > using json, an I think the json is not formatted correctly.
>
> > When I print:
>
> > request.POST[elems]
>
> > I get a String like this: "1,2,3"
>
> > But when I try to to do
>
> > for elem in serializers.deserialize("json", data ):
>
> > I just get a valueError: Extra data: line 1 column 1 - line 1 column 5
> > (char 1 - 5)
>
> django.core.serializers.* are meant for serializing Django model
> objects.
>
> If you want to work with primitive objects, just use
> django.utils.simplejson directly. Something like:
>
> from django.utils import simplejson
> for elem in simplejson.loads("[1, 2, 3]")
--~--~-~--~~~---~--~~
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: Login & Cookie problems

2008-05-13 Thread mamcxyz

For clarification, I use the auth default views and this is my form
code:



Usuario

Clave


   
   


Ingresar 





In urls:

url(r'^login/$', 'login', {'template_name': 'core/login.html'},
name="login"),
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Login & Cookie problems

2008-05-13 Thread mamcxyz

Hi,

I discover & reproduce a problem in the login for my site 
www.paradondevamos.com.

The first time when a user try to login, always "fail", and return
back to the login page. If try the second time, work fine.

If try the frist time, close the browser, and try again, work.

If then logout, close the browser, try again fail.

This happend in both firefox 2.0.0.14 & IE 7, and in the dev server &
apache with mod-python.

However, and that is the strange thing, when I enter the admin site
work just fine, so I get wonder why is happend this way.

I also set directly the

SESSION_COOKIE_DOMAIN

as  '.localhost' & '127.0.0.1' & 'localhost:8000'.

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



Re: Problem with Deserializing JSON

2008-05-13 Thread Rajesh Dhawan



On May 13, 5:11 pm, mwebs <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have some problems deserializing a json.object. I am quite new in
> using json, an I think the json is not formatted correctly.
>
> When I print:
>
> request.POST[elems]
>
> I get a String like this: "1,2,3"
>
> But when I try to to do
>
> for elem in serializers.deserialize("json", data ):
>
> I just get a valueError: Extra data: line 1 column 1 - line 1 column 5
> (char 1 - 5)

django.core.serializers.* are meant for serializing Django model
objects.

If you want to work with primitive objects, just use
django.utils.simplejson directly. Something like:

from django.utils import simplejson
for elem in simplejson.loads("[1, 2, 3]")

--~--~-~--~~~---~--~~
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: Having a Many-to-One relationship with multiple other models

2008-05-13 Thread Scott Moonen
Michael, I think I understand what you're getting at, given your comment
referring to the "unnecessary table and associated join".  I think you want
to be able to say "ManyToOneField" in Place and have it reach back into the
Photo model and insert a NULLable "place_id" column.  That's problematic for
several reasons:

   1. The Photo model is no longer self-contained.  You can't look at the
   model and infer the table layout.  So, for example, you can't just syncdb on
   the Photo model's application and get the table you want.  Without knowledge
   of other applications (potentially in other projects!) you don't know what
   the table will look like.
   2. It produces inelegant tables at best (I'm too lazy to confirm
   whether it actually violates any normalization rules).  If you have many
   models referring to Photo in this way, it will have equally many columns,
   most of which will be NULL in any case.

If you want it to work this way, I think it is best that you are explicit
about the presence of the foreign keys and code ForeignKey(x, null=True)
within the Photo model.  But if you want the "directionality" to go the way
you indicate, I do think it is correct and more elegant to have the
intermediate join table.

  -- Scott

On Tue, May 13, 2008 at 3:41 PM, Michael Burton <[EMAIL PROTECTED]> wrote:

>
> Sure.  OOM relationships can typically be broken down along two
> dimensions: cardinality and directionality.
>
> cardinality:  DIRECTIONALITY
> --
> One-to-one:   ONE-WAY, BI-WAY
> One-to-many:  ONE-WAY, BI-WAY
> Many-to-many: ONE-WAY, BI-WAY
>
>
> The cardinality is pretty obvious, it's just one-to-one, one-to-many,
> or many-to-many, as we'd all expect.  Django assumes that all
> relationships are bi-directional, meaning that if there's a
> relationship between A and B then you can access that relationship
> from A and you can also access it from B.
>
> However, in some cases (like the one I originally asked the question
> about), it's useful to have a one-way relationship, such that you can
> access B from A, but not the other way around.  In this case, the
> directionality would be one-way.
>
> I'm making up all the terminology here, but hopefully the idea comes
> across.  Django assumes bidirectionality[1], but it would be nice to
> be able to make uni-directional relationships for those cases, like
> Photo, where the photo can be owned by multiple different models in a
> one-to-many way.
>
> To keep the models clean my plan is to use your many-to-many
> suggestion, but it does result in an unnecessary table and associated
> join, which is a bummer but tolerable.
>
> Thanks again,
> Mike
>
> [1] From
> http://www.djangoproject.com/documentation/db-api/#how-are-the-backward-relationships-possible
> :
> "Other object-relational mappers require you to define relationships
> on both sides. The Django developers believe this is a violation of
> the DRY (Don't Repeat Yourself) principle, so Django only requires you
> to define the relationship on one end."
>
>
> On May 13, 12:03 pm, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> > Michael, can you elaborate on what you mean by "forcing bi-directional
> > relationships"?
> >
> > The ManyToManyField approach really is, I think, the "right" way to do
> it.
> > If you think about it, a hypothetical ManyToOneField in your case would
> work
> > almost exactly like the ManyToManyField.  The join table would be
> structured
> > exactly the same, except it would have an additional UNIQUE(photo_id)
> > qualifier.
> >
> >   -- Scott
> >
> >
> >
> > On Tue, May 13, 2008 at 2:56 PM, Michael Burton <[EMAIL PROTECTED]>
> wrote:
> >
> > > Thanks much, Scott.  They both seem a bit hacky, but it gives me
> > > something to work with anyway.
> >
> > > I recognize the motivation for forcing bi-directional relationships in
> > > Django was done to keep things DRY[1], but does anyone know if there's
> > > been any discussion about maybe relaxing this constraint?  Seems a
> > > little restrictive, and I don't think most other web frameworks go
> > > this route for that very reason...
> >
> > > Mike
> >
> > > [1]
> > >http://www.djangoproject.com/documentation/db-api/#how-are-the-backwa.
> ..
> >
> > > On May 13, 11:32 am, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> > > > Michael, you have two alternatives:
> >
> > > >1. Create ManyToManyField fields in the UserProfile and Place
> models,
> > > >pointing to Photo.  "ManyToManyField" may seem a bit odd since
> you
> > > really
> > > >have a many-to-one relation, but it will work as you expect,
> creating
> > > a join
> > > >table connecting each pair of models.
> > > >2. Create two ForeignKey fields in Photo, one to UserProfile and
> one
> > > >to Photo, with null=True.  Yes, this is a bit ugly. :)
> >
> > > >   -- Scott
> >
> > > > On Tue, May 13, 2008 at 2:24 PM, Michael Burton <[EMAIL PROTECTED]>
> > > wrote:
> >
> > > > > I have some Places and I 

Re: How to make a LEFT JOIN

2008-05-13 Thread [EMAIL PROTECTED]

This following patch resolve this problem and can add other
possibilities:

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

Please, test this patch if you are interested in joins and/or in
models translation.

If this feature is interesting for someone I could try to write some
standard join functions, like filter(), for the Django ORM.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: auto admin for production

2008-05-13 Thread Jeff Anderson

rcs_comp wrote:

Jeff,

Any chance you would be willing to post the code for your in-house
ticketing system?  I have need for a similar application.
  
I'd have to ask my boss, but he'd probably allow it. I'll let you know 
off list.


We wrote our own because we had some strange requirements for a ticket 
system.


I did write a maintenance tracking system for my apartment complex. I'd 
be happy to post the code for that, but its very very simple, and a bit 
messy in some places.

Thanks and not hard feelings if you can't.
  

I'll let you know!

Jeff Anderson



signature.asc
Description: OpenPGP digital signature


Re: url tutorial problem

2008-05-13 Thread Jeff Anderson
Hello!

sebey wrote:
> on the index page I get this:
>
> Page not found (404)
> Request Method:   GET
> Request URL:  http://localhost:8000/
>
> Using the URLconf defined in ubertester.urls, Django tried these URL
> patterns, in this order:
>
>1. ^admin/
>2. ^polls/$
>3. ^polls/(?P\d+)/$
>4. ^polls/(?P\d+)/results/$
>5. ^polls/(?P\d+)/vote/$
>
> The current URL, /, didn't match any of these.
>
>   
This is correct. You don't have any views defined for / in your urls.py,
so of course it returns a 404.
> then on the /polls view I get this
>
> ViewDoesNotExist at /polls/
> Could not import mysite.polls.views. Error was: No module named
> mysite.polls.views
> Request Method:   GET
> Request URL:  http://localhost:8000/polls/
> Exception Type:   ViewDoesNotExist
> Exception Value:  Could not import mysite.polls.views. Error was: No
> module named mysite.polls.views
> Exception Location:   /Library/Frameworks/Python.framework/Versions/2.5/
> lib/python2.5/site-packages/django/core/urlresolvers.py in
> _get_callback, line 127
>   

> what is going on?
>   
The error message says that the mysite.polls.views module doesn't exist.
Do you have views.py in your polls directory?

Your file tree should look something like this:

mysite/
mysite/settings.py
mysite/urls.py
mysite/polls/
mysite/polls/models.py
mysite/polls/views.py

The last line is the one to pay attention to. If you don't have the
views.py in the right place, then it won't find it, and it will produce
the error that you pasted.

Hopefully this is helpful!



signature.asc
Description: OpenPGP digital signature


Re: Thread-safe or not?

2008-05-13 Thread TP

How about specifically whether mod_wsgi can be used to run many
threads serving web requests for Django?


On May 13, 5:13 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> On May 13, 2:52 pm, Goodrone <[EMAIL PROTECTED]> wrote:
>
> > What is the most up-to-date information about multithread safety in
> > Django? Is it a good idea to spawn several threads and use models from
> > there?
>
> Several threads within one request/view?
--~--~-~--~~~---~--~~
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: Thread-safe or not?

2008-05-13 Thread Rajesh Dhawan



On May 13, 2:52 pm, Goodrone <[EMAIL PROTECTED]> wrote:
> What is the most up-to-date information about multithread safety in
> Django? Is it a good idea to spawn several threads and use models from
> there?

Several threads within one request/view?

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



Re: do sessions work when redirecting?

2008-05-13 Thread Rajesh Dhawan



On May 13, 3:23 pm, Mike Chambers <[EMAIL PROTECTED]> wrote:
> I am running into an issue where my session values are not remembered if
> I do an HTTP redirect.
>
> If I do:
>
> --
> request.session['a'] = ''
> return HttpResponseRedirect(request.META['HTTP_REFERER']
> --
>
> The session variable a will not be available once the browser is redirected.
>
> If I do:
>
> --
> request.session['a'] = ''
> render_to_response(...)
> --
>
> Then the session is available as expected.
>
> I have tried to set:
>
> request.session.modified = True
>
> but that does not change the behavior.
>
> Can session variables be set when doing a redirect?

Absolutely.

You should ensure that request.META['HTTP_REFERER'] doesn't redirect
to a different domain name that happens to map to the same
application. For example, if you set the session in a view at
http://127.0.0.1/myview/ and that view redirects to http://localhost/myview2/,
you will not be able to access the previous session.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem with Deserializing JSON

2008-05-13 Thread mwebs

Hello,

I have some problems deserializing a json.object. I am quite new in
using json, an I think the json is not formatted correctly.

When I print:

request.POST[elems]

I get a String like this: "1,2,3"

But when I try to to do

for elem in serializers.deserialize("json", data ):

I just get a valueError: Extra data: line 1 column 1 - line 1 column 5
(char 1 - 5)


Thank you.
Toni
--~--~-~--~~~---~--~~
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: Formset from newforms-admin

2008-05-13 Thread [EMAIL PROTECTED]

While not official, brosner(an NFA commiter) has started working on
some NFA docs: http://github.com/brosner/django/commits/nfa_docs

On May 13, 11:33 am, "Ramdas S" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Can someone kindly explain how you can use the formsets from new-admin
> trunk? Is there some kind of an example?
>
> Ramdas
--~--~-~--~~~---~--~~
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: Having a Many-to-One relationship with multiple other models

2008-05-13 Thread Richard Dahl

A third alternative is to use a GenericForeignKey. Although this may
add too much complexity.  Put the GenericForeignKey in a model called
PhotoTag and create a M2M relationship between it and Photo and use it
to select either a Place or a UserProfile, i.e.

class PhotoTag(models.Model)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
tag_object = generic.GenericForeignKey('content_type', 'object_id')

class Meta:
unique_together = ('content_type', 'object_id')

I use this in a similar, but far more complex situation.  I have
overidden the save in my relevant models (in this case UserProfile and
Place) to automatically create the the PhotoTag object when creating
new objects.
-richard


On 5/13/08, Scott Moonen <[EMAIL PROTECTED]> wrote:
> Michael, you have two alternatives:
>
> Create ManyToManyField fields in the UserProfile and Place models, pointing
> to Photo.  "ManyToManyField" may seem a bit odd since you really have a
> many-to-one relation, but it will work as you expect, creating a join table
> connecting each pair of models.
> Create two ForeignKey fields in Photo, one to UserProfile and one to Photo,
> with null=True.  Yes, this is a bit ugly. :)
>   -- Scott
>
> On Tue, May 13, 2008 at 2:24 PM, Michael Burton <[EMAIL PROTECTED]> wrote:
> >
> > I have some Places and I have some Users in my database.  I'd like to
> > be able to associate some Photos with each.
> >
> >  class Photo(models.Model):
> ># a model that represents a photo
> >
> >  class UserProfile(models.Model):
> ># has a list of Photos
> >
> >  class Place(models.Model):
> ># has a list of Photos
> >
> >
> > Normally, if i were using another ORM framework, I would make my Place
> > have a list of photos, and I'd make my UserProfile have a list of
> > photos, and I'd leave my Photo model alone.  However, the Django way
> > of doing things requires that I put a ForeignKey into my Photo model
> > to establish the one-to-many.
> >
> > The problem is, sometimes Photo's ForeignKey will point to a
> > UserProfile and sometimes to an Place.  How can I have both my
> > UserProfile and Place models point to Photos?
> >
> > Thanks in advance,
> > Mike
> >
> >
>
>
>
> --
> http://scott.andstuff.org/ | http://truthadorned.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: Having a Many-to-One relationship with multiple other models

2008-05-13 Thread Michael Burton

Sure.  OOM relationships can typically be broken down along two
dimensions: cardinality and directionality.

cardinality:  DIRECTIONALITY
--
One-to-one:   ONE-WAY, BI-WAY
One-to-many:  ONE-WAY, BI-WAY
Many-to-many: ONE-WAY, BI-WAY


The cardinality is pretty obvious, it's just one-to-one, one-to-many,
or many-to-many, as we'd all expect.  Django assumes that all
relationships are bi-directional, meaning that if there's a
relationship between A and B then you can access that relationship
from A and you can also access it from B.

However, in some cases (like the one I originally asked the question
about), it's useful to have a one-way relationship, such that you can
access B from A, but not the other way around.  In this case, the
directionality would be one-way.

I'm making up all the terminology here, but hopefully the idea comes
across.  Django assumes bidirectionality[1], but it would be nice to
be able to make uni-directional relationships for those cases, like
Photo, where the photo can be owned by multiple different models in a
one-to-many way.

To keep the models clean my plan is to use your many-to-many
suggestion, but it does result in an unnecessary table and associated
join, which is a bummer but tolerable.

Thanks again,
Mike

[1] From 
http://www.djangoproject.com/documentation/db-api/#how-are-the-backward-relationships-possible:
"Other object-relational mappers require you to define relationships
on both sides. The Django developers believe this is a violation of
the DRY (Don’t Repeat Yourself) principle, so Django only requires you
to define the relationship on one end."


On May 13, 12:03 pm, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> Michael, can you elaborate on what you mean by "forcing bi-directional
> relationships"?
>
> The ManyToManyField approach really is, I think, the "right" way to do it.
> If you think about it, a hypothetical ManyToOneField in your case would work
> almost exactly like the ManyToManyField.  The join table would be structured
> exactly the same, except it would have an additional UNIQUE(photo_id)
> qualifier.
>
>   -- Scott
>
>
>
> On Tue, May 13, 2008 at 2:56 PM, Michael Burton <[EMAIL PROTECTED]> wrote:
>
> > Thanks much, Scott.  They both seem a bit hacky, but it gives me
> > something to work with anyway.
>
> > I recognize the motivation for forcing bi-directional relationships in
> > Django was done to keep things DRY[1], but does anyone know if there's
> > been any discussion about maybe relaxing this constraint?  Seems a
> > little restrictive, and I don't think most other web frameworks go
> > this route for that very reason...
>
> > Mike
>
> > [1]
> >http://www.djangoproject.com/documentation/db-api/#how-are-the-backwa...
>
> > On May 13, 11:32 am, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> > > Michael, you have two alternatives:
>
> > >    1. Create ManyToManyField fields in the UserProfile and Place models,
> > >    pointing to Photo.  "ManyToManyField" may seem a bit odd since you
> > really
> > >    have a many-to-one relation, but it will work as you expect, creating
> > a join
> > >    table connecting each pair of models.
> > >    2. Create two ForeignKey fields in Photo, one to UserProfile and one
> > >    to Photo, with null=True.  Yes, this is a bit ugly. :)
>
> > >   -- Scott
>
> > > On Tue, May 13, 2008 at 2:24 PM, Michael Burton <[EMAIL PROTECTED]>
> > wrote:
>
> > > > I have some Places and I have some Users in my database.  I'd like to
> > > > be able to associate some Photos with each.
>
> > > >  class Photo(models.Model):
> > > >    # a model that represents a photo
>
> > > >  class UserProfile(models.Model):
> > > >    # has a list of Photos
>
> > > >  class Place(models.Model):
> > > >    # has a list of Photos
>
> > > > Normally, if i were using another ORM framework, I would make my Place
> > > > have a list of photos, and I'd make my UserProfile have a list of
> > > > photos, and I'd leave my Photo model alone.  However, the Django way
> > > > of doing things requires that I put a ForeignKey into my Photo model
> > > > to establish the one-to-many.
>
> > > > The problem is, sometimes Photo's ForeignKey will point to a
> > > > UserProfile and sometimes to an Place.  How can I have both my
> > > > UserProfile and Place models point to Photos?
>
> > > > Thanks in advance,
> > > > Mike
>
> > > --http://scott.andstuff.org/|http://truthadorned.org/
>
> --http://scott.andstuff.org/|http://truthadorned.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
-~--~~~~--~~--~--~---



Django meetup at Linuxtag 2008

2008-05-13 Thread Jannis Leidel

Hi list,

I'm going to attend this year's Linuxtag [x] in Berlin (May 28 - 31)
and wonder if there are other Djangonauts interested in an informal
meetup. I'm sure there are plenty of places to meet so let me know if
you want to join..

Cheers,
Jannis

x: http://www.linuxtag.org/2008/

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



do sessions work when redirecting?

2008-05-13 Thread Mike Chambers

I am running into an issue where my session values are not remembered if 
I do an HTTP redirect.

If I do:

--
request.session['a'] = ''
return HttpResponseRedirect(request.META['HTTP_REFERER']
--

The session variable a will not be available once the browser is redirected.

If I do:

--
request.session['a'] = ''
render_to_response(...)
--

Then the session is available as expected.

I have tried to set:

request.session.modified = True

but that does not change the behavior.

Can session variables be set when doing a redirect?


mike


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



Re: Having a Many-to-One relationship with multiple other models

2008-05-13 Thread Scott Moonen
Michael, can you elaborate on what you mean by "forcing bi-directional
relationships"?

The ManyToManyField approach really is, I think, the "right" way to do it.
If you think about it, a hypothetical ManyToOneField in your case would work
almost exactly like the ManyToManyField.  The join table would be structured
exactly the same, except it would have an additional UNIQUE(photo_id)
qualifier.

  -- Scott

On Tue, May 13, 2008 at 2:56 PM, Michael Burton <[EMAIL PROTECTED]> wrote:

>
> Thanks much, Scott.  They both seem a bit hacky, but it gives me
> something to work with anyway.
>
> I recognize the motivation for forcing bi-directional relationships in
> Django was done to keep things DRY[1], but does anyone know if there's
> been any discussion about maybe relaxing this constraint?  Seems a
> little restrictive, and I don't think most other web frameworks go
> this route for that very reason...
>
> Mike
>
> [1]
> http://www.djangoproject.com/documentation/db-api/#how-are-the-backward-relationships-possible
>
>
>
>
> On May 13, 11:32 am, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> > Michael, you have two alternatives:
> >
> >1. Create ManyToManyField fields in the UserProfile and Place models,
> >pointing to Photo.  "ManyToManyField" may seem a bit odd since you
> really
> >have a many-to-one relation, but it will work as you expect, creating
> a join
> >table connecting each pair of models.
> >2. Create two ForeignKey fields in Photo, one to UserProfile and one
> >to Photo, with null=True.  Yes, this is a bit ugly. :)
> >
> >   -- Scott
> >
> >
> >
> > On Tue, May 13, 2008 at 2:24 PM, Michael Burton <[EMAIL PROTECTED]>
> wrote:
> >
> > > I have some Places and I have some Users in my database.  I'd like to
> > > be able to associate some Photos with each.
> >
> > >  class Photo(models.Model):
> > ># a model that represents a photo
> >
> > >  class UserProfile(models.Model):
> > ># has a list of Photos
> >
> > >  class Place(models.Model):
> > ># has a list of Photos
> >
> > > Normally, if i were using another ORM framework, I would make my Place
> > > have a list of photos, and I'd make my UserProfile have a list of
> > > photos, and I'd leave my Photo model alone.  However, the Django way
> > > of doing things requires that I put a ForeignKey into my Photo model
> > > to establish the one-to-many.
> >
> > > The problem is, sometimes Photo's ForeignKey will point to a
> > > UserProfile and sometimes to an Place.  How can I have both my
> > > UserProfile and Place models point to Photos?
> >
> > > Thanks in advance,
> > > Mike
> >
> > --http://scott.andstuff.org/|http://truthadorned.org/
> >
>


-- 
http://scott.andstuff.org/ | http://truthadorned.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: Many-to-many relationship on self - inherited model

2008-05-13 Thread Gollum

Please, someone, I need help very much!
--~--~-~--~~~---~--~~
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: Having a Many-to-One relationship with multiple other models

2008-05-13 Thread Michael Burton

Thanks much, Scott.  They both seem a bit hacky, but it gives me
something to work with anyway.

I recognize the motivation for forcing bi-directional relationships in
Django was done to keep things DRY[1], but does anyone know if there's
been any discussion about maybe relaxing this constraint?  Seems a
little restrictive, and I don't think most other web frameworks go
this route for that very reason...

Mike

[1] 
http://www.djangoproject.com/documentation/db-api/#how-are-the-backward-relationships-possible




On May 13, 11:32 am, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> Michael, you have two alternatives:
>
>    1. Create ManyToManyField fields in the UserProfile and Place models,
>    pointing to Photo.  "ManyToManyField" may seem a bit odd since you really
>    have a many-to-one relation, but it will work as you expect, creating a 
> join
>    table connecting each pair of models.
>    2. Create two ForeignKey fields in Photo, one to UserProfile and one
>    to Photo, with null=True.  Yes, this is a bit ugly. :)
>
>   -- Scott
>
>
>
> On Tue, May 13, 2008 at 2:24 PM, Michael Burton <[EMAIL PROTECTED]> wrote:
>
> > I have some Places and I have some Users in my database.  I'd like to
> > be able to associate some Photos with each.
>
> >  class Photo(models.Model):
> >    # a model that represents a photo
>
> >  class UserProfile(models.Model):
> >    # has a list of Photos
>
> >  class Place(models.Model):
> >    # has a list of Photos
>
> > Normally, if i were using another ORM framework, I would make my Place
> > have a list of photos, and I'd make my UserProfile have a list of
> > photos, and I'd leave my Photo model alone.  However, the Django way
> > of doing things requires that I put a ForeignKey into my Photo model
> > to establish the one-to-many.
>
> > The problem is, sometimes Photo's ForeignKey will point to a
> > UserProfile and sometimes to an Place.  How can I have both my
> > UserProfile and Place models point to Photos?
>
> > Thanks in advance,
> > Mike
>
> --http://scott.andstuff.org/|http://truthadorned.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
-~--~~~~--~~--~--~---



Thread-safe or not?

2008-05-13 Thread Goodrone

What is the most up-to-date information about multithread safety in
Django? Is it a good idea to spawn several threads and use models from
there?
--~--~-~--~~~---~--~~
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: Having a Many-to-One relationship with multiple other models

2008-05-13 Thread Scott Moonen
Michael, you have two alternatives:

   1. Create ManyToManyField fields in the UserProfile and Place models,
   pointing to Photo.  "ManyToManyField" may seem a bit odd since you really
   have a many-to-one relation, but it will work as you expect, creating a join
   table connecting each pair of models.
   2. Create two ForeignKey fields in Photo, one to UserProfile and one
   to Photo, with null=True.  Yes, this is a bit ugly. :)

  -- Scott

On Tue, May 13, 2008 at 2:24 PM, Michael Burton <[EMAIL PROTECTED]> wrote:

>
> I have some Places and I have some Users in my database.  I'd like to
> be able to associate some Photos with each.
>
>  class Photo(models.Model):
># a model that represents a photo
>
>  class UserProfile(models.Model):
># has a list of Photos
>
>  class Place(models.Model):
># has a list of Photos
>
>
> Normally, if i were using another ORM framework, I would make my Place
> have a list of photos, and I'd make my UserProfile have a list of
> photos, and I'd leave my Photo model alone.  However, the Django way
> of doing things requires that I put a ForeignKey into my Photo model
> to establish the one-to-many.
>
> The problem is, sometimes Photo's ForeignKey will point to a
> UserProfile and sometimes to an Place.  How can I have both my
> UserProfile and Place models point to Photos?
>
> Thanks in advance,
> Mike
> >
>


-- 
http://scott.andstuff.org/ | http://truthadorned.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
-~--~~~~--~~--~--~---



Having a Many-to-One relationship with multiple other models

2008-05-13 Thread Michael Burton

I have some Places and I have some Users in my database.  I'd like to
be able to associate some Photos with each.

  class Photo(models.Model):
# a model that represents a photo

  class UserProfile(models.Model):
# has a list of Photos

  class Place(models.Model):
# has a list of Photos


Normally, if i were using another ORM framework, I would make my Place
have a list of photos, and I'd make my UserProfile have a list of
photos, and I'd leave my Photo model alone.  However, the Django way
of doing things requires that I put a ForeignKey into my Photo model
to establish the one-to-many.

The problem is, sometimes Photo's ForeignKey will point to a
UserProfile and sometimes to an Place.  How can I have both my
UserProfile and Place models point to Photos?

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



Re: Data truncated for utf-8 string

2008-05-13 Thread Cyril Doussin


Hi Szymon,

Not absolutely sure this is where the problem lies but I'd say check  
the collation used for your table in MySQL.

Cyril


On 13 May 2008, at 09:24, Szymon wrote:

>
> Hello,
>
> I'm using MySQL as my backend. Everytime when I want save a utf-8
> string there is warning that string has been truncated. Ie. I have
> model with CharField(max_length=10), then want to add string
> żźćźżąłśćó it throw warning.
>
> What can I do to override that?
> >


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



loaddata .. columns app_label, model are not unique

2008-05-13 Thread Carl Karsten

[EMAIL PROTECTED]:~/dev/sites/ridgemoor$ ./manage.py loaddata rm.json
Installing json fixture 'rm' from absolute path.
Problem installing fixture 'rm.json': columns app_label, model are not unique

How do I debug this?

Carl K

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



How to make a LEFT JOIN

2008-05-13 Thread [EMAIL PROTECTED]

Hi,
I have the necessity to make a LEFT JOIN for a "translated" model
object.

See the example:
"""
from django.db import models

class Bulletin(models.Model):
pub_date = models.DateField()

class BulletinTranslation(model.Model):
title = models.CharField(max_length=128)
body = models.TextField()
language_code = models.CharField(max_length=2, core=True)
bulletin = models.ForeignKey(Bulletin)
"""

So a Bulletin object could have some translations.
The problem is that I need to display also the objects that have not
the translation in the current view language, so a LEFT JOIN is
basilar.

The behavior requested is that Bulletin have some extra fields from
BulletinTranslation or, at least, a cached BulletinTranslation in one
query (similar to select_related()).

A query for every Bulletin object, in order to get the correct
translation, is a problem because it explode the queries of my site
from 5 to more of 100 per page, so it is really a bad situation.

The other problem is that I can't use a raw SQL because I need some
important functions of the object in order to process some special
fields (not in the example).

The queryset-refactor documentation lacks, so it is very hard to
understand how to build a custom Q object.

This is very important for me, but I tried for an entire week on the
queryset-refactor without results.

How can I create a custom Q object in order to add a this simple LEFT
JOIN?

Example of the join:
"""
"SELECT bulletin.*, bulletintranslation.* FROM bulletin
LEFT JOIN bulletintranslation ON (bulletin.id =
bulletintranslation.bulletin_id AND bulletintranslation.language_code
= '%s');" % get_language_code()
"""
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Formset from newforms-admin

2008-05-13 Thread Ramdas S
Hi,

Can someone kindly explain how you can use the formsets from new-admin
trunk? Is there some kind of an example?

Ramdas

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



Data truncated for utf-8 string

2008-05-13 Thread Szymon

Hello,

I'm using MySQL as my backend. Everytime when I want save a utf-8
string there is warning that string has been truncated. Ie. I have
model with CharField(max_length=10), then want to add string
żźćźżąłśćó it throw warning.

What can I do to override that?
--~--~-~--~~~---~--~~
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: Changing timestamps in apache with mod-python

2008-05-13 Thread Sebastian

Thanks Graham. I had forgotten one other service running under Django
as well. The settings.py file still had the TIME_ZONE setting set to
GMT.

Sebastain

On May 13, 11:13 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On May 13, 8:05 pm, Sebastian <[EMAIL PROTECTED]> wrote:
>
> > Hi David,
>
> > We have checked all possible timezone related issues with our server
> > and everything seems fine. The problem is odd as the times keep
> > changing back and forth. We have turned off all time daemons (ntpd
> > etc...), which left us with the conclusion that it must be something
> > to do with Python or Django as it is local to apache only.
>
> Is that single Django instance the only web application running under
> that Apache, or are you also running other Python or PHP based web
> applications?
>
> If you are running multiple web applications, because they run in the
> same process, if any one of them is fiddling with timezone settings,
> the other applications will be affected.
>
> Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Announcing Deco: static content for Django

2008-05-13 Thread Alex Morega


On May 13, 2008, at 17:32 , phillc wrote:

> your bundling of those mac files confused me for a minute =P

Whoops. Sorry about that. deco-0.1.tgz is now cleaned up. I'll package  
the tarball on a Linux machine from now on. :)

BTW, do you know how to tell 'tar' to ignore those files on the mac?

Thanks,
-- Alex


--~--~-~--~~~---~--~~
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: url tutorial problem

2008-05-13 Thread sebey

never mind forgot to change the "mysite" to "ubertester" I am doing so
many stupid things in the tutorial

On May 13, 3:27 pm, sebey <[EMAIL PROTECTED]> wrote:
> hey I am having problems with the tutorial in the docs on page 3 and I
> am at the stage where I have created my first veiw and I get this back
> the index page:
>
> Page not found (404)
> Request Method: GET
> Request URL:http://localhost:8000/
>
> Using the URLconf defined in ubertester.urls, Django tried these URL
> patterns, in this order:
>
>1. ^admin/
>2. ^polls/$
>3. ^polls/(?P\d+)/$
>4. ^polls/(?P\d+)/results/$
>5. ^polls/(?P\d+)/vote/$
>
> The current URL, /, didn't match any of these.
>
> and I get this traceback form /polls
>
> Traceback (most recent call last):
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> site-packages/django/core/handlers/base.py" in get_response
>   68. callback, callback_args, callback_kwargs =
> resolver.resolve(request.path)
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> site-packages/django/core/urlresolvers.py" in resolve
>   162. sub_match = pattern.resolve(new_path)
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> site-packages/django/core/urlresolvers.py" in resolve
>   118. return self.callback, args, kwargs
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> site-packages/django/core/urlresolvers.py" in _get_callback
>   127. raise ViewDoesNotExist, "Could not import %s. Error was: %s" %
> (mod_name, str(e))
>
>   ViewDoesNotExist at /polls/
>   Could not import mysite.polls.views. Error was: No module named
> mysite.polls.views
>
> any help would be really thankful
--~--~-~--~~~---~--~~
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: Announcing Deco: static content for Django

2008-05-13 Thread phillc

your bundling of those mac files confused me for a minute =P
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



url tutorial problem

2008-05-13 Thread sebey

hey I am having problems with the tutorial in the docs on page 3 and I
am at the stage where I have created my first veiw and I get this back
the index page:


Page not found (404)
Request Method: GET
Request URL:http://localhost:8000/

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

   1. ^admin/
   2. ^polls/$
   3. ^polls/(?P\d+)/$
   4. ^polls/(?P\d+)/results/$
   5. ^polls/(?P\d+)/vote/$

The current URL, /, didn't match any of these.

and I get this traceback form /polls

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/core/handlers/base.py" in get_response
  68. callback, callback_args, callback_kwargs =
resolver.resolve(request.path)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/core/urlresolvers.py" in resolve
  162. sub_match = pattern.resolve(new_path)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/core/urlresolvers.py" in resolve
  118. return self.callback, args, kwargs
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/core/urlresolvers.py" in _get_callback
  127. raise ViewDoesNotExist, "Could not import %s. Error was: %s" %
(mod_name, str(e))

  ViewDoesNotExist at /polls/
  Could not import mysite.polls.views. Error was: No module named
mysite.polls.views

any help would be really thankful
--~--~-~--~~~---~--~~
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: Url pattern problem

2008-05-13 Thread Rajesh Dhawan



On May 13, 9:06 am, laspal <[EMAIL PROTECTED]> wrote:
> hi,
> my project is as follows.
>
> project.app.candidate
>
> url patter are as follows:
> urlpatterns = patterns('',
>(r'^project/app/', include('project.app.urls'))
>
> for app it is:
> urlpatterns = patterns('',
>(r'^candidateprofile/',
> include('project.app.candidates.urls'))
>
> for candidate it is:
> urlpatterns = patterns('project.app.candidates.views.',
>(r'^all/$', 'view_candidateprofile_list')
>
> So for listing all candidates I am using:
> /project/app/candidateprofile/all/
>
> So my problem is I am not able to get this url in my template.
> I am using  href ="{ % url candidate.view_candidateprofile_list all
> %}"
>
> Please can someone tell me how to do it or what I am doing wrong
> here.

You could explicitly name your important URLs and use that name in
your url tag. It would be something like this:

urlpatterns = patterns('project.app.candidates.views.',
url(r'^all/$', 'view_candidateprofile_list',
name='candidate_list')

The url tag would be:

{% url candidate_list %}

-Rajesh D

--~--~-~--~~~---~--~~
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 back to the same page after completing a task in another page

2008-05-13 Thread Adi Jörg Sieker

On 13.05.2008, at 16:18, phillc wrote:

>
> "I am new to web programming"
> "I am trying to use my own loginpage "
>
> is there a reason that contrib.auth doesnt meet your needs?
>
Good question. :)

adi

--
Adi J. Sieker mobile: +49 - 178 - 88 5 88 13
Freelance developer   skype:  adijsieker
SAP-Consultantweb:http://www.sieker.info/profile
   openbc: https://www.openbc.com/hp/ 
AdiJoerg_Sieker/




--~--~-~--~~~---~--~~
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 back to the same page after completing a task in another page

2008-05-13 Thread phillc

"I am new to web programming"
"I am trying to use my own loginpage "

is there a reason that contrib.auth doesnt meet your needs?

--~--~-~--~~~---~--~~
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: Ignore query on views?

2008-05-13 Thread Adi Jörg Sieker

On 13.05.2008, at 06:32, RoMo wrote:

>
> I'm sorry for not understand what you were saying about the error with
> get if i have more than 1 post lol... kinda silly I'm sorry...
>
> Should I use .filter(Author=user)?

filter is used to retrieve many records, get is used to retrieve 1  
record.

if your are working with a ForeignKey on your Post model like so:

def Post(models.Model):
name = CharField()
author = model.ForgeinKey(Author)


and user is an object of type Author then this should give you all the  
Posts for one Author.

user.post_set.all()
and
user.post_set.count() will give you number of posts of the user.

all this information is in the docs at:
http://www.djangoproject.com/documentation/db-api/

specifically
http://www.djangoproject.com/documentation/db-api/#related-objects and 
http://www.djangoproject.com/documentation/db-api/#count

adi


>
>
> I tried with that and i get the next error:
>
> Incorrect integer value: '[]' for column 'Author_id'
> at row 1
>
> On May 12, 12:40 pm, Romo <[EMAIL PROTECTED]> wrote:
>> It works!!
>>
>> Thanks a lot for your help, Adi!
>>
>> cheers
>>
>> On May 12, 12:25 pm, Adi Jörg Sieker <[EMAIL PROTECTED]> wrote:
>>
>>> On 12.05.2008, at 18:57, RoMo wrote:
>>
 Hello guys!
>>
 First of all I don't know if I'm asking the right question, but  
 i'll
 try to explain myself the best I can:
>>
 I would like to know if in a view there is a way that after a  
 "try:"
 and evaluate the expression as false, it justs ignores that query  
 and
 display a message error, but keep loading everything else.
>>
 For example:
>>
 try:
posts = Post.objects.get(Author=user)
except Record.DoesNotExist:
//Missing code Here//
>>
 What I would like to do is: check if user has posted something,  
 if he
 hasn't just displays a "you haven't posted anything yet" where the
 Post should be and it keeps loading everything else normally.
>>
>>> what about:
>>
>>> try:
>>> posts = Post.objects.get(Author=user)
>>> # btw get will raise an AssertionError if more than record  
>>> is found.
>>> # i.e. if a user posted more than one post
>>> except Record.DoesNotExist:
>>> posts = None
>>
>>> return RequestContext(foo,bar, {'posts' : posts})
>>
>>> and in your template:
>>
>>> {%if posts %}
>>> display the posts
>>> {% else %}
>>> No haven't posted anything
>>> {% endif %}
>>
>>> regards
>>>adi
>>
>>> --
>>> Adi J. Sieker mobile: +49 - 178 - 88 5 88 13
>>> Freelance developer   skype:  adijsieker
>>> SAP-Consultantweb:http://www.sieker.info/profile
>>>openbc:https://www.openbc.com/hp/
>>> AdiJoerg_Sieker/
> 
--
Adi J. Sieker mobile: +49 - 178 - 88 5 88 13
Freelance developer   skype:  adijsieker
SAP-Consultantweb:http://www.sieker.info/profile
   openbc: https://www.openbc.com/hp/ 
AdiJoerg_Sieker/




--~--~-~--~~~---~--~~
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: auto admin for production

2008-05-13 Thread rcs_comp

Jeff,

Any chance you would be willing to post the code for your in-house
ticketing system?  I have need for a similar application.

Thanks and not hard feelings if you can't.

On May 9, 7:25 pm, Jeff Anderson <[EMAIL PROTECTED]> wrote:
> pihentagy wrote:
> > Hi all!
>
> > I come to here from a little symfony background (a framework, which
> > try to borrow good things from django), and would like to have an
> > overview how django stacks up.
>
> > I would like to ask, if the admin module can be used on a production
> > server by registered users.
>
> The admin module can be used by registered users, yes.> What problems can 
> occur?
> > (I assume every object references a user)
>
> The admin interface was designed for admins. As long as you keep the
> access limited to trusted users, very few problems (security wise)> - 
> editing/deleting objects not belonging to user
>
> Currently the admin interface doesn't handle row-level permissions. A
> user can be granted to edit articles, but not restricted to only their
> own. I *believe* this is a feature that will be added in newforms-admin.
>
> > How these problems are solved in django?
>
> These problems are solved by writing your own views for your models. Its
> really quite easy to do. We have an in-house ticket system done in
> django, and I've tinkered with "person x in group y can edit these
> tickets", "group z can edit tickets that are assigned to a certain
> category", etc... We simply disabled access to the admin interface for
> the less-privileged users, yet they can still edit certain objects at
> the row-level with our custom views.
>
> It almost sounds like you are asking if the admin interface can just be
> your whole site. That's a bad idea.
>
> Good Luck!
>
> Jeff Anderson
>
>  signature.asc
> 1KDownload
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



url tutorial problem

2008-05-13 Thread sebey

Note: sorry for the long post
hi I am on page 3 of the docs tut but I am having touble with urls I
am at the stage  where you enter in you first view and I on the index
page I get this:


Page not found (404)
Request Method: GET
Request URL:http://localhost:8000/

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

   1. ^admin/
   2. ^polls/$
   3. ^polls/(?P\d+)/$
   4. ^polls/(?P\d+)/results/$
   5. ^polls/(?P\d+)/vote/$

The current URL, /, didn't match any of these.


then on the /polls view I get this

iewDoesNotExist at /polls/
Could not import mysite.polls.views. Error was: No module named
mysite.polls.views
Request Method: GET
Request URL:http://localhost:8000/polls/
Exception Type: ViewDoesNotExist
Exception Value:Could not import mysite.polls.views. Error was: No
module named mysite.polls.views
Exception Location: /Library/Frameworks/Python.framework/Versions/2.5/
lib/python2.5/site-packages/django/core/urlresolvers.py in
_get_callback, line 127
Traceback (innermost last)
Switch to copy-and-paste view

* /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/core/handlers/base.py in get_response
61. return response
62.
63. # Get urlconf from request object, if available. Otherwise
use default.
64. urlconf = getattr(request, "urlconf",
settings.ROOT_URLCONF)
65.
66. resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
67. try:
68. callback, callback_args, callback_kwargs =
resolver.resolve(request.path) ...
69.
70. # Apply view middleware
71. for middleware_method in self._view_middleware:
72. response = middleware_method(request, callback,
callback_args, callback_kwargs)
73. if response:
74. return response
  ▶ Local vars
  Variable  Value
  debug
  
  exceptions
  
  mail_admins
  
  middleware_method
  >
  request
  , POST:, COOKIES:{'sessionid': '7dfd2000ef6045aad429fa3d5dbf7ebb'}, META:
{'CONTENT_LENGTH': '', 'CONTENT_TYPE': 'text/plain',
'DJANGO_SETTINGS_MODULE': 'ubertester.settings', 'GATEWAY_INTERFACE':
'CGI/1.1', 'HOME': '/Users/sebey', 'HTTP_ACCEPT': 'text/
xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/
plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_CHARSET':
'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING':
'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5',
'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE':
'sessionid=7dfd2000ef6045aad429fa3d5dbf7ebb', 'HTTP_HOST': 'localhost:
8000', 'HTTP_KEEP_ALIVE': '300', 'HTTP_USER_AGENT': 'Mozilla/5.0
(Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.14) Gecko/20080404
Firefox/2.0.0.14', 'LOGNAME': 'sebey', 'OLDPWD': '/Users/sebey',
'PATH': '/Library/Frameworks/Python.framework/Versions/Current/bin:/
Applications/MAMP/bin/php5/bin:/Applications/MAMP/Library/bin:/bin:/
sbin:/usr/bin:/usr/sbin', 'PATH_INFO': '/polls/', 'PWD': '/Users/sebey/
Sites/ubertester', 'QUERY_STRING': '', 'REMOTE_ADDR': '127.0.0.1',
'REMOTE_HOST': '', 'REQUEST_METHOD': 'GET', 'RUN_MAIN': 'true',
'SCRIPT_NAME': '', 'SECURITYSESSIONID': '89b8d0', 'SERVER_NAME':
'localhost', 'SERVER_PORT': '8000', 'SERVER_PROTOCOL': 'HTTP/1.1',
'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.5', 'SHELL': '/bin/bash',
'SHLVL': '1', 'TERM': 'xterm-color', 'TERM_PROGRAM': 'Apple_Terminal',
'TERM_PROGRAM_VERSION': '133-1', 'TZ': 'Europe/Dublin Eire', 'USER':
'sebey', '_': '/Library/Frameworks/Python.framework/Versions/Current/
bin/python', '__CF_USER_TEXT_ENCODING': '0x1F5:0:0', 'wsgi.errors':
', mode 'w' at 0x130b0>, 'wsgi.file_wrapper':
, 'wsgi.input':
, 'wsgi.multiprocess': False,
'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme':
'http', 'wsgi.version': (1, 0)}>
  resolver
  
  response
  None
  self
  
  settings
  
  urlconf
  'ubertester.urls'
  urlresolvers
  
* /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/core/urlresolvers.py in resolve
   155. def resolve(self, path):
   156. tried = []
   157. match = self.regex.search(path)
   158. if match:
   159. new_path = path[match.end():]
   160. for pattern in self.urlconf_module.urlpatterns:
   161. try:
   162. sub_match = pattern.resolve(new_path) ...
   163. except Resolver404, e:
   164. tried.extend([(pattern.regex.pattern + ' ' + t) for t in
e.args[0]['tried']])
   165. else:
   166. if sub_match:
   167. sub_match_dict = dict(self.default_kwargs, **sub_match[2])
   168. return sub_match[0], sub_match[1], dict(match.groupdict(),
**sub_match_dict)
  ▶ Local vars
  Variable  Value
  match
  <_sre.SRE_Match object at 0x1428a68>
  new_path
  'polls/'
  path
  '/polls/'
  pattern
  
  self
  
  sub_match
  None
  

Re: How to determine server?

2008-05-13 Thread Chatchai Neanudorn

Which phase do you want to access? Http request parsing, request
object initializing...



2008/5/13, Bob <[EMAIL PROTECTED]>:
>
> Thanks, Any way to do this without access to a request object, since I
> want to use this information to do some server-specific initialization
> before I have a request object to look at?
>
> On May 12, 6:56 pm, "Chatchai Neanudorn" <[EMAIL PROTECTED]> wrote:
> > mod_python (django.core.handlers.modpython),
> >
> > request.META['GATEWAY_INTERFACE'] = 'CGI/1.1'
> >
> > or
> >
> > request.META['SERVER_SOFTWARE'] = 'mod_python''
> >
>

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



Re: How to determine server?

2008-05-13 Thread Bob

Thanks, Any way to do this without access to a request object, since I
want to use this information to do some server-specific initialization
before I have a request object to look at?

On May 12, 6:56 pm, "Chatchai Neanudorn" <[EMAIL PROTECTED]> wrote:
> mod_python (django.core.handlers.modpython),
>
> request.META['GATEWAY_INTERFACE'] = 'CGI/1.1'
>
> or
>
> request.META['SERVER_SOFTWARE'] = 'mod_python''
--~--~-~--~~~---~--~~
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: unspecified date field

2008-05-13 Thread Karen Tracey
On Tue, May 13, 2008 at 7:01 AM, sam <[EMAIL PROTECTED]> wrote:

> hello,
>
> i'm looking for a way to authorize user to add date like '2007-00-00',
> or '2004-04-00', when he doesn't know precisely the day or the day and
> the month of a date.
>
> is someone has got a way to do this ?
>

This is hard to do using a DateField directly, because Python does not
support incompletely specified dates.  Just try to create a
datetime.date(2007,0,0) and you'll see.  So, even if your database supports
putting values like this into a date field (I'm not sure which ones do, I
know MySQL does), on retrieval you've got a problem because there's no way
to represent the value as a Python datetime.date object.

So, you need something like a "fuzzy" DateField, as described here:

http://blog.elsdoerfer.name/2008/01/08/fuzzydates-or-one-django-model-field-multiple-database-columns/

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: Many to Many Inline Editing

2008-05-13 Thread Wes Winham

So, to make sure I understand the question, you're looking for a
solution for editing m2m inline for a ModelForm? Or are you talking
about django.views.generic.create_update?

I know how to do a "custom" inline edit by overriding a field in the
ModelForm, adding a ModelForm from the view for the inline model,
using javascript (jquery) to duplicate the inline form with field
names that are indexed, and using some custom processing in the view
to create the inline models and then link them, but that's a pain. I'd
also love to see some sort of widget, maybe a MultiWidget, that works
as an inline ModelForm for m2m inline (if that's what you're asking),
maybe combined with a bit of jquery to handle adding more than one.
It's on my "to do" list.

-Wes

On May 12, 11:05 am, JReynolds <[EMAIL PROTECTED]> wrote:
> I have seen this posted a few times on the list here, but it always
> seems to become a discussion about the many to many implementation and
> move away from making it work as the one to many inline editing works
> in the newforms-admin branch.
>
> So... does anyone have a fix for being able to add/edit/delete objects
> on the other side of a many to many relationship from the edit view of
> a model?  I have tried to hack up a fix by copying and changing the
> current inline implementation, but can't even get the forms to
> generate.  I can elaborate on my failure if no one else has any
> working ideas...
>
> I'm sure I'm not the only one that needs this and can't seem to get it
> done myself, so maybe this is a useful feature that could be added by
> someone with a better understanding of the admin internals?
--~--~-~--~~~---~--~~
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 email and BCC recipients

2008-05-13 Thread Adam Fast

Julien,

Looking at the code you linked confirmed my suspicions - just like an
email in your favorite email client, you must include a 'to' field
when using BCCs.  The example linked is sending their message /to/
somewhere...and my suspicion is that is what is causing your messages
not to send.  Add a recipient of the sender_email and you should be
fine (yes, you will have to delete the messages from that account, but
BCCs will work.  Alternately, send a single message to each recipient,
then you don't need BCCs.

Adam


On Tue, May 13, 2008 at 1:16 AM, Julien <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
>  Apparently others have had trouble with the BCC attribute of the
>  Django email classes [1]. I also have a problem, but a bit different.
>  The 'to' recipients receive the email, but not the 'bcc' recipients.
>
>  Works:
> msg = EmailMultiAlternatives(subject, plain_body, sender_email,
>  recipients)
> msg.attach_alternative(html_body, "text/html")
> msg.send()
>
>  Doesn't work (executes without problem, but emails are never
>  received):
> msg = EmailMultiAlternatives(subject, plain_body, sender_email,
>  bcc=recipients)
> msg.attach_alternative(html_body, "text/html")
> msg.send()
>
>  I'm using today's version of Django: 0.97-pre-SVN-7523
>
>  Is that a bug or am I missing something?
>
>  Thanks a lot,
>
>  Julien
>
>  [1] 
> http://groups.google.com/group/django-users/browse_thread/thread/7067b4e6686290b4/dff9ff1258105130?lnk=gst=bcc#dff9ff1258105130
>  >
>

--~--~-~--~~~---~--~~
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: Announcing Deco: static content for Django

2008-05-13 Thread Alex Morega


On May 13, 2008, at 15:37 , wiswaud wrote:

>
> One thing you might consider, which i've added to my version of
> flatpages, is language-support: the ability to specify that a given
> page is for fr_ca. My flatpages mod, when serving a given url, will
> first look for the most specific language version of the page, then go
> more and more generalized.

Interesting idea. I would rather create another module, deco.i18n,  
that you only list in INSTALLED_APPS if you want the language support  
feature; it would have its own model and would modify the admin  
interface for deco's model. That's because (I think) most people would  
not want i18n to get in their way.

Thanks for the suggestion!
-- Alex


--~--~-~--~~~---~--~~
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 Performance using PyISAPIe on IIS Rocks

2008-05-13 Thread Wes Winham

It's also worth noting that you sometimes lose stability using
eAccelerator. I've experienced a notable number of apache segfaults
trying to squeeze out some performance, where as .pyc comes out of the
box with no instability.

-Wes

On May 12, 10:30 am, rcs_comp <[EMAIL PROTECTED]> wrote:
> Mat,
>
> You are right, I should have done that.  I setup eAccelerator for IIS
> in both FastCGI and ISAPI modes.  Unfortunately, I could not get
> eAccelerator working in non-thread-safe mode with FastCGI (which is
> what Microsoft recommends).  Here are my results:
>
> PHP ISAPI eAccelerator Symfony: 25.06
> PHP FastCGI eAccelerator Symfony (thread-safe mode): 23.41
> PHP ISAPI Symphony (no accelerator): 11.36
>
> Even if I got FastCGI and eAccelerator working in non-thread-safe
> mode, I don't think it would come close to touching PyISAPIe and
> Django in these tests.
>
> Thoughts?
>
> On May 12, 6:19 am, "Mat" <[EMAIL PROTECTED]> wrote:
>
> > Dunno if you can do it on IIS (cant say ive ever tried), but try installing
> > a PHP accelerator such as eaccelarator or APC, both are open source. This
> > will cache your php files similar to *.pyc in python, and should give you a
> > x8-x10 boost. It is not really a fair test without it :) It is how we run
> > all out symfony servers and they wouldn't cope otherwise!
>
> > Mat
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Url pattern problem

2008-05-13 Thread laspal

hi,
my project is as follows.

project.app.candidate

url patter are as follows:
urlpatterns = patterns('',
   (r'^project/app/', include('project.app.urls'))

for app it is:
urlpatterns = patterns('',
   (r'^candidateprofile/',
include('project.app.candidates.urls'))

for candidate it is:
urlpatterns = patterns('project.app.candidates.views.',
   (r'^all/$', 'view_candidateprofile_list')

So for listing all candidates I am using:
/project/app/candidateprofile/all/

So my problem is I am not able to get this url in my template.
I am using  href ="{ % url candidate.view_candidateprofile_list all
%}"

Please can someone tell me how to do it or what I am doing wrong
here.

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



Re: Announcing Deco: static content for Django

2008-05-13 Thread wiswaud

One thing you might consider, which i've added to my version of
flatpages, is language-support: the ability to specify that a given
page is for fr_ca. My flatpages mod, when serving a given url, will
first look for the most specific language version of the page, then go
more and more generalized.
Very useful. Adds 1 small column to the table, and just a bit of code.
As most of my pages do exist in multiple languages, i just 'try:' to
get the specific language version so the performance penalty is
probably quite small (though flatpages shouldn't be used for
performance-sensitive stuff anyways...).

On May 12, 12:33 pm, Alex Morega <[EMAIL PROTECTED]> wrote:
> Hello, I would like to announce a new project:
>
> Deco is a reusable django app for handling static content. It's like
> django.contrib.flatpages, only much more flexible.
>
> Deco can render plain HTML, Markdown, Textile, and even Django
> templates. It can serve static pages or static pieces of pages (you
> embed them in templates using templatetags).
>
> What do you think, is the project worthwile? I would love some
> feedback on the idea and the implementation. Deco 0.1 is available 
> athttp://grep.ro/projects/deco
> .
>
> Thank you,
> -- Alex Morega
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Weird behavior with SMTP connections

2008-05-13 Thread Florian Lindner

Hello,

I'm experiencing some odd behavior with SMTP connections and the  
functions to send mail.

The relevant settings in my settings.py:

ADMINS = (
  ('Florian Lindner', '[EMAIL PROTECTED]'),
)
EMAIL_HOST = "xgm.de"
EMAIL_HOST_USER = "[EMAIL PROTECTED]"
EMAIL_HOST_PASSWORD = "xxx"

I use the mail_admin function to send mail:

mail_admins("Neues Kommentar", message)

Using it this way produces an SMTPAuthenticationError at /blog/ 
previewComment/(535, '5.7.0 authentication failed').

Since the mail server xgm.de is under my control I scanned the logs  
and found no sign that my localhost even tried to connect. Using  
tcpdump revealed that Django tried to connect to mail.dnsteam.de:SMTP  
with is the second MX of xgm.de.

- I would expect that EMAIL_HOST is being used as smarthost. This way  
Django should not even care about MX or something like that. I just  
logs in using EMAIL_HOST_USER / _PASSWORD and sends the mail.

- Even if It cared about MX it would have used the wrong one, because  
mail.dnsteam is the one with the less priority.

Am I getting something completely wrong or is this a bug?

Florian

--~--~-~--~~~---~--~~
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: Drop all tables

2008-05-13 Thread Alex Morega


On May 13, 2008, at 14:22 , mwebs wrote:

>
> Yes, I am using sqlite, otherwise I would probably use pgadmin, or
> another db-acces-tool.

You can get a shell for an sqlite database, too:

./manage.py dbshell

(works for all database backends)


--~--~-~--~~~---~--~~
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 field original value in overridden save

2008-05-13 Thread bobhaugen

If I override save() in a model, can I get the original value of a
field to compare to the new value, to see if it has changed?

I know it's easy to do in a form: form.initial['field_name']

But I want to do the same thing regardless of which form is used to
change the model instance.  In other words, by overriding save().

I suppose I could use self.pk to get the original value from the
database before saving (and will do so if that's the only way), but
I'm looking for a way that does not require hitting the database
again, similar to the form method.
--~--~-~--~~~---~--~~
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: Drop all tables

2008-05-13 Thread mwebs

Yes, I am using sqlite, otherwise I would probably use pgadmin, or
another db-acces-tool.
Deleting the file an run syncdb works perfectly.

Thanks for your answers.

On 12 Mai, 16:20, "Chris Czub" <[EMAIL PROTECTED]> wrote:
> If you are using SQLite you could just delete the database file. If not, I'm
> confused at why you'd have access to the shell but not access to the
> database - do you not have access to the database you are working on or
> something? If so, I would ask whoever has access to it to drop the tables
> for you. I don't think there'd be a shell command that would allow you to
> drop database tables without having database access since that would be a
> security flaw.
>
> If you reply with which DBMS you're using, we can give you specific
> instructions for how to drop tables.
>
> On Mon, May 12, 2008 at 3:47 AM, mwebs <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > is there anyway to drop all tables without falling back to raw sql. I
> > mean with an shell command or something like that?
>
> > Thank you
>
> > Toni
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



unspecified date field

2008-05-13 Thread sam

hello,


i'm looking for a way to authorize user to add date like '2007-00-00',
or '2004-04-00', when he doesn't know precisely the day or the day and
the month of a date.

is someone has got a way to do this ?

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: Changing timestamps in apache with mod-python

2008-05-13 Thread Graham Dumpleton

On May 13, 8:05 pm, Sebastian <[EMAIL PROTECTED]> wrote:
> Hi David,
>
> We have checked all possible timezone related issues with our server
> and everything seems fine. The problem is odd as the times keep
> changing back and forth. We have turned off all time daemons (ntpd
> etc...), which left us with the conclusion that it must be something
> to do with Python or Django as it is local to apache only.

Is that single Django instance the only web application running under
that Apache, or are you also running other Python or PHP based web
applications?

If you are running multiple web applications, because they run in the
same process, if any one of them is fiddling with timezone settings,
the other applications will be affected.

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



Re: Changing timestamps in apache with mod-python

2008-05-13 Thread Sebastian

Hi David,

We have checked all possible timezone related issues with our server
and everything seems fine. The problem is odd as the times keep
changing back and forth. We have turned off all time daemons (ntpd
etc...), which left us with the conclusion that it must be something
to do with Python or Django as it is local to apache only.

On May 13, 10:47 am, David Reynolds <[EMAIL PROTECTED]>
wrote:
> On 13 May 2008, at 9:52 am, Sebastian wrote:
>
> > I have checked the Python's datetime in a shell and it returns the
> > correct time. I have also checked the datetime in a manage.py shell
> > and it also returns the correct value.
>
> Perhaps the timezone isn't set correctly on your server?
>
> --
> David Reynolds
> [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Changing timestamps in apache with mod-python

2008-05-13 Thread David Reynolds


On 13 May 2008, at 9:52 am, Sebastian wrote:

> I have checked the Python's datetime in a shell and it returns the
> correct time. I have also checked the datetime in a manage.py shell
> and it also returns the correct value.

Perhaps the timezone isn't set correctly on your server?

-- 
David Reynolds
[EMAIL PROTECTED]



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



Re: Changing timestamps in apache with mod-python

2008-05-13 Thread Sebastian

I have checked the Python's datetime in a shell and it returns the
correct time. I have also checked the datetime in a manage.py shell
and it also returns the correct value.

On May 13, 9:29 am, Sebastian <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I have a question about using Django with apache and mod-python. We
> are based in the UK and it seems that since we have moved to British
> Summer Time (BST), timestamps are moving back and forth in Apache.
> Here is a snippet of our apache log:
>
> [16/Apr/2008:09:22:05  ]
> [16/Apr/2008:09:22:58  ]
> [16/Apr/2008:10:24:33  0100]
> [16/Apr/2008:10:24:40  0100]
>
> Could it be that Django has something to do with this? Or maybe a
> python module?
>
> Any help would be greatly appreciated.
>
> Kindest Regards,
> Sebastian
--~--~-~--~~~---~--~~
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: Building filter strings dynamically

2008-05-13 Thread AndyB

I struggled to work this out and it's one of those problems that's
hard to work out what you should Google for.

It would make a worthy addition to the docs IMHO.

On May 10, 4:08 am, Greg Fuller <[EMAIL PROTECTED]> wrote:
> Thanks to both.  Got it working.
>
> On May 9, 9:17 pm, Aaron Fay <[EMAIL PROTECTED]> wrote:
>
> > Similarly, this will work also:field = 'sections' qry = 
> > qry.filter(**{field+'__name__exact': 'shooting'})Cheers,
> > Aaron
> > John Lenton wrote:On Fri, May 9, 2008 at 6:19 PM, Greg Fuller<[EMAIL 
> > PROTECTED]>wrote:Hello, I'm trying to build filter strings dynamically. The 
> > normal way works: qry = qry.filter(sections__name__exact='printing') This 
> > does not work: filter_str = "sections__name__exact='shooting'" qry = 
> > qry.filter(filter_str) . The error is "too many values to unpack" at 
> > django/db/models/sql/ query.py in add_filter, line 933 I realize something 
> > outside normal name-spacing is probably happening, since 
> > "sections__name__exact" doesn't have to be defined anywhere. But is there 
> > any way to build the parameter to the filter dynamically?the usual python 
> > way of building dynamic args: filter = {'sections__name__exact': 
> > 'shooting'} qry = qry.filter(**filter)
--~--~-~--~~~---~--~~
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: auto admin for production

2008-05-13 Thread AndyB

I've been down this road and I will say that although you can modify
the Admin to do everything you need - it actually turns out to be more
complex that just writing your own CRUD (which newforms makes a
delight).

It's a shame in some ways - Admin is so nearly ready for this kind of
thing that it's very tempting to try and use it but in any real world
app your requirements will differ from Admin's in so many small ways
that you will be fighting it all the way.

I've got a site where registered users are using Admin in the way you
describe but their requirements were simple. I'm working on a simple
CMS and I'm going to use Admin initially but the minute I have to
start doing anything complex I'm going to write my own 'admin'...

On May 10, 8:52 pm, Doug B <[EMAIL PROTECTED]> wrote:
> > Why is that a bad idea?
> > If I mainly need CRUD operations it is natural to solve it with admin
> > interface.
> > Cannot these "security issues" if any eliminated, and use the admin
> > interface for a whole site? (if it needs just CRUD).
>
> ->ADMIN<- Interface.  It wasn't designed to be an entire site.  If you
> only need CRUD, it's relatively easy to do writing your own views.
> Even if you could use the admin, I'm not sure it would be much
> easier.  Writing your own views is very easy in Django, especially if
> you only need basic crud and can use the model form helpers.  A simple
> CRUD view could be 8-10 lines of code, plus a basic html template.
> Permission checking can be done with reusable decorators.  Personally
> I fnd writing a view much simpler than trying to make the admin do
> exactly what I want.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Changing timestamps in apache with mod-python

2008-05-13 Thread Sebastian

Hi All,

I have a question about using Django with apache and mod-python. We
are based in the UK and it seems that since we have moved to British
Summer Time (BST), timestamps are moving back and forth in Apache.
Here is a snippet of our apache log:

[16/Apr/2008:09:22:05  ]
[16/Apr/2008:09:22:58  ]
[16/Apr/2008:10:24:33  0100]
[16/Apr/2008:10:24:40  0100]

Could it be that Django has something to do with this? Or maybe a
python module?

Any help would be greatly appreciated.

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



how to interact with the user from a caught pre_save/post_save signal?

2008-05-13 Thread Viktor Nagy

Hi,

I'm kind of new the django and to learn it I've tried to build a
simple calendaring app that would save the event's info locally and
create an event at Google Calendar as well.

The save locally works fine (I use the admin interface).
I also know how to create an event at gcal outside of django.

My questions is how would you save the event at google calendar from
the admin interface?
What I was trying to do is to catch a signal, and then upload the data.

The problem is that Google needs authentication (via AuthSub), so what
I would need is this:

First visit:
1. save the event -> calls pre_save/post_save (probably a post_save is better)
2. tell the user to authenticate, and provide a link for it in the messages line
3. user authenticates, we create a sessionToken
4. the token is stored locally for future use
5. the event is created at google calendar

Every following visit:
1. save the event
2. use the stored token to create the event at gcalendar as well

I have problems with points First visit/2 and First visit/4 (don't
really know how should I store the token as I can't store it as a
python object, what would be the best).

Do you have any ideas?

Viktor

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



Re: django_sessions table getting out of hand

2008-05-13 Thread Matt Davies
ahh

Thanks Scott, I thought Arien was referring to me writing a script, when in
fact there's one in source code already.

Cheers

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

2008-05-13 Thread Alex Morega


On May 13, 2008, at 08:43 , MrJogo wrote:

>
> I'd like my javascripts to know MEDIA_URL so they can pull pictures
> from there (for a slideshow) and I was wondering the best way of doing
> this.
>
> I figure the best way would be to create one javascript file that goes
> through the Django templating and makes a variable available for the
> other scripts. Something like:
>
> //site.js
> var site = {
>  medai_url = '{{ MEDIA_URL }}'
> };
>
> Then other scripts could access it through site.media_url. My question
> is how best to templatize a javascript file. I could just put it in my
> base.html file between , but that way's kind of poo.
That is one option, and if you have few variables, it's a good option,  
imho.

> If I were to templatize the entire file, it would have to go through
> urls.py, but for consistency's sake I'd like the url to be within my
> media/javascript folder, ie a urls.py entry something like:
>
> urlpatterns = patterns('',
>  (r'^' + settings.MEDIA_URL + r'javascript/site.js$', media_js),
> )
>
> But then I run into the problem that MEDIA_URL is an absolute URL, so
> I'd probably have to do some string manipulation to get the relative
> URL out.
The string manipuliation would pe pretty simple, because you only have  
to strip the leading slash:
(r'^' + settings.MEDIA_URL[1:] + r'javascript/site.js$', media_js),

> Am I missing an easier way of doing it? Thoughts on these approaches?
I don't think it's any easier, but it might seem a little more  
elegant: create a .js file only for the MEDIA_URL variable, and have  
it generated from Django, served via urls.py. That way you keep your  
large javascript code in a static file served by the web server, and  
you don't mess up the HTML with embedded javascript.

Cheers,
-- Alex


--~--~-~--~~~---~--~~
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: handling form errors in separate app

2008-05-13 Thread Alex Morega


On May 13, 2008, at 01:00 , Mike Chambers wrote:

>
> I am working on a simple comment app that is meant to be generic and
> reusable. Everything is going well, but the one thing I am having a
> problem with is how to handle comment submissions that dont validate.
>
> For a normal form post, I would just validate the Form in the view,  
> and
> then render the template with the Form. The template would then access
> the errors from the form class.
>
> However, since my comment app is standalone, it does not know which
> template should be rendered, and which data should be passed to the
> template.

You could have the error-handling app override the template for the  
comment app. Consider something like this:

def submit_comment(request):
 ...
 return render_to_response(['comments/template.html', 'comments/ 
default-template.html'], {form: the_form})

You would provide the "comments/default-template.html" template with  
the reusable comments app, and in your project, add a "comments/ 
template.html" template, possibly in its own application. This works  
because render_to_response (and render_to_string) tries to use the  
templates in the order you listed them; the first match gets rendered.  
For more examples of this, look at django.contrib.admin, where it's  
used to allow you to override the admin interface's templates on a per- 
app and per-model basis.

Cheers,
-- Alex


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



wrong URL after invalid form submission

2008-05-13 Thread Mike Chambers

I am doing a simple comment submission form.

The page that the comment form is on is:

/item/2/

the comment form action url is:

/item/comment/

On the submission, I check if the form is valid, and if it is not, I 
return the form to the user / template, which then displays the form 
errors. If it is valid, then I redirect to the page that the form was 
submitted from.

Something like this:

---
if form.is_valid()
#save comment / form input
else
return render_to_response('item/chapter.html', c, 
RequestContext(request))
---

If the required fields are filled in, this works great. The comment is 
entered, and the browser is redirected to the same page /item/2/

However, if the form does not validate, then the previous template is 
rendered, with the form fields showing the error. However, the user is 
now at the action url : /item/comment/

Is there any way to make it so the user is always on /item/2/ url? even 
if returning from an invalid form submission?

The only way I can think to do this is have the URL for both the page, 
and the form submission to be the same:

/item/

and then just check for GET or POST in the view. However, this seems 
like a hack, and ties the form handling too closely to that particular view.

Any suggestions?

mike


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



Django email and BCC recipients

2008-05-13 Thread Julien

Hi,

Apparently others have had trouble with the BCC attribute of the
Django email classes [1]. I also have a problem, but a bit different.
The 'to' recipients receive the email, but not the 'bcc' recipients.

Works:
msg = EmailMultiAlternatives(subject, plain_body, sender_email,
recipients)
msg.attach_alternative(html_body, "text/html")
msg.send()

Doesn't work (executes without problem, but emails are never
received):
msg = EmailMultiAlternatives(subject, plain_body, sender_email,
bcc=recipients)
msg.attach_alternative(html_body, "text/html")
msg.send()

I'm using today's version of Django: 0.97-pre-SVN-7523

Is that a bug or am I missing something?

Thanks a lot,

Julien

[1] 
http://groups.google.com/group/django-users/browse_thread/thread/7067b4e6686290b4/dff9ff1258105130?lnk=gst=bcc#dff9ff1258105130
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---