Re: Initial install

2011-04-22 Thread José Pablo Méndez Soto
Thank you Pedro.

I know both options work. What I don't quite understand is if running

sudo python setup.py install

Would be sufficient setup for my Django + CDR Stats + MySQL setup. It looks
though, like I also need MySQLdb to interface between Django and the DB. Im
wondering if the devs from CDR-Stats.org want me to do that...

Would you say its definitely required going through the mysqldb procedure?

 *José Pablo Méndez
*


On Fri, Apr 22, 2011 at 8:30 PM, Pedro Kroger wrote:

> Hi Hurin,
>
> Both versions will work fine with MySql, but I recommend you install
> the latest official version (version 1.3), specially if you haven't
> worked with Django before. You can read the quick install guide here:
>
> http://docs.djangoproject.com/en/1.3/intro/install/
>
> And the more complete guide here:
>
> http://docs.djangoproject.com/en/1.3/topics/install/
>
> Cheers,
>
> Pedro Kroger
>
> On Fri, Apr 22, 2011 at 10:50 PM, Hurin  wrote:
> > Hi, using Django framework for CDR-Stats + Asterisk. The instructions
> > kind of confuses me. The How to get Django section has 2 options:
> > -Get the latest official version
> > and
> > - Get the latest development version
> >
> > I am choosing the first one, but after that, it says:
> >
> > After you get it
> > See the installation guide for further instructions.
> >
> >
> >
> > My question is: is Option 1 enough to setup my environment for CDR-
> > Stats? I want to use it with  a MYSQL DB, so I am not entirely sure I
> > would have to follow the installation guide.
> >
> > 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
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
> >
>
>
>
> --
> http://pedrokroger.net
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django 1.1 performance versus django 1.2 performance

2011-04-22 Thread Russell Keith-Magee
> On Fri, Apr 22, 2011 at 9:22 PM, Shawn Milochik  wrote:
>>
>> This was mentioned in Eric Florenzano's talk at DjangoCon 2010. Each
>> version has gotten slower.
>>
>> I haven't heard anything about the cause or plans to fix this, though.
>> If you've got a good test suite you can always use tools like Python's
>> profile module to track down slowdowns in your Django code and
>> contribute that knowledge to the developers' list.
>>

On Sat, Apr 23, 2011 at 11:26 AM, Peter Portante
 wrote:
> Is there a plan in place to address this?

No - there isn't a plan to address this, because it isn't clear what "this" is.

While it is known that there has been a slowdown between versions,
that slowdown has been accompanied by a massive increase in
functionality -- for example, the 1.1->1.2 transition introduced
support for multiple databases. To the best of my knowledge, the
performance slowdown highlighted by Eric at Djangocon was relatively
small - 5-10%, not on the order of 30-50% slowdown. This matches with
my personal experience of upgrading.

There are two performance issues in database operations that I'm aware
of that people commonly point to.

Firstly -- deep cloning of query sets. Cloning a queryset is an
expensive operation, and if you are making extensive use of operations
that clone (e.g., very long chains of complex filters) you may see
performance issues. This isn't something that can be easily avoided --
in order to preserve the API guarantees of a query set, deep cloning
is required.

Secondly, the backwards compatibility infrastructure introduced in
order to support multiple databases. In order to guarantee backwards
compatibility, the value preparation methods on fields needed to use
some moderately expensive introspection methods. However because these
methods were introduced for 1.2, and we're currently preparing 1.4,
these introspection methods have just been removed from trunk.

Beyond these two issues -- we're always interested in improving
performance, so if you can identify a specific performance issue,
we're happy to look at it. The more evidence you can provide (profile
runs, sample queries that are observably slower, and so on), the
easier it will be to address these problems.

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django 1.1 performance versus django 1.2 performance

2011-04-22 Thread Peter Portante
Is there a plan in place to address this?

On Fri, Apr 22, 2011 at 9:22 PM, Shawn Milochik  wrote:

> This was mentioned in Eric Florenzano's talk at DjangoCon 2010. Each
> version has gotten slower.
>
> I haven't heard anything about the cause or plans to fix this, though.
> If you've got a good test suite you can always use tools like Python's
> profile module to track down slowdowns in your Django code and
> contribute that knowledge to the developers' list.
>
> Shawn
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to register EmployeeAdmin using atributes in Person class

2011-04-22 Thread Ramiro Morales
On Fri, Apr 22, 2011 at 11:55 PM, Guevara  wrote:
> [...]
>
> class Person(models.Model):
>    name = models.CharField(max_length=50)
>    date_inclusion = models.DateField()
>
> class Employee(models.Model):
>    person = models.OneToOneField(Pessoa)
>
> I reed this doc http://docs.djangoproject.com/en/dev/ref/contrib/admin/
> but could not find this information.

Try with

class Employee(Person):
    person = models.OneToOneField(Person, parent_link=True)

or simply with

class Employee(Person):
pass

It you don't want/need control of the name of the 1to1 relationship
between Employee and Person.

Also, see

http://docs.djangoproject.com/en/dev/ref/models/fields/#onetoonefield
http://docs.djangoproject.com/en/dev/topics/db/models/#multi-table-inheritance
http://docs.djangoproject.com/en/dev/topics/db/models/#specifying-the-parent-link-field

-- 
Ramiro Morales

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: logout problem - NameError - newbie

2011-04-22 Thread Marg Wilkinson
Good call - thanks Shawn - totally forgot to check the imports - the
joys of being a newbie.

Thanks for the quick reply.

On Apr 23, 11:24 am, Shawn Milochik  wrote:
> It's probably that you didn't import 'farewell' from views.py in
> urls.py, so it's not in scope.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to register EmployeeAdmin using atributes in Person class

2011-04-22 Thread Guevara
Hello!

I need register EmployeeAdmin using atributes in Person class:

My admin.py:

class EmployeeAdmin(admin.ModelAdmin):
list_display = ("name","date_inclusion")
ordering = ["-name"]
search_fields = ("name",)
list_filter = ("date_inclusion",)
list_per_page = 10

admin.site.register(Employee,EmployeeAdmin)

I got this exception:

Exception Value is:

EmployeeAdmin.list_display[0], 'name' is not a callable or an
attribute of 'EmployeeAdmin' or found in the model 'Employee'.

My models.py:

class Person(models.Model):
name = models.CharField(max_length=50)
date_inclusion = models.DateField()

class Employee(models.Model):
person = models.OneToOneField(Pessoa)

I reed this doc http://docs.djangoproject.com/en/dev/ref/contrib/admin/
but could not find this information.

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Initial install

2011-04-22 Thread Pedro Kroger
Hi Hurin,

Both versions will work fine with MySql, but I recommend you install
the latest official version (version 1.3), specially if you haven't
worked with Django before. You can read the quick install guide here:

http://docs.djangoproject.com/en/1.3/intro/install/

And the more complete guide here:

http://docs.djangoproject.com/en/1.3/topics/install/

Cheers,

Pedro Kroger

