Re: cx_Oracle error: ImproperlyConfigured

2011-04-21 Thread kamal sharma
When i try the same code from python Shell then it is working fine. Here is the working output: >>> import cx_Oracle >>> from pprint import pprint >>> connection = cx_Oracle.Connection("%s/%s@%s" % ('foo', 'bar', 'db')) >>> cursor = cx_Oracle.Cursor(connection) >>> sql = "SELECT xyz FROM

Re: bound form with ModelChoiceField

2011-04-21 Thread Andy McKay
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.

Re: Using auth.login() with multiple databases

2011-04-21 Thread Andy McKay
On 2011-04-21, at 6:30 PM, Lawrence wrote: > 4. Add a custom login() method to my custom authentication backend? > This sounds like an option I could undertake but I'm unsure of the > syntax to select the appropriate database and perform all of the > required login features like saving the User

Re: Django ORM question about lookups that span relationships

2011-04-21 Thread Oleg Lomaka
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] On

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

2011-04-21 Thread Oleg Lomaka
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() >

Looking for an awesome Python Developer as well as a Tester.

2011-04-21 Thread Jerimiah - New Market Lab
Hello, New Market Lab has a couple of contract job opportunities for work on an application that we are developing for our client, Envision Telepharmacy ( www.envision-rx.com). We are producing a telepharmacy application that enables a pharmacist to work with multiple hospitals over the internet.

Re: ModelForm unbound

2011-04-21 Thread Constantine
Let me show example on form i have two coerced fieds (ModelChoiceField) queryset for second field based on first so, using simpleform i can modify second queryset using firstfield_clean but using modelform i should do it twise: in init for form instantiation and in field_clean for save what

Using auth.login() with multiple databases

2011-04-21 Thread Lawrence
We have multiple databases for authentication. Basically one database per department. Before the obvious question is asked, I cannot merge nor sync the various databases into one Django managed admin database. The database schema cannot change and I am hoping I can work around this in Django code.

Re: Extremely Frustrated

2011-04-21 Thread Kenny Meyer
Can you give us the following information: - Django version installed on your system - Full tracebacks, not just what type of Exception has been thrown. Please? Kenny On Thu, Apr 21, 2011 at 4:00 PM, Gandeida wrote: > Hello, > > I have been working through the

Re: The import staticfiles_urlpatterns is not working in django 1.3

2011-04-21 Thread Ernesto Guevara
Hello Brian! This right, in fact that word "import" I inadvertently pasted, but the import does not work. from django.contrib.staticfiles.urls import staticfiles_urlpatterns The problem was that when doing the import, it does not appear available by pressing ctrl + backspace in Eclipse, that is,

Re: two similar ways to show data, but only one working

2011-04-21 Thread Michael
2011/4/22 W Craig Trader only matches upper and lower case letters. > > - Craig - > Hi Craig, Sorry for this confusion, my hostnames only contains letters, i should have copy/pasted my url

Re: The import staticfiles_urlpatterns is not working in django 1.3

