Re: How to hide the "save and add another" button in admin page?

2014-01-20 Thread parnigot
If your method ModelAdmin.has_add_permission() returns always False even a 
superuser can’t add the initial entry using the admin. But you can:

Add the initial entry using the command line.
Write a more complex has_add_permission method that checks if the request.user 
is a superuser or checks if  the initial entry already exists.

e.p.

Il giorno 19/gen/2014, alle ore 18:34, RLF_UNIQUE  ha 
scritto:

> Ah I see, give a user change permission but not add or remove? Then just use 
> superaccount to make initial entry?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/f2b936f2-7107-4dad-bd3a-364cae68cb37%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8154DDBF-5293-4355-84D6-FB49FF2FE040%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-20 Thread Johannes Schneider
thnx for this suggestion. we use '_state.adding' now. Is there an 
advantage of using '_state.database'?


bg,
Johannes

On 17.01.2014 14:39, Tom Evans wrote:

On Thu, Jan 16, 2014 at 5:23 PM, Johannes Schneider
 wrote:

This could be a way to it, but we need this information while handling the
Pre_save singal. So this does not work too.


Abuse the django model instance's internals and look to see what
database this instance was loaded from - if it is None, it hasn't come
from the database.

This is highly fragile - using an undocumented API that I know has
changed in recent versions. Personally I would test that the pk does
not exist in the database (and buy faster hardware.)



u=User.objects.get(id=1)
u2=User()
u._state.db

'default'

u2._state.db



Cheers

Tom




--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52DCDA7B.4000206%40galileo-press.de.
For more options, visit https://groups.google.com/groups/opt_out.


Re: session modification question

2014-01-20 Thread ernando
Hi,

I agree with Daniel that your case of using session is incorrect. You have 
to think about session as a simple dictionary that stores data through 
requests. And it doesn't keep track about protecting data from changing - 
you should think about it yourself. Believe, you have to think about some 
kind of flag, that should be checked while running time-consuming operation 
and handle cases of changed data.

Thanks,
Dmitry

On Saturday, January 18, 2014 8:11:56 PM UTC+3, Spork Spork wrote:
>
> Hi,
>
> I have a question about what gets persisted when session data gets 
> updated. I've read the sessions chapter of the book, and it's not entirely 
> clear to me.
>
> Say I have two keys in the session object that I'm manipulating in a view:
>
> view1: request.session['foo'] = 'foocontent'
> view1: request.session['bar'] = 'barcontent'
> view1: goes off and does something that takes a long, long timer
>
> Meanwhile some other view fires off and changes foo:
>
> view2: request.session['foo'] = 'updateddfoocontent'
>
> Then view2 exits, and the most recent session data gets persisted.
>
> But meanwhile view1 still has the old copy of the session data. Eventually 
> it completes whatever it was doing, and updates bar:
>
> view1: request.session['bar'] = 'updatedbarcontent'
>
> Question: when view1 exits and its data gets persisted, does it overwrite 
> all of the session data, including stomping on view2's modification of foo? 
> If so, how can I ensure that at the end of view1, what gets persisted is:
>
> session['foo'] = 'updatedfoocontent'
> session['bar'] = 'updatedbarcontent'
>
> I'm using django 1.4 and db-based sessions.
>
> Thanks in advance,
>
> Spork
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6faef176-e880-4ada-a8e1-f3f01da310cf%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Questions about how Django handles user authentication.

2014-01-20 Thread Avraham Serour
on your view the request object will be populated already, it is meant for
read only, including the user object so you could check for example if the
current user is authenticated using the request.user object

good luck


On Mon, Jan 20, 2014 at 7:35 AM, Chen Xu  wrote:

> Hi Everyone,
> I am wondering how request.User get set during the authentication, do we
> have to do anything like:
>
> request.User = User() or it will have value by itself?
>
>
> Thanks in advance.
> --
> ⚡ Chen Xu ⚡
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACac-qZDa9GrT1wjbBxBsSR%2BGmotScqS76VrTCVw-8TJRioa7Q%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6t%2BAJrjKxHAJ4fbOTMqxGCpG%3D6GFCwN%2B3uyK43aATKHLjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Questions about how Django handles user authentication.

2014-01-20 Thread Daniel Roseman
On Monday, 20 January 2014 05:35:40 UTC, Chen Xu wrote:
>
> Hi Everyone,
> I am wondering how request.User get set during the authentication, do we 
> have to do anything like:
>
> request.User = User() or it will have value by itself?
>
>
> Thanks in advance.
> -- 
> ⚡ Chen Xu ⚡
>

Did you try reading the documentation, which explains all this fully?

request.user (note lower case) is populated by the authentication 
middleware.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/388e8a07-a271-4c4d-89c3-972968276d5b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django Survey App

2014-01-20 Thread Yazmin Lucy Cumberbirch
Hi!

I am trying to find a survey app for my django project. I need it to be 
able to send personalized survey invitations, so I know who is answering 
them.