On Fri, Apr 22, 2011 at 10:50 PM, Hurin  wrote:
> Hi, using Django framework for CDR-Stats + Asterisk. The instructions
> kind of confuses me. The How to get Django section has 2 options:
> -Get the latest official version
> and
> - Get the latest development version
>
> I am choosing the first one, but after that, it says:
>
> After you get it
> See the installation guide for further instructions.
>
>
>
> My question is: is Option 1 enough to setup my environment for CDR-
> Stats? I want to use it with  a MYSQL DB, so I am not entirely sure I
> would have to follow the installation guide.
>
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
http://pedrokroger.net

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Initial install

2011-04-22 Thread Hurin
Hi, using Django framework for CDR-Stats + Asterisk. The instructions
kind of confuses me. The How to get Django section has 2 options:
-Get the latest official version
and
- Get the latest development version

I am choosing the first one, but after that, it says:

After you get it
See the installation guide for further instructions.



My question is: is Option 1 enough to setup my environment for CDR-
Stats? I want to use it with  a MYSQL DB, so I am not entirely sure I
would have to follow the installation guide.

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: logout problem - NameError - newbie

2011-04-22 Thread Shawn Milochik
It's probably that you didn't import 'farewell' from views.py in
urls.py, so it's not in scope.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django 1.1 performance versus django 1.2 performance

2011-04-22 Thread Shawn Milochik
This was mentioned in Eric Florenzano's talk at DjangoCon 2010. Each
version has gotten slower.

I haven't heard anything about the cause or plans to fix this, though.
If you've got a good test suite you can always use tools like Python's
profile module to track down slowdowns in your Django code and
contribute that knowledge to the developers' list.

Shawn

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django 1.1 performance versus django 1.2 performance

2011-04-22 Thread djeff
Hey,

We are in the process of migrating from Django 1.1 to Django 1.2.5 and
I'm investigating a performance slowdown in our unit tests.  We see
about a 30% slowdown when running our unit test suite with 1.2.5
versus 1.1.  I was just wondering if anyone else had noticed something
similar to this.

Here are some details of what I've investigated so far.  I've compared
the time an individual unit test takes to run, as well as the entire
test suite and we consistently see 30-40% increase in the time of
execution with Django 1.2.5 compared to 1.1.  It appears the slowdown
happens inside the Django database layer.  I've timed tests that have
more complicated database queries as well as simple select statements
that return a large result set as well as a result of 1 and I notice
the difference in the time it takes the test to complete.   I've
compared the SQL output from queries running with 1.1 and 1.2
wondering if the SQL was different between the two Django's, but the
SQL is relatively the same.  Using cProfile and runsnake, I've been
investigating the profile dump and a difference I notice between 1.2
and 1.1 is that on 1.2, there seems to be more time spent in clone()
in django/db/models/queries.py and django/db/models/sql/queries.py
compared to Django 1.1.

I'm looking for any feedback that anyone has.  Have you seen a similar
difference in performance with 1.2.5?  Have you narrowed down to where
that would be occurring?  I'd appreciate any suggestions that you
have.  Our application is ramping up on traffic with the potential for
significant growth coming soon, so we are really concerned about our
performance moving forward.

Thanks in advance!

djeff

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



logout problem - NameError - newbie

2011-04-22 Thread Marg Wilkinson
Hi,

I'm a total newbie slogging my way through a tutorial. I've reached an
impasse with logging off

In views my code includes


from django.contrib.auth import logout

def farewell(request):
logout(request)
return HttpResponseRedirect('/')
---

and urls.py has the lines