2011-04-21 Thread Brian Neal
On Apr 21, 12:48 pm, Guevara wrote: > Hello! > My project is failing to import the staticfiles_urlpatterns, using > Eclipse Helios: > > urls.py > > import from django.contrib.staticfiles.urls staticfiles_urlpatterns > > In django 1.3 I already have: > > INSTALLED_APPS = (

Re: The import staticfiles_urlpatterns is not working in django 1.3

2011-04-21 Thread Guevara
The problem was the documentation, the manual of utilization says one thing, but the Contrib documentation says another, I follow contrib doc: This is the configuration that worked: settings.py STATIC_ROOT = '' STATIC_URL = '/static/' STATICFILES_DIRS = (

Re: two similar ways to show data, but only one working

2011-04-21 Thread W Craig Trader
On 04/21/2011 05:08 PM, Michael wrote: I try to do the same with http://127.0.0.1:8000/host/hostname1 to print every package that is installed on hostname1 urls.py --- [...] (r'^host/(?P[a-zA-Z]+)$', 'packages.views.host'), [] For starters, the pattern you've registered won't

bound form with ModelChoiceField

2011-04-21 Thread ekms
Hello, I have a form with a ModelChoiceField, and when I want to create a new bound form using the first form cleaned_data (that I stored in a session before), I get an error when rendering the template ("Caught TypeError while rendering: int() argument must be a string or a number"). This is

two similar ways to show data, but only one working

2011-04-21 Thread Michael
Hi, I`m new to Django and I`m trying to write an application "packages" that reads data from a mysql-database and prints the installed software for any hostname. For example: http://127.0.0.1:8000/package/mutt prints every host on which the package "mutt" is installed. This works without

annotate() for subgroups within a column

2011-04-21 Thread Ariana
Hi everyone, I'm brand-new to Django so this may be a noob question; however, I've been stuck on this one query for a couple of days now and can't seem to reach a solution. I'm working with a model called Update, which represents an update to a user's score in a match. I am trying to return the

Extremely Frustrated

2011-04-21 Thread Gandeida
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',)

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

2011-04-21 Thread Javier Guerra Giraldez
On Thu, Apr 21, 2011 at 5:20 PM, octopusgrabbus wrote: > It seems to return a CsInvHold object reference. you still don't show why you think that's happening. what tests have you done? what do you mean by "it seems to"? -- Javier -- You received this message

Re: django advent for 1.3

2011-04-21 Thread flowpoke
PURE WIN, Idan. -- 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,

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

2011-04-21 Thread octopusgrabbus
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:

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

2011-04-21 Thread Ramiro Morales
On Thu, Apr 21, 2011 at 1:37 PM, octopusgrabbus wrote: > [...] > >    try: >       cs_hold_rec_count = CsInvHold.objects.count() >       cs_hold_rec_list = CsInvHold.objects.filter(inventory_ok=0) > >    except ObjectDoesNotExist: >       cs_hold_rec_count = 0 > >    if

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

2011-04-21 Thread octopusgrabbus
I've asked two questions: 1) Why do I get back an Object reference, when the docs say it's a query set? 2) How can I dump that object's values into a list instead of iterating each column? On Apr 21, 5:06 pm, Daniel Roseman wrote: > On Thursday, April 21, 2011 9:17:54 PM

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

2011-04-21 Thread Daniel Roseman
On Thursday, April 21, 2011 9:17:54 PM UTC+1, octopusgrabbus wrote: > > I posted in the original problem. > cs_hold_rec_list = CsInvHold.objects.filter(inventory_ok=0) > How is that a problem? What's wrong with it? > Right now, I can get what I need by doing this: > > qs =

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

2011-04-21 Thread octopusgrabbus
I posted in the original problem. cs_hold_rec_list = CsInvHold.objects.filter(inventory_ok=0) Right now, I can get what I need by doing this: qs = CsInvHold.objects.filter(inventory_ok=0) if qs: cs_list.append(['','Customer Synch Data On Hold Due To Missing From AMR

Re: Is the initial value of a form field available in the template?

2011-04-21 Thread Sarang
This works: form.initial.fieldname -- 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.

Re: cx_Oracle error: ImproperlyConfigured

2011-04-21 Thread Ian
On Apr 21, 11:03 am, kamal sharma wrote: > Error while trying to retrieve text for error ORA-01804 > > Here is my code to fetch the data from database. > > def cases(request, dbname, prnum=None, message=''): > >     connection = cx_Oracle.Connection("%s/%s@%s" % ('foo',

Django ORM question about lookups that span relationships

2011-04-21 Thread Carsten Fuchs
Hi all, I'm currently reading . What I seem to understand is how I can find all blogs that have entries that - where published *sometime* before or at April 1st, - and have the word

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

2011-04-21 Thread Daniel Roseman
On Thursday, April 21, 2011 7:52:02 PM UTC+1, octopusgrabbus wrote: > > I have been able to narrow my question down. I can pull individual > columns from the returned model object reference. How can I get all > those columns in a list. Wrapping in a list() function returns an > error object is

Re: filtering drop downs according to logged in user

2011-04-21 Thread Dan Gentry
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

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

2011-04-21 Thread octopusgrabbus
I have been able to narrow my question down. I can pull individual columns from the returned model object reference. How can I get all those columns in a list. Wrapping in a list() function returns an error object is not iterable error. On Apr 21, 12:37 pm, octopusgrabbus

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

2011-04-21 Thread octopusgrabbus
I've also added this to force the QuerySet to evaluate, and I'm still getting the object reference: for list_element in CsInvHold.objects.filter(inventory_ok=0): cs_list.append(list_element) On Apr 21, 12:37 pm, octopusgrabbus wrote: > Here is my

Running Django tests from Python

2011-04-21 Thread Shawn Milochik
I want to use pyinotify[1] to monitor my project directory and run my unit tests whenever I save a .py file. The monitoring part is working. All I need now is to know how to call the tests from my "watcher" script. As noted in the docs[2], I'm already running setup_test_environment() in my

The import staticfiles_urlpatterns is not working in django 1.3

2011-04-21 Thread Guevara
Hello! My project is failing to import the staticfiles_urlpatterns, using Eclipse Helios: urls.py import from django.contrib.staticfiles.urls staticfiles_urlpatterns In django 1.3 I already have: INSTALLED_APPS = ( 'django.contrib.staticfiles' ) In the folder: /

Re: cx_Oracle error: ImproperlyConfigured

2011-04-21 Thread kamal sharma
Thanks a lot. Now that issue is resolved after i execute below command. sudo ln -s /opt/app/oracle/products/11.2.0/lib/libclntsh.so.11.1 But now i am getting databse error. Any pointer please? Exception Value: Error while trying to retrieve text for error ORA-01804 Here is my code to fetch

Re: filtering drop downs according to logged in user

2011-04-21 Thread Cal Leeming [Simplicity Media Ltd]
Completely off topic but, what exactly does an "XSLT Developer" do? On Thu, Apr 21, 2011 at 3:10 PM, Szabo, Patrick (LNG-VIE) < patrick.sz...@lexisnexis.at> wrote: > Hi, > > > > I want to filter the dropdownlists that are automatically used to select a > foreign-key in forms (in my views). > >

Re: filtering drop downs according to logged in user

2011-04-21 Thread Oleg Lomaka
As an option, you can pass a request.user to form's __init__ method from your view. Example: class YourForm(forms.ModelForm): def __init__(self, user, *args, **kwargs): self.user = user super(YourForm, self).__init__(*args, **kwargs) # here you can modify any

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

2011-04-21 Thread octopusgrabbus
BTW: I had already noticed the mention that QuerySets are lazy here http://docs.djangoproject.com/en/1.2/topics/db/queries/#field-lookups, but how to I cause the query set to access the database. A print isn't going to help me when I want to send a list to a function that will write it into a

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

2011-04-21 Thread octopusgrabbus
Here is my model (shortened for brevity). It was generated by inspectdb. I am running Django 1.2 with mod_wsgi, on Ubuntu 10.04 and apache2. class CsInvHold(models.Model): action = models.CharField(max_length=3, db_column='Action', blank=True) # Field name made lowercase. . . .

Re: object with version

2011-04-21 Thread Oleg Lomaka
Take a look at django-reversion On Thu, Apr 21, 2011 at 5:43 PM, Brian Craft wrote: > I need to create objects with version tracking, a bit like wiki > content. Anyone done this in django? > > I could create a model with a content field and a version field. But > I'm

Re: cx_Oracle error: ImproperlyConfigured

2011-04-21 Thread kamal sharma
After creating soft link, still it is giving the same error. Do i need to create soft link for any other files? My response are inline with KS: On Thu, Apr 21, 2011 at 9:21 PM, Ian wrote: > On Apr 21, 9:39 am, kamal sharma wrote: > > Here is the

Re: cx_Oracle error: ImproperlyConfigured

2011-04-21 Thread Ian
On Apr 21, 9:39 am, kamal sharma wrote: > Here is the error I am getting now: > > cd /usr/local/lib > > /usr/local/lib> sudo ln > /opt/app/oracle/products/11.2.0/lib/libclntsh.so.10.1 > ln: ./libclntsh.so.10.1 is on a different file system > > /usr/local/lib> cd /usr/lib/

Re: cx_Oracle error: ImproperlyConfigured

2011-04-21 Thread kamal sharma
Here is the error I am getting now: cd /usr/local/lib /usr/local/lib> sudo ln /opt/app/oracle/products/11.2.0/lib/libclntsh.so.10.1 ln: ./libclntsh.so.10.1 is on a different file system /usr/local/lib> cd /usr/lib/ /usr/lib> sudo ln /opt/app/oracle/products/11.2.0/lib/libclntsh.so.10.1 ln:

Re: Formset and Choices with Objects

2011-04-21 Thread Shawn Milochik
For the first question, you can use the form's 'instance' property to access the underlying model instance. For the latter, it sounds like you just need to concatenate the stuff you display. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: How to build a social network

2011-04-21 Thread shacker
On Apr 20, 4:23 pm, Rodrigo Ruiz wrote: > Hi, I'm a new programmer and I want to make a social network like > facebook or orkut. "social network" is a pretty vague term. I think you need to define the list of actual features you want the site to have and how they should

Re: Formset and Choices with Objects

2011-04-21 Thread Dan Gentry
I should have included that my desire is to access these objects in the template. On Apr 21, 11:22 am, Dan Gentry wrote: > I'm trying to use a formset to display a variable number of detail > rows on a form.  It's what they were created for, right? > > However, in order to

Formset and Choices with Objects

2011-04-21 Thread Dan Gentry
I'm trying to use a formset to display a variable number of detail rows on a form. It's what they were created for, right? However, in order to display more detail in each row, I'd like to have access to the object behind it - to reference columns not displayed, follow foreign key relationships,

Re: cx_Oracle error: ImproperlyConfigured

2011-04-21 Thread brad
This may be related to Oracle's shared libraries not being in the path recognized by your web server. I created hard links to the Oracle shared libraries in /user/local/lib to get cx_oracle working. I have a blog post that outlines what I did, here:

Re: Banners and Ads managment

2011-04-21 Thread Alex s
Thank you Bartek. And what about Ads management ? Regards Alex 2011/4/21 Bartek Górny > On Wed, 20 Apr 2011 22:52:39 -0300 > Alex s wrote: > > > Hi people > > > > Have anyone some experience to explain about use a django app for > > Banners

object with version

2011-04-21 Thread Brian Craft
I need to create objects with version tracking, a bit like wiki content. Anyone done this in django? I could create a model with a content field and a version field. But I'm not sure how to query (for example) all the latest versions of a set of objects. I'm sure there's a raw sql method via

Re: cx_Oracle error: ImproperlyConfigured

2011-04-21 Thread kamal sharma
Thanks David for quick response. I have already tried that option, but it does not work. Here is the diff which i have added. Index: app.wsgi === +os.environ["LD_LIBRARY_PATH"] = "/opt/app/oracle/products/11.2.0/lib" # figure out

Re: escaping metacharacter in url pattern

2011-04-21 Thread Raúl Cumplido
sorry copy error: *u*rl(r'^cgi-bin/DocDB/ShowDocument\$', 'docDB.views.retrieveDocumentVersion'), 2011/4/21 Raúl Cumplido > Hi, > > That data is not part of the path they are part of the querystring. It > would be better to set your urls.py as: > >

Re: escaping metacharacter in url pattern

2011-04-21 Thread Raúl Cumplido
Hi, That data is not part of the path they are part of the querystring. It would be better to set your urls.py as: rl(r'^cgi-bin/DocDB/ShowDocument\$', 'docDB.views.retrieveDocumentVersion'), And retrieve values in your view as: request.GET.get('docid', '') and request.GET.get('version', '')

filtering drop downs according to logged in user

2011-04-21 Thread Szabo, Patrick (LNG-VIE)
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

escaping metacharacter in url pattern

2011-04-21 Thread Michel30
Hey guy's, I'm trying to replicate behaviour of a legacy CMS and stick it into a new Django project. Here is an example of my url: http://hostname:port/cgi-bin/DocDB/ShowDocument?docid=19530=1 I want to filter the docid and version with a regex in a urlpattern to use later in a function:

Re: ModelForm unbound

2011-04-21 Thread Daniel Roseman
On Thursday, April 21, 2011 8:16:36 AM UTC+1, Constantine wrote: > > Hi > > i've used some logic in clean_field methods, but when i've migrated to > ModelForm, was very surprised that clean methods does not invoked > after some investigation i realized that model instane does not makes >

Re: cx_Oracle error: ImproperlyConfigured

2011-04-21 Thread David Markey
At the top of the WSGI script, set the LD_LIBRARY_PATH environment variable. On 21 April 2011 11:07, 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.

cx_Oracle error: ImproperlyConfigured

2011-04-21 Thread kamalp.sha...@gmail.com
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

ModelForm unbound

2011-04-21 Thread Constantine
Hi i've used some logic in clean_field methods, but when i've migrated to ModelForm, was very surprised that clean methods does not invoked after some investigation i realized that model instane does not makes modelform bound automatically i'm expect that model validation also triggered as

Re: Banners managment

2011-04-21 Thread Bartek Górny
On Wed, 20 Apr 2011 22:52:39 -0300 Alex s wrote: > Hi people > > Have anyone some experience to explain about use a django app for > Banners managment ? > > Thanks > Alex > I use this: https://bitbucket.org/bartekgorny/djbanner Bartek -- "Jeśli boli cię gardło,

Re: how to call user-defined database functions through the Django query syntax?

2011-04-21 Thread Riccardo Vianello
Hi Andrew, On Thu, Apr 21, 2011 at 7:59 AM, Andrew Dalke wrote: > I must say that I looked at the code with some dismay. Not because of > the code, but because it looks like it's a *lot* of work to handle > UDFs. I had hoped it would be much easier. I'm sure the code