This is similar to SurveyMonkey, but the API they provide doesn't include 
any methods to send the survey to the list of mails (or I can't find how to 
do it).

Does anybody know of an app that does this? Or an external page that does 
so, and has an API so I can do it all automatically?

Thanks for any help!

ylc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f853ede3-5b27-41bc-b8fc-d709efcc7215%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django response with two HTTP 'WWW-Authenticate' headers

2014-01-20 Thread Alexey Gusev
 

Im developing small intranet web service. I want authenticate users over 
kerberos in MS AD or with basic auth. For that reason i need to set two 
'WWW-Authenticate' http headers in response 401. How can i do it with 
Django ?

Should be something like this:

Client: GET www/index.html
Server: HTTP/1.1 401 Unauthorized
WWW-Authenticate: Negotiate
WWW-Authenticate: Basic realm="corp site"

This code overwrite header:

def auth(request):
response = None
auth = request.META.get('HTTP_AUTHORIZATION')
if not auth:
response = HttpResponse(status = 401)
response['WWW-Authenticate'] = 'Negotiate'
response['WWW-Authenticate'] = 'Basic realm="  trolls place basic auth"'

elif auth.startswith('Negotiate YII'):
...

return response

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7a2d398b-bf7c-4241-84c3-4dc19a9cdcd6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


deploy django and apache mod wsgi

2014-01-20 Thread George Alvarado
I try deploy django and apache2 apache2 mod-wsgi. An app for tets and open the 
bowser, navigate in the correct url it says "error 403 tes.com cant acces / on 
this server", i know its about permisions but how can fix it?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/58c916a0-ff5d-4ca2-b3b1-1d4b90e65102%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


KeyError: u"Unknown language code 'en-us'."

2014-01-20 Thread Geotribu
Hi all,


I've developed a multi-language application with Django.
Everything works fine except I receive regularly this message by email:

8<--


*Traceback (most recent call last):

  File 
"/home/users/avandecastee/osmq/lib/python2.6/site-packages/django/core/handlers/base.py",
 line 140, in get_response
response = response.render()

  File 
"/home/users/avandecastee/osmq/lib/python2.6/site-packages/django/template/response.py",
 line 105, in render
self.content = self.rendered_content..*


*  File 
"/home/users/avandecastee/osmq/lib/python2.6/site-packages/django/utils/translation/__init__.py",
 line 150, in get_language_info
raise KeyError("Unknown language code %r." % lang_code)

KeyError: u"Unknown language code 'en-us'."*

-->8



Could you tell me what I must change to avoid this message ?


Thanks for your help

Arnaud

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ce49491e-a017-4c39-b3a4-ec343a1d7bc3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: deploy django and apache mod wsgi

2014-01-20 Thread parnigot
Can you post:

your_app.wsgi file
apache version
apache configuration
apache error.log

Cheers,

Il giorno 20/gen/2014, alle ore 10:36, George Alvarado  ha 
scritto:

> I try deploy django and apache2 apache2 mod-wsgi. An app for tets and open 
> the bowser, navigate in the correct url it says "error 403 tes.com cant acces 
> / on this server", i know its about permisions but how can fix it?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/58c916a0-ff5d-4ca2-b3b1-1d4b90e65102%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

e.p.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6BD1D7B7-159E-4A23-94B3-DB2D72392C81%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: deploy django and apache mod wsgi

2014-01-20 Thread Timothy W. Cook
On Mon, Jan 20, 2014 at 11:32 AM, parnigot  wrote:

> Can you post:
>
>
>- your_app.wsgi file
>- apache version
>- apache configuration
>- apache error.log
>
>
>

AND! your OS And version.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3VLo%3DbYNof4b0L1gh%3DxkeoDDPCi3QwPJ-dr-uJ11Z7JeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: deploy django and apache mod wsgi

2014-01-20 Thread Toran Billups
Also what does your httpd.conf file look like? Are you doing a deny from 
all anywhere?



On Monday, January 20, 2014 3:36:04 AM UTC-6, George Alvarado wrote:
>
> I try deploy django and apache2 apache2 mod-wsgi. An app for tets and open 
> the bowser, navigate in the correct url it says "error 403 tes.com cant 
> acces / on this server", i know its about permisions but how can fix it?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/68a34951-7946-4c03-87e7-2b8ff8c4436b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Survey App

2014-01-20 Thread Ovnicraft
On Mon, Jan 20, 2014 at 6:41 AM, Yazmin Lucy Cumberbirch wrote:

> Hi!
>
> I am trying to find a survey app for my django project. I need it to be
> able to send personalized survey invitations, so I know who is answering
> them.
>
> This is similar to SurveyMonkey, but the API they provide doesn't include
> any methods to send the survey to the list of mails (or I can't find how to
> do it).
>
> Does anybody know of an app that does this? Or an external page that does
> so, and has an API so I can do it all automatically?
>

Hi i am using https://github.com/eldarion/formly is really great you need
to use it with pinax account project
https://github.com/pinax/pinax-project-account

