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

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

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

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

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,

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

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

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

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

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',

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

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

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.

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

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

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

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

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

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

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

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

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

"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

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

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

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

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

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

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

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

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:

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

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

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

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

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

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