-
urlpatterns = patterns('',
 url(r'^admin/', include(admin.site.urls)),
 url(r'^$', main_page),
 url(r'^user/(\w+)/$', user_page),
 url(r'^login/$', 'django.contrib.auth.views.login',
{'template_name': 'registration/login.html'}),
 url(r'^logout/$',farewell),



http://127.0.0.1:8000/farewell  (or anything after the 8000/)  gives
me an error
-
Exception Value:

name 'farewell' is not defined


OK  but farewell looks defined to me in views.py,so what am I
missing?

(BTW - originally I was trying to use logout for my def instead of
farewell, with appropriate urls.py changes - same error except it
specified that "logout" was not defined.)

Can anyone please point a newbie in the right direction?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Facebook Deauth signed_request

2011-04-22 Thread v1nce
Facebook signed_request POST parameter seems to get pre-processed by
Django - http://developers.facebook.com/docs/authentication/signed_request/

Here is what I'm getting back in my view instead:

,
POST:,
COOKIES:{},


-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



ORM help

2011-04-22 Thread Daniel Gerzo

Hello guys,

I have a following models:

class Movie(models.Model):
title = models.CharField(max_length=255)
year = models.IntegerField(max_length=4)
rating = models.DecimalField(max_digits=2, decimal_places=1, default=0)

class Request(models.Model):
movie = models.ForeignKey(Movie)
user = models.ForeignKey(User)
language = models.CharField(max_length=7, db_index=True)
notes = models.CharField(max_length=255, blank=True, null=True)
added = models.DateTimeField(default=datetime.now)

I want to get all Requests, with count per each pair of Movie and language.

So far I got this:
Request.objects.values('movie', 'language').annotate(Count('language'))

That seems to give me almost what I want, but that way I get a 
ValueQuerySet. Is there a way to get or convert this to a QuerySet? I'd 
like to get an easy way to access Movie attributes from the above query 
as I will need to display movie title and rating in the template for 
each result from the above query.


So, is there some better way of what am I trying to accomplish? If not, 
how should I proceed in retrieving the Movie attributes? Will I need to 
fetch those with something like Movie.objects.filter(pk__in=[list of 
ids]) and then manually map those?


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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unicode translation problem

2011-04-22 Thread Kenny Meyer
On Fri, Apr 22, 2011 at 4:22 PM, John Maines  wrote:
> Hello,
>
> I am going through the Django Tutorials on the Django home page. All
> has gone fine, except one thing:
>
> When building the admin page, I can't get the unicode translator to
> work. It is supposed to change "Poll: Poll object" to readable text.
> It just doesn't work. I am using PostgreSQL set for UTF8 encoding.
> Running on Windows.
>
> Any ideas? Thank you.

The problem you are trying to solve is not clear to me. Reformulate
your question, please.

> Here are the instructions that fail:
>
> "Wait a minute.  is, utterly, an unhelpful
> representation of this object. Let's fix that by editing the polls
> model (in the polls/models.py file) and adding a __unicode__() method
> to both Poll and Choice:"

Check out what the __unicode__() method is all about:
http://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#unicode

For general information of Unicode support in Django you may find here:
http://docs.djangoproject.com/en/dev/ref/unicode/

>
> class Poll(models.Model):
>    # ...
>    def __unicode__(self):
>        return self.question
>
> class Choice(models.Model):
>    # ...
>    def __unicode__(self):
>        return self.choice
>
> --
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



DZone wants to make a Django 'Refcard'

2011-04-22 Thread DZone
Hi all,

I'm the chief editor at DZone.com, a social linking and blogging
community for developers.  We've got this weekly 6pg cheat sheet
(sorta like spark charts) that we produce every week on a developer
topic.  Look here for some examples: refcardz.dzone.com   Russ Magee
showed me a RevSys cheatsheet on Django, which just contains 2 pages
of essential code.  This Refcard would include more text and
explanation of key concepts along with the essential code references.

Even after 130 cards, we really haven't been able to produce a refcard
on Python (we already have cards on PHP, Core Java, Ruby, etc.)  I
wanted to see if any of you were interested in authoring a refcard on
Core Python, Django, or both.  The docs for both projects are really
good, but these reference charts distill the most important tips and
code snippets for getting started with these technologies.  I know a
lot of devs in our community (mostly Java developers) are interested
in Python and may not be familiar with Django.  This content could
give them a nudge to start learning.

Send me an email if you want more details.

Best,
_
mi...@dzone.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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: db routing by request

2011-04-22 Thread Michael P. Soulier
On 19/04/11 Jacob Kaplan-Moss said:

> Probably not -- that'd be a pretty heinous violation of separation of
> concerns. Remember that Django can (and often is) used outside of a
> web request/response cycle (think management commands, cron jobs,
> interactive shells, ...).
> 
> The right way is indeed to use `using()` and leave session-specific
> handling where it belongs, in the views.
> 
> [If you insist on making it automagical, you could stuff the request
> object in a threadlocal. That wouldn't pass *my* code review, but
> luckily you don't work for me :)]

The issue is a need to run a single UI over multiple virtual instance of an
application, each with its own database. So, based on which virtual instance
of the app is being managed, I want to route to a particular database
corresponding to that application.

Mike
-- 
Michael P. Soulier 
"Any intelligent fool can make things bigger and more complex... It takes a
touch of genius - and a lot of courage to move in the opposite direction."
--Albert Einstein


signature.asc
Description: Digital signature


Re: Unicode translation problem

2011-04-22 Thread Shawn Milochik
What does "it just doesn't work" mean? What errors are you getting?
What is it doing or not doing?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Unicode translation problem

2011-04-22 Thread John Maines
Hello,

I am going through the Django Tutorials on the Django home page. All
has gone fine, except one thing:

When building the admin page, I can't get the unicode translator to
work. It is supposed to change "Poll: Poll object" to readable text.
It just doesn't work. I am using PostgreSQL set for UTF8 encoding.
Running on Windows.

Any ideas? Thank you.

Here are the instructions that fail:

"Wait a minute.  is, utterly, an unhelpful
representation of this object. Let's fix that by editing the polls
model (in the polls/models.py file) and adding a __unicode__() method
to both Poll and Choice:"

class Poll(models.Model):
# ...
def __unicode__(self):
return self.question

class Choice(models.Model):
# ...
def __unicode__(self):
return self.choice

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: cx_Oracle error: ImproperlyConfigured

2011-04-22 Thread kamal sharma
Yes, i am getting this error when i used from the web application. Also all the
user have the permission to webserver to read all Oracle client files.

Not sure how it got set to LD_LIBRARY_PATH
/opt/apache-2.2.16/lib:/usr/local/lib:

I have defined the LD_LIBRARY_PATH and ORACLE_HOME as follows in .profile

export ORACLE_HOME=/opt/app/oracle/products/11.2.0
export LD_LIBRARY_PATH=/opt/app/oracle/products/11.2.0/lib

Also tried it in .cshrc file also. But nothing is working.

setenv ORACLE_HOME "/opt/app/oracle/products/11.2.0"
setenv LD_LIBRARY_PATH "$ORACLE_HOME/lib32:$ORACLE_HOME/lib"
setenv LD_LIBRARY_PATH /usr/X11R6/lib:/usr/local/lib


I have written a sample script and it works, when i run from the command
prompt.

filename: test_db.py
import cx_Oracle
from pprint import pprint

connection = cx_Oracle.Connection("%s/%s@%s" % ('foo', 'bar', 'db'))
cursor = cx_Oracle.Cursor(connection)
sql = "SELECT name FROM prs where rownum < 10"
cursor.execute(sql)
data = cursor.fetchall()
pprint(data)
cursor.close()
connection.close()

Getting proper output:

[me] ~/install_cx_oracle> /usr/local/bin/python test_db.py
[('Robert Craig',),
 ('Darren Kerr',),
 ('Aviva Garrett',),
 ('Pasvorn Boonmark',),
 ('Dave Wittbrodt',),
 ('Pasvorn Boonmark',),
 ('Rajkumaran Chandrasekaran',),
 ('Pasvorn Boonmark',),
 ('Pasvorn Boonmark',)]

 But samething when i write in django views.py then getting exception.


Request Method: GET
Request URL: https://server/web/test/cases
Django Version: 1.2.1
Exception Type: DatabaseError
Exception Value: Error while trying to retrieve text for error ORA-01804
Exception Location: /web/views.py in cases, line 43
Python Executable: /bin/python
Python Version: 2.6.6

Thanks,



On Thu, Apr 21, 2011 at 3:37 PM, kamalp.sha...@gmail.com <
kamalp.sha...@gmail.com> wrote:

> Hi,
>
> I have installed cx_Oracle module in one of my Solaris box and then
> trying to create a django page to read data from oracle db. But I am
> getting following errors.
>
>
> mod_wsgi (pid=2600): Exception occurred processing WSGI script '/opt/
> www/ui/foo/web/app.wsgi'.
> Traceback (most recent call last):
> File "/opt/www/ui/foo/web/app.wsgi", line 30, in application
> return _application(environ, start_response)
> File "/usr/local/packages/python/2.6.6/lib/python2.6/site-packages/
> django/core/handlers/wsgi.py", line 230, in __call__
> self.load_middleware()
> File "/usr/local/packages/python/2.6.6/lib/python2.6/site-packages/
> django/core/handlers/base.py", line 42, in load_middleware
> raise exceptions.ImproperlyConfigured('Error importing middleware %s:
> "%s"' % (mw_module, e))
> ImproperlyConfigured: Error importing middleware web.web.framework:
> "ld.so.1: httpd: fatal: libclntsh.so.11.1: open failed: No such file
> or directory"
>
>
> I have tried from python shell and i can able to import cx_Oracle
> module as follows:
>
> bash-3.00$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
> bash-3.00$ python
> Python 2.4.4 (#1, Jan 10 2007, 01:25:01) [C] on sunos5
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import cx_Oracle
> >>>
>
> But from the web I am getting the ImproperlyConfigured: configured
> error. Can someone please help me to resolve this issue.
>
> FYI,
>
> I have followed this link to install cx_oracle module.
>
> http://agiletesting.blogspot.com/2005/05/installing-and-using-cxoracle-on-unix.html
>
> Please let me know if you need more info.
>
> Thanks,
> Kamal
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django ORM question about lookups that span relationships

2011-04-22 Thread Michael Radziej
On Fri, 22 Apr 2011 13:08:17 -0500, Jacob Kaplan-Moss  
wrote:
> Blog.objects.raw('''SELECT * FROM blog

Hey, that's cheating :-)


> No, really -- if I was faced with a query, like this, that was easier
> to express with SQL, I'd reach for `raw()` long before trying to
> figure if I could twist the ORM to do my bidding.

Yes, but while raw() has its uses, it's an interesting question: Is
there a way to do this with the Django ORM or not? It's always hard to
write raw queries in a database independent way, so there are good cases
where you want to avoid raw().


Kind regards

Michael

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django ORM question about lookups that span relationships

2011-04-22 Thread Jacob Kaplan-Moss
On Fri, Apr 22, 2011 at 5:36 AM, Michael Radziej  wrote:
> In SQL, it's something along
>
> SELECT ... FROM blog
> JOIN entry e1 on e1.entry_id = blog.id
>     AND e1.pub_date <= ...
>     AND e1.headline LIKE "%Easter%"
>     AND NOT exists
>     ( SELECT id from entry e2
>       WHERE e2.entry_id = blog.id
>       AND e2.pub_date <= ...
>       AND e2.pub_date > e1.pub_date
>     )
>
> Well ... even after 5 years with Django, I still think more in SQL than
> in Django ORM. Does anyone know how to that in the ORM?

Blog.objects.raw('''SELECT * FROM blog
JOIN entry e1 on e1.entry_id = blog.id
AND e1.pub_date <= ...
AND e1.headline LIKE "%Easter%"
AND NOT exists
( SELECT id from entry e2
  WHERE e2.entry_id = blog.id
  AND e2.pub_date <= %s
  AND e2.pub_date > e1.pub_date
)''', [pub_date])

...

No, really -- if I was faced with a query, like this, that was easier
to express with SQL, I'd reach for `raw()` long before trying to
figure if I could twist the ORM to do my bidding.

Jacob

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: extending a shopping cart

2011-04-22 Thread Shawn Milochik
I think you just re-invented generic foreign keys:

http://docs.djangoproject.com/en/1.3/ref/contrib/contenttypes/#generic-relations

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



extending a shopping cart

2011-04-22 Thread shofty

say for instance you had a CartItem that was laid out pretty much as
follows

class CartItem(models.Model):
cart_id = models.CharField(max_length=50)
date_added = models.DateTimeField(auto_now_add=True)
quantity = models.IntegerField(default=1)
size = models.CharField(max_length=20)
product = models.ForeignKey('shop.Product', unique=False)

and you extended the shop to include products that can be found in
different apps, eg shop.Product as well as farm.Product
This has been done because the two Product models are vastly different
and so can't coexist in the same table.

is there a simple way of splitting the product out such that i can
refer to it as app and product, maybe by storing the app and the id?


class CartItem(models.Model):
cart_id = models.CharField(max_length=50)
product_app = models.CharField(max_length=50)
product_type = models.CharField(max_length=50)
product_id = models.CharField(max_length=50)

and if there is, how would i go about doing the following step:

p = get_object_or_404(Product, product_slug=product_slug)

im guessing there will need to be an intermediate step of

model = get_model(product_app, product_type)
p = get_object_or_404(model, id=product_id)


surely there is a far simpler cleverer way fo doing this? what do i
need to be reading about to do this?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: cx_Oracle error: ImproperlyConfigured

2011-04-22 Thread kamal sharma
I think i have done a mistake in my last cx_Oracle installation. Is this a
problem? I used one python while build and another while install.

ex: [me] ~/install_cx_oracle/cx_Oracle-5.0.3> /usr/local/bin/python setup.py
build
  [me] ~/install_cx_oracle/cx_Oracle-5.0.3> sudo python setup.py install

Now i am trying again, but not able to install.

[weevil] ~/install_cx_oracle/cx_Oracle-5.0.3> sudo /usr/local/bin/python
setup.py build install
running build
running build_ext
running install
running bdist_egg
running egg_info
creating cx_Oracle.egg-info
error: could not create 'cx_Oracle.egg-info': Permission denied

How to resolve this?

Thanks,
Kamal

On Fri, Apr 22, 2011 at 7:53 PM, Ian  wrote:

> On Apr 21, 11:40 pm, kamal sharma  wrote:
> > When i try the same code from python Shell then it is working fine.
>
> Okay, so it does sound to me like it's your web server blocking access
> to the entire ORACLE_HOME directory.
>
> Is it running under a chroot jail?  If so, then you will need to copy
> your entire Oracle client installation into the jail and use the
> chrooted path for your ORACLE_HOME and LD_LIBRARY_PATH.
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: cx_Oracle error: ImproperlyConfigured

2011-04-22 Thread Jirka Vejrazka
Are you getting this error only when using the app through a web server?
Have you verified that the web server does have ORACLE_HOME and
LD_LIBRARY_PATH correctly defined? (e.g. by logging it using os.environ).

Are you sure that the user that is used to run your webserver has
permissions to read all Oracle client files?

 Just thinking "loudly" :)

   Jirka

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: cx_Oracle error: ImproperlyConfigured

2011-04-22 Thread Ian
On Apr 21, 11:40 pm, kamal sharma  wrote:
> When i try the same code from python Shell then it is working fine.

Okay, so it does sound to me like it's your web server blocking access
to the entire ORACLE_HOME directory.

Is it running under a chroot jail?  If so, then you will need to copy
your entire Oracle client installation into the jail and use the
chrooted path for your ORACLE_HOME and LD_LIBRARY_PATH.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: cx_Oracle error: ImproperlyConfigured

2011-04-22 Thread kamal sharma
Hi Jirka,

Thanks for the response.

I have installed cx_Oracle in Solaris again and followed this steps but
still the error is same:

Exception Type:DatabaseErrorException Value:

Error while trying to retrieve text for error ORA-01804


Download cx_oracle module:
http://sourceforge.net/projects/cx-oracle/files/5.0.3/cx_Oracle-5.0.3.tar.gz/download

Install:

[me] ~/install_cx_oracle/cx_Oracle-5.0.3> gunzip cx_Oracle-5.0.3.tar.gz
[me] ~/install_cx_oracle/cx_Oracle-5.0.3> tar xvf cx_Oracle-5.0.3.tar
[me] ~/install_cx_oracle/cx_Oracle-5.0.3> cd cx_Oracle-5.0.3
[me] ~/install_cx_oracle/cx_Oracle-5.0.3> /usr/local/bin/python setup.py
build
running build
running build_ext
building 'cx_Oracle' extension
creating build
creating build/temp.solaris-2.10-sun4u-2.6-11g
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall
-Wstrict-prototypes -fPIC -I/opt/app/oracle/products/11.2.0/rdbms/demo
-I/opt/app/oracle/products/11.2.0/rdbms/public
-I/usr/local/stow/python/include/python2.6 -c cx_Oracle.c -o
build/temp.solaris-2.10-sun4u-2.6-11g/cx_Oracle.o -DBUILD_VERSION=5.0.3
In file included from
/opt/app/oracle/products/11.2.0/rdbms/public/oci.h:3024,
 from cx_Oracle.c:10:
/opt/app/oracle/products/11.2.0/rdbms/public/ociap.h:10788: warning:
function declaration isn't a prototype
/opt/app/oracle/products/11.2.0/rdbms/public/ociap.h:10794: warning:
function declaration isn't a prototype
creating build/lib.solaris-2.10-sun4u-2.6-11g
gcc -shared build/temp.solaris-2.10-sun4u-2.6-11g/cx_Oracle.o
-L/opt/app/oracle/products/11.2.0/lib -L/opt/app/oracle/products/11.2.0 -L.
-lclntsh -lpython2.6 -o build/lib.solaris-2.10-sun4u-2.6-11g/cx_Oracle.so

[me] ~/install_cx_oracle/cx_Oracle-5.0.3> echo $ORACLE_HOME/
/opt/app/oracle/products/11.2.0/

[me] ~/install_cx_oracle/cx_Oracle-5.0.3> sudo python setup.py install
Password:
running install
running build
running build_ext
running install_lib
copying build/lib.solaris-2.10-sun4u-2.4-11g/cx_Oracle.so ->
/usr/lib/python2.4/site-packages

[me] ~/install_cx_oracle/cx_Oracle-5.0.3> python
Python 2.4.4 (#1, Jan 10 2007, 01:25:01) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> cx_Oracle.version
'5.0.3'

Did i missed something?

Thanks,
Kamal

On Fri, Apr 22, 2011 at 3:20 PM, Jirka Vejrazka wrote:

> Hi Kamal,
>
>   checking my install history, this is what I had to do to use
> cx_Oracle on Ubuntu Server:
>
> $ /usr/local/oracle/instantclient_11_2$ ln -s libclntsh.so.11.1
> libclntsh.so
> $ WITH_UNICODE=1 ORACLE_HOME=/usr/local/oracle/instantclient_11_2
> python setup.py build
> $ sudo bash
> # WITH_UNICODE=1 ORACLE_HOME=/usr/local/oracle/instantclient_11_2
> python setup.py install
>
> and tested:
> $ export
> LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/oracle/instantclient_11_2
> $ python
> Python 2.5.2 (r252:60911, Jan 20 2010, 21:48:48)
> [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import cx_Oracle
> >>> cx_Oracle.version
> '5.0.3'
>
> Then I added the LD_LIBRARY_PATH to /etc/profile so it'd be used by
> all users, including the Apache process.
>
> The error you're getting is most likely caused by ORACLE_HOME not
> being set during cx_Oracle installation. To be extra sure, consider
> adding it to /etc/profile too.
>
>
>  HTH
>
>Jirka
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Best-practice for building URLs in templates with JavaScript

2011-04-22 Thread Shawn Milochik
I'm working on an app which makes extensive use of AJAX. I'm also
using named URLs so I don't have to hard-code URLs into my templates.

The problem is that if a URL pattern requires extra info after the
path, my templates don't render, because the extra parameters aren't
known until the user makes a selection.

The obvious solution is to make two URL patterns for each of these
URLs -- one with no extra parameters and one with. Then change the
former into the latter in the app by AJAX.

Is there a better way to do this?

Example:

#urls.py:
url(r'^update_payment/(?P\w+)', update_payment, name =
'update_payment'),

#template:
Update Payment {# this
expects a second argument I don't know yet #}

Thanks,
Shawn

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Custom form field

2011-04-22 Thread Derek
On Apr 20, 5:06 pm, Daniel Gagnon  wrote:
"The first one uses a jquery plugin that's discontinued and the second
one
 works only in the admin."

But that first project is live; did you contact the author and ask him/
her about plans to update it (especially as the jquery plugin in
question has a clear upgrade path)?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Custom fields and widgets in a ModelForm

2011-04-22 Thread James
Hey all,
A question about form fields and widgets: I want to use custom ones in
a ModelForm, but I'm not sure where to specify this.

I see the widgets dict in the ModelForm Meta class to control the
custom widgets, but no equivalent for custom form fields.

http://docs.djangoproject.com/en/1.3/topics/forms/modelforms/#overriding-the-default-field-types-or-widgets
suggests I should just do field_name = CustomFormField() on my
ModelForm, but when it comes to full_clean(), I don't see my custom
form field being used in ModelForm.fields...

Any suggestions much appreciated.

Thanks!
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



AW: problems: python manage.py syncdb

2011-04-22 Thread Szabo, Patrick (LNG-VIE)
Try to connect to the DB with a „real“ client and see i fit works at all.

The webserver (manage.py runserver) does not need to be running when you call 
syncdb.

 

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von ???
Gesendet: Freitag, 22. April 2011 13:57
An: django-users@googlegroups.com
Betreff: Re: problems: python manage.py syncdb

 

Hi:

I think you configuration for database(postgresql) is not correct , or your 
database is not running, make sure you can connect your database using you 
profile on settings,py

2011/4/22 Lancinè I KABA 

Hello!!!
I am new to django, and am running the tutorial.  I have edited
'settings.py' and am running "python manage.py runserver".

When I run the server and then call "python manage.py syncdb" against
my Postgres database, everything just hangs.

If I kill 'runserver', then I get this message from syncdb:

site-packages/Django-1.3-py2.4.egg/django/db/backends/
postgresql_psycopg2/base.py
line 140

self.connection = Database.connect(**conn_params)
psycopg2.OperationalError: could not connect to server:  Connection
refused

When I turn the server back on and run syncdb, it just hangs.  I try
turning on verbose and other options...but I see nothing.

It seems like something is talking to the server, but that is as far

KABA
Student in Le Mans, France


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


 Original Message 

Subject: problems: python manage.py syncdb
Date: Fri, 22 Apr 2011 10:17:05 +0200
From: 
To: 

Bonjour,

C'est pour demander de l'aide pour ce problème.

Avec la commande python manage.py syncdb ou python manage.py sql ou
python manage.py sqlall on a plusieurs ligne de d'erreur dont:

self.connection = database.connect(**conn_params)
psycopg2.OperationalError: could not connect to server: Connection
refused (0*274D/10061)

Ci joint la copie d'ecran de l'erreur


Merci de m'aider

KABA
Etudiant Le Mans, France

--
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 
django-users+unsubscr...@googlegroups.com 
 .
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




-- 
Thanks & Regards,
ezioruan = {
'email':'qiaoqinq...@gamil.com 
 ',
'interests':{ 'Python',  'Linux' 'game'},
'location':'南京',
'website':'http://ezioandnanjing.appspot.com/',
'note':'功名利禄身外物,知足常乐总逍遥'
}

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: problems: python manage.py syncdb

2011-04-22 Thread 阮明辉
Hi:
I think you configuration for database(postgresql) is not correct , or your
database is not running, make sure you can connect your database using you
profile on settings,py

2011/4/22 Lancinè I KABA 

> Hello!!!
> I am new to django, and am running the tutorial.  I have edited
> 'settings.py' and am running "python manage.py runserver".
>
> When I run the server and then call "python manage.py syncdb" against
> my Postgres database, everything just hangs.
>
> If I kill 'runserver', then I get this message from syncdb:
>
> site-packages/Django-1.3-py2.4.egg/django/db/backends/
> postgresql_psycopg2/base.py
> line 140
>
> self.connection = Database.connect(**conn_params)
> psycopg2.OperationalError: could not connect to server:  Connection
> refused
>
> When I turn the server back on and run syncdb, it just hangs.  I try
> turning on verbose and other options...but I see nothing.
>
> It seems like something is talking to the server, but that is as far
>
> KABA
> Student in Le Mans, France
>
>  Original Message 
> Subject: problems: python manage.py syncdb
> Date: Fri, 22 Apr 2011 10:17:05 +0200
> From: 
> To: 
>
> Bonjour,
>
> C'est pour demander de l'aide pour ce problème.
>
> Avec la commande python manage.py syncdb ou python manage.py sql ou
> python manage.py sqlall on a plusieurs ligne de d'erreur dont:
>
> self.connection = database.connect(**conn_params)
> psycopg2.OperationalError: could not connect to server: Connection
> refused (0*274D/10061)
>
> Ci joint la copie d'ecran de l'erreur
>
>
> Merci de m'aider
>
> KABA
> Etudiant Le Mans, France
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Thanks & Regards,
ezioruan = {
'email':'qiaoqinq...@gamil.com',
'interests':{ 'Python',  'Linux' 'game'},
'location':'南京',
'website':'http://ezioandnanjing.appspot.com/',
'note':'功名利禄身外物,知足常乐总逍遥'
}

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



shared authentication and profiles

2011-04-22 Thread Davide Setti
Hello,
we're going to build some "federated" apps. Let's call them
app1.example.com and app2.example.com. I need to do two things:

1. single sign on
2. share some data between the two profiles. For example i want to
keep username, name and surname in the same place, while the phone
number should just stay in app1.

For point 1 i see there's https://github.com/easel/django-shared-auth
, but i don't understand why i need to use it. What if i simply share
cookie between subdomains and the session table?

For point 2, do you know if there are already apps to do this? I know
that i can use Database Routers to keep centralized data in a
different DB, but i would like to know if there are out-of-the-box
solutions...

Regards
-- 

Davide Setti
blog: http://blog.flatlandia.eu
code: http://github.com/vad

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



problems: python manage.py syncdb

2011-04-22 Thread Lancinè I KABA
Hello!!!
I am new to django, and am running the tutorial.  I have edited
'settings.py' and am running "python manage.py runserver".

When I run the server and then call "python manage.py syncdb" against
my Postgres database, everything just hangs.

If I kill 'runserver', then I get this message from syncdb:

site-packages/Django-1.3-py2.4.egg/django/db/backends/
postgresql_psycopg2/base.py
line 140

self.connection = Database.connect(**conn_params)
psycopg2.OperationalError: could not connect to server:  Connection
refused

When I turn the server back on and run syncdb, it just hangs.  I try
turning on verbose and other options...but I see nothing.

It seems like something is talking to the server, but that is as far

KABA
Student in Le Mans, France

 Original Message 
Subject: problems: python manage.py syncdb
Date: Fri, 22 Apr 2011 10:17:05 +0200
From: 
To: 

Bonjour,

C'est pour demander de l'aide pour ce problème.

Avec la commande python manage.py syncdb ou python manage.py sql ou
python manage.py sqlall on a plusieurs ligne de d'erreur dont:

self.connection = database.connect(**conn_params)
psycopg2.OperationalError: could not connect to server: Connection
refused (0*274D/10061)

Ci joint la copie d'ecran de l'erreur


Merci de m'aider

KABA
Etudiant Le Mans, France

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django-tinymce

2011-04-22 Thread Nolan Bradshaw
I attempted to install djang-tinymce, yesterday. failed miserably. Is their
some runserver issue that results in an extra step? I dumped the
djang-tinymce in my dist-packages in the admin media. created a folder in my
site static folder called js and placed the js files their. Then went into
my admin flatpage model and add the js = [ ]. Basically to the tee. I am
using python2.7 and django 1.3. django-tinymce 1.5a1 for 1.3 django. If
anyone has had troubles installing this application please provide insight.
The other option I have is to use the tinymce from the developers and
install it all by hand. Some confusion though, in the django-tinymce helpdoc
it said nothing about add variables to the settings.py file. However, their
are some that have this in their tutorial, is this for older version? I've
also include the tinymce variables in my settings file just in case. I also
was under the impression I didn't have to create a textarea.js when using
grapelli's tinymce setup

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Why Django Model Filter Returns Model Object Instance Instead of QuerySet?

2011-04-22 Thread octopusgrabbus
Thanks for the links.

On Apr 21, 11:56 pm, Oleg Lomaka  wrote:
> On Fri, Apr 22, 2011 at 1:20 AM, octopusgrabbus
> wrote:
>
>
>
> > Here is the pertinent code:
>
> > def reconcile_inv(request):
> >    errors = []
> >    cs_list = []
> >    return_dc = {}
> >     cs_hold_rec_count = 0
> >     try:
> >       cs_hold_rec_count = CsInvHold.objects.count()
> >        qs = CsInvHold.objects.filter(inventory_ok=0)
> >       if qs:
> >           cs_list.append(['','Customer Synch Data On Hold Due To
> > Missing From AMR Inventory', ''])
> >           cs_list.append(['PremiseID', 'Endpoint ID', 'Date
> > Entered'])
>
> >           for each_q in qs:
> >               cs_list.append([str(each_q.premiseid),
> > int(each_q.endpointid), str(each_q.last_update)])
>
> >     except ObjectDoesNotExist:
> >       cs_hold_rec_count = 0
>
> > My understanding is this line of code -- qs =
> > CsInvHold.objects.filter(inventory_ok=0) -- should return a query set.
> > It seems to return a CsInvHold object reference. Why does that happen?
>
> As nobody can understand what do you mean by this, I'll ask another
> question. How do you know this is the object reference? What is the
> statement, that identified this for you?
>
> As to returning a list instead of queryset, you can use list comprehension
> to create a list you need. For example, if you need a list of IDs and
> last_updates from your queryset, you can write:
>
> ids_list = [(o.id, o.last_update) for o in qs]
>
> Or you can do just qs.values('id', 'last_update'), which will return a list
> of dictionaries in form {'id": 1, 'last_update': datetime(2011, 01, 01)}
>
> Also take a look at values_list() method of 
> QuerySet.http://docs.djangoproject.com/en/dev/ref/models/querysets/#valueshttp://docs.djangoproject.com/en/dev/ref/models/querysets/#values-list

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Protected web APIs (short and simple)

2011-04-22 Thread Subhranath Chunder
Hi,

I've created a small and simple Python helper module to have protected web
APIs in Django or other python projects, using a secret key string.
It's using HMAC MD5.

The main concept is of Facebook 'signed_request'.

For details: https://github.com/subhranath/python-web-api-auth-helper

Thanks,
Subhranath Chunder.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django ORM question about lookups that span relationships

2011-04-22 Thread Michael Radziej
On Fri, 22 Apr 2011 07:02:22 +0300, Oleg Lomaka  wrote:
> Blog.objects.filter(entry__pub_date__lte=date(2011, 4, 1),
>   entry__headline__contains='Easter
> ').latest('pub_date')
> 
> Or
> 
> Blog.objects.filter(entry__pub_date__lte=date(2011, 4, 1),
>   entry__headline__contains='Easter
> ').order_by('-pub_date')[0]

No, that's not what Carsten asked for:


> On Thu, Apr 21, 2011 at 10:25 PM, Carsten Fuchs 
> wrote:
> > What I'm wondering about is how I can find blogs whose *most recent* entry
> > before or at April 1st has the word "Easter" in the headline.

Actually, it's quite a mess in SQL, and I'd probably rather check the
condition in python on the client, just for clarity, if the performance is
reasonable.

In SQL, it's something along

SELECT ... FROM blog
JOIN entry e1 on e1.entry_id = blog.id 
 AND e1.pub_date <= ...
 AND e1.headline LIKE "%Easter%"
 AND NOT exists
 ( SELECT id from entry e2
   WHERE e2.entry_id = blog.id
   AND e2.pub_date <= ...
   AND e2.pub_date > e1.pub_date
 )

Well ... even after 5 years with Django, I still think more in SQL than
in Django ORM. Does anyone know how to that in the ORM?


Kind regards

Michael

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Extremely Frustrated

2011-04-22 Thread Ogi Vranesic
Could You also send us the definition of Book class?
Ogi


On Donnerstag 21 April 2011 10:00:17 pm you wrote:
> Hello,
> 
> I have been working through the Django Book, and I keep getting syntax
> errors in the examples in Chapter 6.
> 
> The following example works:
> 
> class BookAdmin(admin.ModelAdmin):
> list_display = ('title', 'publisher', 'publication_date')
> list_filter = ('publication_date',)
> date_hierarchy = 'publication_date'
> ordering = ('-publication_date',)
> fields = ('title', 'authors', 'publisher', 'publication_date')
> 
> The next one, however, does not - it throws a syntax error:
> 
> class BookAdmin(admin.ModelAdmin):
> list_display = ('title', 'publisher', 'publication_date')
> list_filter = ('publication_date',)
> date_hierarchy = 'publication_date'
> ordering = ('-publication_date',)
> fields = ('title', 'authors', 'publisher')
> 
> Nor can I add fields back in to this example or I get a syntax error:
> 
> class BookAdmin(admin.ModelAdmin):
> list_display = ('title', 'publisher', 'publication_date')
> list_filter = ('publication_date',)
> date_hierarchy = 'publication_date'
> ordering = ('-publication_date',)
> filter_horizontal = ('authors',)
> (would like to still define fields, but throws a syntax error)
> 
> Same with this one:
> 
> class BookAdmin(admin.ModelAdmin):
> list_display = ('title', 'publisher', 'publication_date')
> list_filter = ('publication_date',)
> date_hierarchy = 'publication_date'
> ordering = ('-publication_date',)
> filter_horizontal = ('authors',)
> raw_id_fields = ('publisher',)
> (would like to still define fields, but throws a syntax error)
> 
> 
> Could someone please show me how to include "fields = ('title',
> 'authors', 'publisher')" without getting an error?
> 
> Thanks,
> Gandeida
> 

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: cx_Oracle error: ImproperlyConfigured

2011-04-22 Thread Jirka Vejrazka
Hi Kamal,

  checking my install history, this is what I had to do to use
cx_Oracle on Ubuntu Server:

$ /usr/local/oracle/instantclient_11_2$ ln -s libclntsh.so.11.1 libclntsh.so
$ WITH_UNICODE=1 ORACLE_HOME=/usr/local/oracle/instantclient_11_2
python setup.py build
$ sudo bash
# WITH_UNICODE=1 ORACLE_HOME=/usr/local/oracle/instantclient_11_2
python setup.py install

and tested:
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/oracle/instantclient_11_2
$ python
Python 2.5.2 (r252:60911, Jan 20 2010, 21:48:48)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> cx_Oracle.version
'5.0.3'

Then I added the LD_LIBRARY_PATH to /etc/profile so it'd be used by
all users, including the Apache process.

The error you're getting is most likely caused by ORACLE_HOME not
being set during cx_Oracle installation. To be extra sure, consider
adding it to /etc/profile too.


  HTH

Jirka

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: bound form with ModelChoiceField

2011-04-22 Thread ekms
I'm sorry, maybe I didn't explain it correctly.

I have a form (not a modelform) with a modelchoicefield.

class myForm(forms.Form):
recorridos = Recorrido.objects.filter(showinform=True)
option = forms.ModelChoiceField(recorridos)


User selects a choice, and POST.
In my view, after validating it, I store firstForm.cleaned_data in
session (request.session['firstForm']=firstForm.cleaned_data).

Later, in other view, I want to show to the user the same form with
the option he has choosen, so I do the following:

secondForm = myForm(request.session['firstForm'])

this don't work, because firstForm.cleaned_data cleans "option" field
to Recorrido object, instead of a dict.

If I store  firstForm.data or request.POST in session, instead of
firstForm.cleaned_data, it works correctly, because they're a dict.

The question is:
what is the best way of do what I want to do?
I don't think it will be store firstForm.data o request.POST in
session it's a good idea, so, what are the other possibilities?

I 've taken a look at modelForm, but it seems to be more complicated
to obtain the result I want, especially because my form don't map
closely to a model.


Thanks.

On 22 abr, 07:09, Andy McKay  wrote:
> On 2011-04-21, at 4:07 PM, ekms wrote:
>
> > So, what is the correct way to create a bound form of
> > ModelChoiceField? I  could store request.POST or myform.data instead
> > of myform.cleaned_data, but I don't know if this is right.
>
> You are confusing me when you say a bound form of a ModelChoiceField. Since 
> one is a form and one is a field. You can create a ModelForm given a Model 
> and its instance or primary key as outlined here:
>
> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#modelform
> --
>   Andy McKay
>   a...@clearwind.ca
>   twitter: @andymckay

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: filtering drop downs according to logged in user

2011-04-22 Thread vishy
test

On Apr 21, 7:10 pm, "Szabo, Patrick \(LNG-VIE\)"
 wrote:
> Hi,
>
> I want to filter the dropdownlists that are automatically used to select
> a foreign-key in forms (in my views).
>
> Normally that could easily be done with "class Meta" in the Modelform.
>
> Thing is i want to filter by an attribute of the current
> userspecificly the groups that the user is assigned to.
>
> So how do i do that ?!
>
> Can i acces request.user in the models somehow ?!
>
> Kind regards
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
> Patrick Szabo
>  XSLT Developer
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> mailto:patrick.sz...@lexisnexis.at
> Tel.: +43 (1) 534 52 - 1573
> Fax: +43 (1) 534 52 - 146

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: filtering drop downs according to logged in user

2011-04-22 Thread vishy


On Apr 21, 7:10 pm, "Szabo, Patrick \(LNG-VIE\)"
 wrote:
> Hi,
>
> I want to filter the dropdownlists that are automatically used to select
> a foreign-key in forms (in my views).
>
> Normally that could easily be done with "class Meta" in the Modelform.
>
> Thing is i want to filter by an attribute of the current
> userspecificly the groups that the user is assigned to.
>
> So how do i do that ?!
>
> Can i acces request.user in the models somehow ?!
>
> Kind regards
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
> Patrick Szabo
>  XSLT Developer
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> mailto:patrick.sz...@lexisnexis.at
> Tel.: +43 (1) 534 52 - 1573
> Fax: +43 (1) 534 52 - 146

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



i am suspicious !

2011-04-22 Thread Tonton
so how to pass over ?

i made an upload form for tree files
then i use data in these files and create a table.

next i need tu upload more tree files but in the path there is the tree file
before so i hope to remove it !!

then django Crying me with SuspiciousOperation

maybe i am a little bit "brutal"

def cleanPath(path):
list= default_storage.listdir(path)
for f in list:
file = path + f
if default_storage.exists(file):
default_storage.delete(file)
return "dossier nettoye"

this is what i am in trouble now but next
i would like to let my users (authenticate user ) to remove table and all
data inside from the website

thank's for all
Tonton

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



AW: filtering drop downs according to logged in user

2011-04-22 Thread Szabo, Patrick (LNG-VIE)
Okay i got it...

Thanks a lot !


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Szabo, Patrick (LNG-VIE)
Gesendet: Freitag, 22. April 2011 09:10
An: django-users@googlegroups.com
Betreff: AW: filtering drop downs according to logged in user

Hi, 

I like that idea.
I have a problem with implementing it.

I got the following code:

f = BuchungForm(initial= {'Datum': heute, 'Stunden': 0, 'Minuten': 0,})
choices = Aktivitaeten.objects.all()
f.fields['Aktivitaet'].choices = choices

I used all() just for testing of couse i'll filter later.

I get "Caught TypeError while rendering: 'Aktivitaeten' object is not iterable"

Am i doing something wrong ?!

Kind regards



. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Dan Gentry
Gesendet: Donnerstag, 21. April 2011 21:05
An: Django users
Betreff: Re: filtering drop downs according to logged in user

I have set the choices list in the view:

choices =
SomeModel.objects.filter(user=request.user).values_list('id','label')

Then, after the form is instantiated, modify the choices attribute of
the ChoiceField:

form = SomeOtherModelForm()
form.fields['model_dropdown'].choices = choices

Works in a similar fashion with a ModelChoiceField and the queryset
attribute.

On Apr 21, 10:10 am, "Szabo, Patrick \(LNG-VIE\)"
 wrote:
> Hi,
>
> I want to filter the dropdownlists that are automatically used to select
> a foreign-key in forms (in my views).
>
> Normally that could easily be done with "class Meta" in the Modelform.
>
> Thing is i want to filter by an attribute of the current
> userspecificly the groups that the user is assigned to.
>
> So how do i do that ?!
>
> Can i acces request.user in the models somehow ?!
>
> Kind regards
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
> Patrick Szabo
>  XSLT Developer
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> mailto:patrick.sz...@lexisnexis.at
> Tel.: +43 (1) 534 52 - 1573
> Fax: +43 (1) 534 52 - 146

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



AW: filtering drop downs according to logged in user

2011-04-22 Thread Szabo, Patrick (LNG-VIE)
Hi, 

I like that idea.
I have a problem with implementing it.

I got the following code:

f = BuchungForm(initial= {'Datum': heute, 'Stunden': 0, 'Minuten': 0,})
choices = Aktivitaeten.objects.all()
f.fields['Aktivitaet'].choices = choices

I used all() just for testing of couse i'll filter later.

I get "Caught TypeError while rendering: 'Aktivitaeten' object is not iterable"

Am i doing something wrong ?!

Kind regards



. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Dan Gentry
Gesendet: Donnerstag, 21. April 2011 21:05
An: Django users
Betreff: Re: filtering drop downs according to logged in user

I have set the choices list in the view:

choices =
SomeModel.objects.filter(user=request.user).values_list('id','label')

Then, after the form is instantiated, modify the choices attribute of
the ChoiceField:

form = SomeOtherModelForm()
form.fields['model_dropdown'].choices = choices

Works in a similar fashion with a ModelChoiceField and the queryset
attribute.

On Apr 21, 10:10 am, "Szabo, Patrick \(LNG-VIE\)"
 wrote:
> Hi,
>
> I want to filter the dropdownlists that are automatically used to select
> a foreign-key in forms (in my views).
>
> Normally that could easily be done with "class Meta" in the Modelform.
>
> Thing is i want to filter by an attribute of the current
> userspecificly the groups that the user is assigned to.
>
> So how do i do that ?!
>
> Can i acces request.user in the models somehow ?!
>
> Kind regards
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
> Patrick Szabo
>  XSLT Developer
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> mailto:patrick.sz...@lexisnexis.at
> Tel.: +43 (1) 534 52 - 1573
> Fax: +43 (1) 534 52 - 146

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



AW: filtering drop downs according to logged in user

2011-04-22 Thread Szabo, Patrick (LNG-VIE)
Yeah, that is off topic but i'll answer it anyway ;-)

As you might have already guessed I'm developing XSLT and XSL-FO
Stylesheets.

Of course there are other things I do to create Workflows for
Content-production but those are my "main tools" 

Obviously I'm also developing with Python ^^

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Cal Leeming
[Simplicity Media Ltd]
Gesendet: Donnerstag, 21. April 2011 19:02
An: django-users@googlegroups.com
Betreff: Re: filtering drop downs according to logged in user

 

Completely off topic but, what exactly does an "XSLT Developer" do?

On Thu, Apr 21, 2011 at 3:10 PM, Szabo, Patrick (LNG-VIE)
 wrote:

Hi, 

 

I want to filter the dropdownlists that are automatically used to select
a foreign-key in forms (in my views).

Normally that could easily be done with "class Meta" in the Modelform.

Thing is i want to filter by an attribute of the current
userspecificly the groups that the user is assigned to.

 

So how do i do that ?!

Can i acces request.user in the models somehow ?!

 

Kind regards

. . . . . . . . . . . . . . . . . . . . . . . . . .

Patrick Szabo
XSLT Developer 

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

Tel.: +43 (1) 534 52 - 1573 

Fax: +43 (1) 534 52 - 146 

 

 

-- 
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
django-users+unsubscr...@googlegroups.com
 .
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.

 

-- 
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.