It allows you make all surveys as you want and its bootstrap based :-)

Thanks to eldarion.


Regards,


>
> Thanks for any help!
>
> ylc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f853ede3-5b27-41bc-b8fc-d709efcc7215%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Cristian Salamea
@ovnicraft

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B16coN9adsHmprYT-08_cfxGhKU9Ksq-d5gJS6S0ufQ3V1dzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-20 Thread Kelly Nicholes
Wait-- Why aren't you using exists()?  Don't even check the pk.  
Model.query.exists() was made for this.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2bccd6fc-e628-4b66-8299-6516904073d2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


"Auto escape" of backslash caracters in amdin field/forms

2014-01-20 Thread alois . guillope
Hi all,

I am currently porting a big project from django 1.3 to 1.5. One of the 
original developpers created a custom validator in the admin in order to 
avoid certain unicode caracters. One test in the test suite is supposed to 
fail as it gives as input "blabla \x07 blabla". But it seems that Django 
automatically cleaned the input as the string which is given to the 
validator has its backslash escaped ("blabla \x07 blabla").

Does someone know where this clean-up could come from ? (its a text field)

Thanks,

Alois
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c4cb3ba1-30b0-4256-9f3a-001413961b58%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django response with two HTTP 'WWW-Authenticate' headers

2014-01-20 Thread Tom Christie
No, I don't believe that Django's response class supports that slightly 
esoteric usage.

As explained by the stackoverflow answer 
here,
 
repeated headers should be treated as being the same as a single header 
containing a comma separated list of values.
That answer appears to indicate that it's valid for the WWW-Authenticate 
header to be used in this way, so 'Negotiate, Basic relam= '.

Also see RFC 2616, Sec 
14 "if more 
than one WWW-Authenticate header field is provided, the contents 
of a challenge itself can contain a comma-separated list of authentication 
parameters.", however I wouldn't be at all surprised if some client 
libraries don't correctly interpret that for you.

Hope that helps...

  Tom

On Monday, 20 January 2014 07:51:05 UTC, Alexey Gusev wrote:
>
> Im developing small intranet web service. I want authenticate users over 
> kerberos in MS AD or with basic auth. For that reason i need to set two 
> 'WWW-Authenticate' http headers in response 401. How can i do it with 
> Django ?
>
> Should be something like this:
>
> Client: GET www/index.html
> Server: HTTP/1.1 401 Unauthorized
> WWW-Authenticate: Negotiate
> WWW-Authenticate: Basic realm="corp site"
>
> This code overwrite header:
>
> def auth(request):
> response = None
> auth = request.META.get('HTTP_AUTHORIZATION')
> if not auth:
> response = HttpResponse(status = 401)
> response['WWW-Authenticate'] = 'Negotiate'
> response['WWW-Authenticate'] = 'Basic realm="  trolls place basic 
> auth"'
>
> elif auth.startswith('Negotiate YII'):
> ...
>
> return response
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b6837442-469c-4c09-bb60-33ee324f0fbb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-20 Thread Johannes Schneider

I don't do, because I don't want do to have a query against the database.

On 20.01.2014 16:25, Kelly Nicholes wrote:

Wait-- Why aren't you using exists()?  Don't even check the pk.  
Model.query.exists() was made for this.




--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52DD4B1B.9020508%40galileo-press.de.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django response with two HTTP 'WWW-Authenticate' headers

2014-01-20 Thread Tom Evans
On Mon, Jan 20, 2014 at 7:51 AM, Alexey Gusev  wrote:
> Im developing small intranet web service. I want authenticate users over
> kerberos in MS AD or with basic auth. For that reason i need to set two
> 'WWW-Authenticate' http headers in response 401. How can i do it with Django
> ?
>
> Should be something like this:
>
> Client: GET www/index.html
>
> Server: HTTP/1.1 401 Unauthorized
> WWW-Authenticate: Negotiate
> WWW-Authenticate: Basic realm="corp site"
>
> This code overwrite header:
>
> def auth(request):
> response = None
> auth = request.META.get('HTTP_AUTHORIZATION')
> if not auth:
> response = HttpResponse(status = 401)
> response['WWW-Authenticate'] = 'Negotiate'
> response['WWW-Authenticate'] = 'Basic realm="  trolls place basic
> auth"'
>
> elif auth.startswith('Negotiate YII'):
> ...
>
> return response
>

Impossible to do with base classes, but django allows you to customize
your responses however you like:

class MultiAuthResponse(HttpResponse):
  www_auth_headers = [ ]
  def serialize_headers(self):
 base_headers = super(MultiAuthResponse, self).serialize_headers()
 extra_headers = '\r\n'.join([ 'WWW-Authenticate: %s' %
hdr.encode('us-ascii') for hdr in self.www_auth_headers ])
  return base_headers + extra_headers

response = MultiAuthResponse(status=401)
response.www_auth_headers = [ 'Negotiate', 'Basic realm="trolls place
basic auth"' ]

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1Jq2d6G77LZxJV%2BzS%3DxZt%3DKS_hXCVZ1e%3Dj2tdgCTepRZA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-20 Thread Avraham Serour
well you have a problem then, the database is the one holding the data, if
you want to know if the data exists will would need to ask the one
responsible for it, if not the DB then who?

you could keep a copy in memory but then you will have two problems. are
you actually having problems with exists() or is this just premature
optimization?


On Mon, Jan 20, 2014 at 6:13 PM, Johannes Schneider <
johannes.schnei...@galileo-press.de> wrote:

> I don't do, because I don't want do to have a query against the database.
>
>
> On 20.01.2014 16:25, Kelly Nicholes wrote:
>
>> Wait-- Why aren't you using exists()?  Don't even check the pk.
>>  Model.query.exists() was made for this.
>>
>>
>
> --
> Johannes Schneider
> Webentwicklung
> johannes.schnei...@galileo-press.de
> Tel.: +49.228.42150.xxx
>
> Galileo Press GmbH
> Rheinwerkallee 4 - 53227 Bonn - Germany
> Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
> http://www.galileo-press.de/
>
> Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
> HRB 8363 Amtsgericht Bonn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/52DD4B1B.9020508%40galileo-press.de.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6tLNikRya2Fyji_WSgFd9QE9qDNmrhNEsUDj2hQd2t7ieQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Combining django-tables2 with django-filter info ListView?

2014-01-20 Thread Sapana Kaswa-Surpuriya
Were you able to implement it? Could you help me?

On Thursday, August 9, 2012 3:47:56 PM UTC-5, Paul wrote:
>
> I have a listview using the generic class based ListView. I have 
> get_queryset overloaded in my view:
>
> class WebsiteList(ListView):
> model = Website
> def get_queryset(self):
> return Website.objects.all()
>
> First step is to add the tables2 mixin as follows:
>
> class WebsiteList(tables.SingleTableMixin, ListView):
> model = Website
> table_class = WebsiteTable #tables2 related
> def get_queryset(self):
> return Website.objects.all()
>
> The mixin adds the table object to the context and adds an order_by clause 
> to the queryset.
>
> Now i don't know how to add a second mixin for django-filter; i have a 
> mixin available but since it also fetches the queryset from get_queryset 
> i'm expecting that either the ordering or the filtering won't work!?
>
> Anyone with mixin experience willing to give some directions?
>
> Paul
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5d1bb27d-5afc-4ce8-9f61-4dca34027341%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Connecting to a MS SQL server from django

2014-01-20 Thread Larry Martell
Thank you very much Fred. When I get back to this I will let you know
how it went.

On Sun, Jan 19, 2014 at 10:26 PM, Fred Stluka  wrote:
> Larry,
>
> I did it a long complicated way, but we recently had 2 new people
> join our team, and refined the process for them, and it seemed to
> go smoothly, so here's what they did.
>
> Some sections differ for Mac vs Linux, and some even for different
> Linux distros, but it should all work.  I'm including all of it, even
> the part about how to install Python, Django, virtualenv, etc., which
> you probably already have, and MySQL, which you are not using so
> you can skip.
>
> The following document is in Markdown format.
>
> HHL is the name of our project.  Change it to your own project name.
>
> Let me know how it works!
>
>
>
> # Setting up your development environment.
>
> ## Install Python 2.7, if it's not already on your system.
>
> ### Mac
>
> The Mac comes preinstalled with a 2.7 version of Python. Double-check the
> version as shown:
>
> $ /usr/bin/python --version
> Python 2.7.5
>
> If you don't get a 2.7 version of Python, or if you get a
> "No such file or directory" error, install your own version of Python via
> the [Homebrew][] package manager:
>
> $ brew install python
>
> ### Linux
>
> If your Linux system doesn't already have a version of Python, install
> one with the package manager.
>
> For Ubuntu and Debian:
>
> $ sudo apt-get install python
>
> On CentOS (and, presumably, Fedora and RedHat), see
> .
>
> ## Install `virtualenv`
>
> Mac:
>
> The version of Python that comes pre-installed on the Mac comes with
> `easy_install`, so you can use that to install `virtualenv`:
>
> $ sudo /usr/bin/easy_install virtualenv
>
> Linux:
>
> You can either use your system's package manager (e.g.,
> `sudo apt-get install python-virtualenv` on Ubuntu and Debian), or you can
> install `virtualenv` manually, as described at
> .
>
> ## Create and activate a virtual environment
>
> Where you put the environment is up to you; the following is just an
> example:
>
> $ virtualenv ~/pythons/hhl
>
> Confirm that you did, indeed, create a Python 2.7 virtual environment:
>
> $ ~/pythons/hhl/bin/python
> Python 2.7.5 (default, Nov 19 2013, 10:30:44)
> [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>>
>
> Activate that environment:
>
> $ source ~/pythons/hhl/bin/activate
>
> ## Install MySQL
>
> Mac:
>
> Again, it's easiest to use [Homebrew][]:
>
> $ brew install mysql
>
> After installing MySQL, homebrew will display suggestions on how to get
> MySQL
> set up. Follow those instructions.
>
> Linux:
>
> You'll need both MySQL and the MySQL development files. Without the latter,
> you won't be able to build the MySQL Python driver.
>
> For Ubuntu and Debian:
>
> $ sudo apt-get install mysql-server libmysqlclient-dev
>
> On CentOS (and, presumably, Fedora and RedHat):
>
> $ sudo yum -y install mysql-devel
>
> ## Install the Python MySQL driver
>
> $ pip install MySQL-python
>
> ## Install non-Python ODBC libraries and tools
>
> ### Install unixODBC
>
> Mac:
>
> $ brew install unixodbc
>
> The `odbcinst.ini` file ends up in `/usr/local/etc/`.
>
> Linux:
>
> $ sudo apt-get install unixodbc-dev  # Ubuntu and Debian
> $ sudo yum -y install unixODBC-devel # CentOS, RedHat, and Fedora
>
> The `odbcinst.ini` file ends up in `/etc/`.
>
> ### Install FreeTDS
>
> Mac:
>
> $ brew install freetds --with-unixodbc
>
> Note that the `freetds.conf` file ends up in `/usr/local/etc/freetds.conf`.
> Installing this Homebrew package also provides the `tsql` command, which
> can be useful for testing.
>
> Linux:
>
> This package is typically available via the Linux package manager.
>
> For Ubuntu and Debian:
>
> $ sudo apt-get install freetds-dev tdsodbc
>
> The `freetds.conf` file ends up in `/etc/freetds/`. If you need the
> `tsql` program (useful for testing), you also need the `freetds-bin`
> package:
>
> $ sudo apt-get install freetds-bin
>
> On CentOS (and, presumably, Fedora and RedHat):
>
> $ sudo yum -y install freetds-devel
>
> The `freetds.conf` file ends up in `/etc/`.
>
> ### Configure unixODBC and FreeTDS
>
> This blog post provides a good overview of the process:
> 
>
> (NOTE: Those instructions talk about setting up a `$HOME/.odbcinst.ini`.
> That file does not appear to be necessary.)
>
> Find your `odbcinst.ini` file (see the section, above, on installing
> `unixODBC`), and make its contents look like this.
>
> [FreeTDS]
> Description = FreeTDS MSSQL
> # If you're on Linux, uncomment the following settings.
> #Driver  = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
> #Driver64

Stripped Django?

2014-01-20 Thread zweb
I am planning to use django rest as rest API server. In one presentation I 
read, that stripped Django as REST server outperforms some other 
microframeworks.

What would be stripped django?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1d3b2eba-def0-4246-afdf-3a7dfd9cb390%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: KeyError: u"Unknown language code 'en-us'."

2014-01-20 Thread Jonathan Pentecost
There is no language code "en-us" in django. `from 
django.conf.global_settings import LANGUAGES` to get a list of all 
languages.

On Monday, 20 January 2014 23:52:37 UTC+11, Geotribu wrote:
Hi all,


I've developed a multi-language application with Django.
Everything works fine except I receive regularly this message by email:

8<--

Traceback (most recent call last): File 
"/home/users/avandecastee/osmq/lib/python2.6/site-packages/django/core/handlers/base.py",
 
line 140, in get_response response = response.render() File 
"/home/users/avandecastee/osmq/lib/python2.6/site-packages/django/template/response.py",
 
line 105, in render self.content = self.rendered_content
..


File 
"/home/users/avandecastee/osmq/lib/python2.6/site-packages/django/utils/translation/__init__.py",
 
line 150, in get_language_info raise KeyError("Unknown language code %r." % 
lang_code) KeyError: u"Unknown language code 'en-us'."

-->8



Could you tell me what I must change to avoid this message ?


Thanks for your help

Arnaud

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0992ba14-4b0a-492e-857a-3efd4e2b7d7c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


UUIDField from django-extensions is not available in Class Based Views

2014-01-20 Thread Timothy W. Cook
I have a web application where I use a couple of UUIDFields. In the Admin
UI, in function based views and other Python code, these fields work as
expected. However, when trying to list them in the 'fields' in a CBV, I get
the error:

FieldError(message) django.core.exceptions.FieldError: Unknown field(s) (ct_id)

The subject field here is *ct_id*. But another one does the same.

>From models.py:

ct_id = UUIDField(_("UUID"), version=4, help_text=_('A unique
identifier for this PCT.'))

As mentioned above, they work in Admin lists:

list_display = ('data_name','prj_name','published','ct_id')
admin.site.register(DvBoolean, DvBooleanAdmin)

In function based views to create JSON for DynaTree:

pct_json['tooltip'] = 'ct-'+pct.ct_id + " : " +pct.description

But in a CBV, this raises the error:

fields =['published','prj_name','data_name',ct_id,]

Any ideas on how to make this work? I only want to render them for display,
not for editing.

Thanks,

Tim

PS. This question is also on StackOverflow at:   http://goo.gl/mA7I6V

-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3Wh1koCBsLrPQRPd-Jn_86dvXiYNOhZH1ad4LkRPNWdgg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: UUIDField from django-extensions is not available in Class Based Views

2014-01-20 Thread Timothy W. Cook
BTW:

In the actual code the ct_id field is quaoted correctly.  It was just an
error in my post here.

fields =['published','prj_name','data_name','ct_id',]



On Mon, Jan 20, 2014 at 7:03 PM, Timothy W. Cook  wrote:

>
> I have a web application where I use a couple of UUIDFields. In the Admin
> UI, in function based views and other Python code, these fields work as
> expected. However, when trying to list them in the 'fields' in a CBV, I get
> the error:
>
> FieldError(message) django.core.exceptions.FieldError: Unknown field(s) 
> (ct_id)
>
>  The subject field here is *ct_id*. But another one does the same.
>
> From models.py:
>
> ct_id = UUIDField(_("UUID"), version=4, help_text=_('A unique identifier for 
> this PCT.'))
>
>  As mentioned above, they work in Admin lists:
>
> list_display = ('data_name','prj_name','published','ct_id')
> admin.site.register(DvBoolean, DvBooleanAdmin)
>
>  In function based views to create JSON for DynaTree:
>
> pct_json['tooltip'] = 'ct-'+pct.ct_id + " : " +pct.description
>
>  But in a CBV, this raises the error:
>
> fields =['published','prj_name','data_name',ct_id,]
>
>  Any ideas on how to make this work? I only want to render them for
> display, not for editing.
>
> Thanks,
>
> Tim
>
> PS. This question is also on StackOverflow at:   http://goo.gl/mA7I6V
>
> --
> MLHIM VIP Signup: http://goo.gl/22B0U
> 
> Timothy Cook, MSc   +55 21 94711995
> MLHIM http://www.mlhim.org
> Like Us on FB: https://www.facebook.com/mlhim2
> Circle us on G+: http://goo.gl/44EV5
> Google Scholar: http://goo.gl/MMZ1o
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3XSznEtPsN7zcRspQR17NkTNb%2BBa0SO1V2pHmBSc%3DWhag%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to hide the "save and add another" button in admin page?

2014-01-20 Thread m1chael
How about extending a template and issuing a CSS visibility ?

On Mon, Jan 20, 2014 at 3:01 AM, parnigot  wrote:
> If your method ModelAdmin.has_add_permission() returns always False even a
> superuser can’t add the initial entry using the admin. But you can:
>
> Add the initial entry using the command line.
> Write a more complex has_add_permission method that checks if the
> request.user is a superuser or checks if  the initial entry already exists.
>
>
> e.p.
>
> Il giorno 19/gen/2014, alle ore 18:34, RLF_UNIQUE  ha
> scritto:
>
> Ah I see, give a user change permission but not add or remove? Then just use
> superaccount to make initial entry?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f2b936f2-7107-4dad-bd3a-364cae68cb37%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8154DDBF-5293-4355-84D6-FB49FF2FE040%40gmail.com.
>
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAuoY6OY8fPCKmXVsg6aC_%2BYTq%3DMowuyo64cTot2jCxKgfbL3g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Overriding admin sidebar

2014-01-20 Thread Larry Martell
I am trying to override the admin sidebar block. As a starting point I
just copied the entire block from the django index template into my
own index.html file. But I am getting:

Error during template rendering

In template /usr/local/motor/motor/ui/templates/admin/index.html,
error at line 6

This is the contents of my index.html file:

{% extends "admin/index.html" %}

{% block sidebar %}


{% trans 'Recent Actions' %}
{% trans 'My Actions' %}
{% load log %}
{% get_admin_log 10 as admin_log for_user user %}
{% if not admin_log %}
{% trans 'None available' %}
{% else %}

{% for entry in admin_log %}

{% if entry.is_deletion or not entry.get_admin_url %}
{{ entry.object_repr }}
{% else %}
{{
entry.object_repr }}
{% endif %}

{% if entry.content_type %}
{% filter capfirst %}{%
trans entry.content_type.name %}{% endfilter %}
{% else %}
{% trans 'Unknown
content' %}
{% endif %}

{% endfor %}

{% endif %}


{% endblock %}

What am I doing wrong here?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY4r2EghGtCM7JgPN9bG9zE%2BRPiQ5eJQRhTj0N-YiJxdjw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Flatpages - Django 1.5.1

2014-01-20 Thread James
 

I’m having trouble implementing flatpages in Django 1.5.1 - I’m new to 
Django/Python (~3 months) so any insight is appreciated.

I’ve added flatpages in APPS and MIDDLEWARE_CLASSES and ran a syncdb:

INSTALLED_APPS = (

'django.contrib.auth',

'django.contrib.contenttypes',

'django.contrib.sessions',

'django.contrib.sites',

'django.contrib.messages',

'django.contrib.staticfiles',

# Uncomment the next line to enable the admin:

'django.contrib.admin',

# Uncomment the next line to enable admin documentation:

'django.contrib.admindocs',

'django.contrib.flatpages',

'blog',

)


MIDDLEWARE_CLASSES = (

'django.middleware.common.CommonMiddleware',

'django.contrib.sessions.middleware.SessionMiddleware',

'django.middleware.csrf.CsrfViewMiddleware',

'django.contrib.auth.middleware.AuthenticationMiddleware',

'django.contrib.messages.middleware.MessageMiddleware',

'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',

)

I logged into Django admin and created:

URL: /about/

Title: About

Content: testing…

Sites:  127.0.0.1:8000

I clicked ‘view on site’ within the Django admin > flatpages > /about/ and 
I get sent to http://localhost:8000/about/ which returns a 404.  I opened 
up a SQLite browser and I can see that my page is in the db.  Am I missing 
anything else?

Thanks

James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/019cf512-4712-4af0-9bde-0db7c46d71d0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Exception on start django server in windows 7

2014-01-20 Thread Moisés Batista dos Santos Filho
Hi, everyone. I need help!
I was reading django's tutorial when the next step was start server. But 
when I put this instruction in command line, python manage.py runserver:



I'm trying solve this error but no successful.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cfea2648-ecfe-4533-b6be-912d1fd5c4f0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


UnicodeDecodeError in python manage.py flush

2014-01-20 Thread Edgar Reyes
Hi, I'm looking in google search about this error but I didn't find 
anything similar.

Any suggestions ?

python manage.py flush
You have requested a flush of the database.
This will IRREVERSIBLY DESTROY all data currently in the 'cbbc' database,
and return each table to the state it was in after syncdb.
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"/usr/local/pythonenv/DJANGO_1.6_py_2.7.3/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 399, in execute_from_command_line
utility.execute()
  File 
"/usr/local/pythonenv/DJANGO_1.6_py_2.7.3/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/usr/local/pythonenv/DJANGO_1.6_py_2.7.3/local/lib/python2.7/site-packages/django/core/management/base.py",
 
line 249, in run_from_argv
stderr.write('%s: %s' % (e.__class__.__name__, e))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 343: 
ordinal not in range(128)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4c119cf8-594f-4ba1-8005-3d520ff4d9d7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Exception on start django server in windows 7

2014-01-20 Thread Ramiro Morales
On Mon, Jan 20, 2014 at 9:08 PM, Moisés Batista dos Santos Filho <
msneofi...@gmail.com> wrote:

> Hi, everyone. I need help!
> I was reading django's tutorial when the next step was start server. But
> when I put this instruction in command line, python manage.py runserver:
>
>
> 
>
> I'm trying solve this error but no successful.
>

does by chance the host name of your Windows workstation have a non-ASCII
(e.g. an accented) character?

If so, as a temporary workaround, try changing it to a pure-ASCII one.

Also in the future pklease copy and paste the text of error messages like
this in the body of the email intead of attaching a screen capture. This is
better for getting the content indexted by search engines.

Also you might wat to widen the size of your terminal to to not get these
ugly line wraps.

-- 
Ramiro Morales
@ramiromorales

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO7PdF-%2Bns-KhuZnVrN0%2BTmWMN-OWA0B-J4gXBvy%3D4dNoTkObw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Question about customizing Django's session backend.

2014-01-20 Thread Chen Xu
Hi everyone,
I am wondering if there is a way to customize django's session backend like
we can do it for user authentication backend, the reason why I ask this is
that when I call django.contrib.auth.login, it gives me the error no
django_session table since I am using sqlalchemy, I did not do python
manage.py syncdb at all.

Thanks in advance.

-- 
⚡ Chen Xu ⚡

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACac-qZ-MRhPkAtKC7szaAkCmNkOxXysTr40PQ_qbpksMBjw8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Exception on start django server in windows 7

2014-01-20 Thread Sam Lai
It's due to the accent on the e in your username. This is a 'bug' in the
way Python works with the Windows command prompt.

Long story short, just move the 'Python' directory out from your Desktop to
somewhere just on your C:\ drive (so your username isn't in the path) and
everything will work, e.g. C:\Python. Maybe C:\work\Python would be a more
descriptive path.


On 21 January 2014 11:08, Moisés Batista dos Santos Filho <
msneofi...@gmail.com> wrote:

> Hi, everyone. I need help!
> I was reading django's tutorial when the next step was start server. But
> when I put this instruction in command line, python manage.py runserver:
>
>
> 
>
> I'm trying solve this error but no successful.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/cfea2648-ecfe-4533-b6be-912d1fd5c4f0%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABxbXqUZeTNQWnsNOi2xUBsPhzO2Oom6GNv7VxURQBFBwuoK4A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: UnicodeDecodeError in python manage.py flush

2014-01-20 Thread Sam Lai
It looks like you have named one of your model classes with a name
that contains a non-ASCII character. Stick with class names with only
a-z, A-Z, 0-9 characters and see if that helps.

On 21 January 2014 10:29, Edgar Reyes  wrote:
> Hi, I'm looking in google search about this error but I didn't find anything
> similar.
>
> Any suggestions ?
>
> python manage.py flush
> You have requested a flush of the database.
> This will IRREVERSIBLY DESTROY all data currently in the 'cbbc' database,
> and return each table to the state it was in after syncdb.
> Are you sure you want to do this?
>
> Type 'yes' to continue, or 'no' to cancel: yes
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File
> "/usr/local/pythonenv/DJANGO_1.6_py_2.7.3/local/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 399, in execute_from_command_line
> utility.execute()
>   File
> "/usr/local/pythonenv/DJANGO_1.6_py_2.7.3/local/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 392, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/usr/local/pythonenv/DJANGO_1.6_py_2.7.3/local/lib/python2.7/site-packages/django/core/management/base.py",
> line 249, in run_from_argv
> stderr.write('%s: %s' % (e.__class__.__name__, e))
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 343:
> ordinal not in range(128)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4c119cf8-594f-4ba1-8005-3d520ff4d9d7%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABxbXqVHy_PntCHA0qJR43f9ANKxy40Q8bm5WQndvNnbXhqvYw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Question about customizing Django's session backend.

2014-01-20 Thread Начаров Михаил

Hi Chen.

There are several session backends in django: database, cached, 
file-based. You can read about them on this page 
. But I 
didn't see obstacles for using default django configuration. You can use 
django models for django contrib application, while in your own apps 
still using sqlalchemy.


Cheers!


21.01.2014 11:04, Chen Xu пишет:

Hi everyone,
I am wondering if there is a way to customize django's session backend 
like we can do it for user authentication backend, the reason why I 
ask this is that when I call django.contrib.auth.login, it gives me 
the error no django_session table since I am using sqlalchemy, I did 
not do python manage.py syncdb at all.


Thanks in advance.

--
⚡ Chen Xu ⚡
--


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52DE0671.101%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Question about customizing Django's session backend.

2014-01-20 Thread Chen Xu
I see, thanks for your answer, however I encounter an error that says
'User'  object has no attribute 'pk' when I try to do:
login(request, user).

Could someone help?



On Tue, Jan 21, 2014 at 12:32 AM, Начаров Михаил  wrote:

>  Hi Chen.
>
> There are several session backends in django: database, cached,
> file-based. You can read about them on this 
> page.
> But I didn't see obstacles for using default django configuration. You can
> use django models for django contrib application, while in your own apps
> still using sqlalchemy.
>
> Cheers!
>
>
> 21.01.2014 11:04, Chen Xu пишет:
>
> Hi everyone,
> I am wondering if there is a way to customize django's session backend
> like we can do it for user authentication backend, the reason why I ask
> this is that when I call django.contrib.auth.login, it gives me the error
> no django_session table since I am using sqlalchemy, I did not do python
> manage.py syncdb at all.
>
>  Thanks in advance.
>
>  --
> ⚡ Chen Xu ⚡
>  --
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/52DE0671.101%40gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
⚡ Chen Xu ⚡

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACac-qYPKLPUjqmbVTtosyNN%3DqxdbnwO7GZL2tXKOV7ZtLSYPw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-20 Thread Johannes Schneider

maybe I I formulated it not precise enough.
I need to check if some instance of a model comes from some database 
query (e.g. via get(..)) or is instanciated 'by hand'. and not jet 
written to the database.
In this case I don't need to know, if there is an related object (e.g. 
with the same pk or same values for its attributes) in the database.


bg,
Johannes

On 20.01.2014 18:21, Avraham Serour wrote:

well you have a problem then, the database is the one holding the data,
if you want to know if the data exists will would need to ask the one
responsible for it, if not the DB then who?

you could keep a copy in memory but then you will have two problems. are
you actually having problems with exists() or is this just premature
optimization?


On Mon, Jan 20, 2014 at 6:13 PM, Johannes Schneider
mailto:johannes.schnei...@galileo-press.de>> wrote:

I don't do, because I don't want do to have a query against the
database.


On 20.01.2014 16:25, Kelly Nicholes wrote:

Wait-- Why aren't you using exists()?  Don't even check the pk.
  Model.query.exists() was made for this.



--
Johannes Schneider
Webentwicklung
johannes.schneider@galileo-__press.de

Tel.: +49.228.42150 .xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0  (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to django-users+unsubscribe@__googlegroups.com
.
To post to this group, send email to django-users@googlegroups.com
.
Visit this group at http://groups.google.com/__group/django-users
.
To view this discussion on the web visit

https://groups.google.com/d/__msgid/django-users/52DD4B1B.__9020508%40galileo-press.de

.

For more options, visit https://groups.google.com/__groups/opt_out
.


--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAFWa6tLNikRya2Fyji_WSgFd9QE9qDNmrhNEsUDj2hQd2t7ieQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52DE28A9.8060902%40galileo-press.de.
For more options, visit https://groups.google.com/groups/opt_out.