Question about custom form widgets and validation

2010-12-29 Thread Brandon Taylor
Hi everyone,

I'm working on a custom form widget to input length values in feet,
inches and a fraction of an inch. So far, everything is working as
expected, except for validation.

It takes a value input as:
1' 10 1/2" and converts it into inches: 22.5, for storage in a
database.

My widget combines two text inputs and a select to create the decimal
value. So, I'm using a DecimalField and supplying my widget. However,
if I input a non-numeric value, I'm getting a ValueError in my
value_from_datadict method.

So, obviously I need a try/except in that method, but how do I go
about adding an error message to the field instead of raising a
runtime exception?

Once I get this finished, I'd like to add it to Django Snippets to
share.

Thanks,
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: An app to create sprite bundles (django-imaginator)

2010-10-07 Thread Brandon Taylor
Hello,

>From my experience with sprites, you wouldn't be using an image tag to
render the sprite. Rather, you would be giving an id or class
attribute on a div or some other type of HTML container tag that
positions the background image (sprite) and possibly sets a width and
height on the container to prevent overflow.

>From an organizational standpoint, knowing which images are in a
sprite would be nice, but from my perspective, this might get to be a
maintenance nightmare. Sometimes you need extra space between sprites
or you might want to do selective optimization on the image, etc.
Plus, you might end up with inline-css to position the background
image within each element, which would make it impossible to override
from a css file.

All that being said, probably not worth the effort from my experience
as a presentation layer architect on big and small projects.

Kindest regards,
Brandon

On Oct 3, 3:48 pm, Cesar Canassa  wrote:
> Hello everyone,
>
> I had this idea for an django application that creates image sprites
> automatically for you. I want an application that allows me to create and
> manage sprites by only using the admin interface. This is how it should
> work:
>
> - Add 'django-imaginator' to your INSTALLED_APPS
> - Run syncdb, the app creates two new models - Sprites and Images
> - Open the Admin interface and add a new Sprite, it has a mandatory slug
> field in it.
> - Create new Images, they have a ImageField, an slug and a
> ForeignKey pointing to which Sprite they belong.
>
> Now you run a custom manage.py command that uses PIL to compile all images
> into sprites. It also generate any required CSS.
>
> Now, in your templates you will display the images by using a custom
> template tag, something like this
>
> {% sprite 'sprite_slug' 'image_slug' %}
>
> which will be rendered as an HTML  tag.
>
> That's basically how it should work, but I wanted your opinion before I
> start to write any code. Do you think that this app is a good idea or
> it's doomed to failure? Are there other apps that already do this? I also a
> bit worried on version control, since the image will be stored in the
> database I don't I will be able to keep a version control of the sprites and
> rollback changes if required.
>
> Any opinions?
>
> Thanks,
> Cesar Canassa

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Confused about testing a page protected with @login_required

2010-10-06 Thread Brandon Taylor
Apparently, this is a cookie related issue:
http://stackoverflow.com/questions/2705235/django-test-failing-on-a-view-with-login-required

I'm using Django 1.1.1 for use with Django-CMS and Python 2.6.5, so
the problem with cookies as described by the Stack Overflow article
explains why my test fails :(

Hope this helps someone,
Brandon

On Oct 5, 11:37 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi everyone,
>
> I set up a bare-bones project with one view decorated with
> @login_required.
> I created an initial_data.json fixture with a user.
> I called self.client.login(username='foobar', passowrd='foobar') and
> it returned True.
> I assigned a response variable from self.client.get('/protected/')
>
> and self.assertEqual(response.status_code, 200) fails.
>
> Instead, it's returning a 302 to 'http://testserver/accounts/login/?
> next=/protected
> Why is that?
>
> Here is my test case:
>
> class SimpleTest(TestCase):
>     def test_protected(self):
>         logged_in = self.client.login(username='foobar',
> passowrd='foobar')
>         self.failUnless(logged_in)
>
>         response = self.client.get('/protected/')
>         self.assertEqual(response.status_code, 200)
>
> Which results in:
> AssertionError: 302 != 200
>
> What am I doing wrong? Any help GREATLY appreciated!
> Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: PyDev create new project wizard creates two folders in Aptana Studio 3?

2010-10-05 Thread Brandon Taylor
Hi Guys,

Yeah, I've just been creating projects by hand instead of using the
new PyDev Django actions. Fabio said it's because the project you
create has to be added to the Python Path, and it can't add a folder
that is above the path for some reason. Annoying.

Cheers,
Brandon

On Oct 5, 3:35 pm, Sandro Dutra <hexo...@gmail.com> wrote:
> When you try to create a project, Aptana duplicates the root directory
> automatically. A issue...
>
> To correct this, you only have to observe the path when you're creating the
> Django project.
>
> 2010/10/2 payala <ppay...@gmail.com>
>
>
>
> > Check if you are in the python perspective
>
> > On 1 oct, 19:34, Brandon Taylor <btaylordes...@gmail.com> wrote:
> > > Hi everyone,
>
> > > I'm used to organizing my Django projects in one folder for the
> > > project and then sub folders for app modules...
>
> > > /my_project
> > >     -__init__.py
> > >     -settings.py
> > >     /some_app
>
> > > and so on. However, when I create a new Django project using the PyDev
> > > wizard, I get:
>
> > > /my_project
> > >     /my_project
> > >         -__init__.py
> > >         -settings.py
>
> > > Why is that?
>
> > > TIA,
> > > Brandon
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@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-us...@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.



Confused about testing a page protected with @login_required

2010-10-05 Thread Brandon Taylor
Hi everyone,

I set up a bare-bones project with one view decorated with
@login_required.
I created an initial_data.json fixture with a user.
I called self.client.login(username='foobar', passowrd='foobar') and
it returned True.
I assigned a response variable from self.client.get('/protected/')

and self.assertEqual(response.status_code, 200) fails.

Instead, it's returning a 302 to 'http://testserver/accounts/login/?
next=/protected
Why is that?

Here is my test case:

class SimpleTest(TestCase):
def test_protected(self):
logged_in = self.client.login(username='foobar',
passowrd='foobar')
self.failUnless(logged_in)

response = self.client.get('/protected/')
self.assertEqual(response.status_code, 200)

Which results in:
AssertionError: 302 != 200

What am I doing wrong? Any help GREATLY appreciated!
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Error

2010-10-01 Thread Brandon Taylor
Sounds like you have an infinite loop.

On Oct 1, 12:12 pm, Tsolmon Narantsogt  wrote:
> Hi there
>
> i got this error
>
> *Exception RuntimeError: 'maximum recursion depth exceeded while calling a
> Python object' in 
> help me
>
> Thank you
> Tsolmon

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



PyDev create new project wizard creates two folders in Aptana Studio 3?

2010-10-01 Thread Brandon Taylor
Hi everyone,

I'm used to organizing my Django projects in one folder for the
project and then sub folders for app modules...

/my_project
-__init__.py
-settings.py
/some_app

and so on. However, when I create a new Django project using the PyDev
wizard, I get:

/my_project
/my_project
-__init__.py
-settings.py

Why is that?

TIA,
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: IDE for Python/django

2010-09-27 Thread Brandon Taylor
Aptana Studio 2 & 3 Beta + PyDev on Linux makes a great dev
environment for Django. You can create runtimes for debugging, add
modules to the Python path for your project, like the site-packages
folder from a virtualenv.

You'll get code assist for Python, HTML, CSS and JavaScript. A number
of JavaScript libraries like jQuery are also supported. This IDE has
served me very well for the past 4 years. It might not have every bell
or whistle that PyCharm has, but I feel it has a very well balanced
set of features that are easy to customize.

My $0.02,
Brandon

On Sep 27, 7:01 pm, tayfur yilmaz  wrote:
> pycharm is very slow ı think for pycharm is wrote java programming
> language..wing ide is best..
>
> 2010/9/28 Jason 
>
>
>
> > PyCharm is pretty amazing but it costs $ after its out of beta. Best
> > code completion I've seen for Django.
>
> > My ONLY complaint is you can't open up a python console during debug.
> > It has a pretty good debugger but seeing as other IDEs have no problem
> > here I don't know why they left it out.
>
> > Still, I think it's head and shoulders above the rest.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@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.
>
> --www.tayfuryilmaz.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-us...@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: Problem testing a view decorated with @login_required

2010-09-26 Thread Brandon Taylor
Sorry, the second test is the one that fails.

On Sep 26, 2:01 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi Everyone,
>
> I'm having an issue testing a page protected with @login_required. I'm
> loading a user via a fixture. I can call
> self.client.login(**credentials) successfully and get True back. I can
> retrieve a User object using the _auth_user_id key held in session
> from the call to self.client.login. However, my "dashboard" view keeps
> returning a 302.
>
> I'm using the built-in AuthenticationForm, and not sure what could be
> wrong at this point. I would really appreciate someone taking a look
> at this code...
>
> #views.py
> @login_required
> def dashboard(request):
>     return render_to_response('accounts/dashboard.html', {},
>         context_instance=RequestContext(request))
>
> #tests.py
> import httplib
>
> from django.contrib.auth.models import User
> from django.contrib.auth import SESSION_KEY
> from django.core.urlresolvers import reverse
> from django.test import TestCase
>
> class AccountsTestCase(TestCase):
>     def setUp(self):
>         self.dashboard_url = reverse('account_dashboard')
>
>     def tearDown(self):
>         self.client.logout()
>
>     def test_dashboard_redirects_unauthenticated_user(self):
>         dashboard_url = self.dashboard_url
>         #test that we can't get to the account dashboard if not logged
> in
>         login_url = '%s?next=%s' % (reverse('login'), dashboard_url)
>         response = self.client.get(dashboard_url)
>         self.assertRedirects(response, login_url,
> status_code=httplib.FOUND, target_status_code=httplib.OK)
>
>     def test_dashboard_allows_authenticated_user(self):
>         #test that we can login and then view the dashboard
>         logged_in = self.client.login(username='my_username',
> password='my_password')
>         self.failUnless(logged_in, 'User could not be authenticated')
>         user =
> User.objects.get(pk=self.client.session.get('_auth_user_id'))
>         response = self.client.get(self.dashboard_url)
>         self.assertEqual(response.status_code, httplib.OK)
>
> TIA,
> Brandon

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



Problem testing a view decorated with @login_required

2010-09-26 Thread Brandon Taylor
Hi Everyone,

I'm having an issue testing a page protected with @login_required. I'm
loading a user via a fixture. I can call
self.client.login(**credentials) successfully and get True back. I can
retrieve a User object using the _auth_user_id key held in session
from the call to self.client.login. However, my "dashboard" view keeps
returning a 302.

I'm using the built-in AuthenticationForm, and not sure what could be
wrong at this point. I would really appreciate someone taking a look
at this code...

#views.py
@login_required
def dashboard(request):
return render_to_response('accounts/dashboard.html', {},
context_instance=RequestContext(request))


#tests.py
import httplib

from django.contrib.auth.models import User
from django.contrib.auth import SESSION_KEY
from django.core.urlresolvers import reverse
from django.test import TestCase


class AccountsTestCase(TestCase):
def setUp(self):
self.dashboard_url = reverse('account_dashboard')

def tearDown(self):
self.client.logout()

def test_dashboard_redirects_unauthenticated_user(self):
dashboard_url = self.dashboard_url
#test that we can't get to the account dashboard if not logged
in
login_url = '%s?next=%s' % (reverse('login'), dashboard_url)
response = self.client.get(dashboard_url)
self.assertRedirects(response, login_url,
status_code=httplib.FOUND, target_status_code=httplib.OK)

def test_dashboard_allows_authenticated_user(self):
#test that we can login and then view the dashboard
logged_in = self.client.login(username='my_username',
password='my_password')
self.failUnless(logged_in, 'User could not be authenticated')
user =
User.objects.get(pk=self.client.session.get('_auth_user_id'))
response = self.client.get(self.dashboard_url)
self.assertEqual(response.status_code, httplib.OK)

TIA,
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Problem with reversing url in test

2010-09-25 Thread Brandon Taylor
This problem turned out to be related to specificity. Another url
pattern was overriding the pattern that I was testing.

On Sep 24, 9:43 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> So it appears to be something with django-cms' urls that are causing
> issues with testing. I'm able to test any URL that isn't controlled by
> dajngo-cms, like '/admin/' or whatever.
>
> Anyone else using django-cms v2 and Django 1.1.1 experiencing these
> issues?
>
> TIA,
> Brandon
>
> On Sep 24, 6:40 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > So here's something else that's weird...
>
> > I can start a shell, load up the test Client and get the page in
> > question:
>
> > Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
> > [GCC 4.4.3] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> > (InteractiveConsole)>>> from django.test.client import Client
> > >>> c = Client()
> > >>> response = c.get('/categories/')
> > >>> response.status_code
>
> > 200
>
> > Anyone have any ideas what could be wrong with the unit test?
>
> > On Sep 23, 10:51 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > > Hi everyone,
>
> > > I'm having a problem with reversing a URL in a unit test:
>
> > > class ProductTestCase(TestCase):
> > >     def setUp(self):
> > >         self.client = Client
>
> > >     def test_project_permalink(self):
> > >         project = Project.approved.all()[0]
> > >         url = project.get_absolute_url()
>
> > > I'm using an initial_data.json fixture that I exported from my current
> > > database, and I'm able to use the get_absolute_url method to navigate
> > > to a project detail page without error.
>
> > > When I try to reverse this url pattern in a test, I get a
> > > NoReverseMatch exception. django-cms is also running on my site, but
> > > disabling that app, and its url patterns doesn't make a difference.
>
> > > Anyone have any ideas on why this method would fail?
>
> > > TIA,
> > > Brandon
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Problem with reversing url in test

2010-09-24 Thread Brandon Taylor
So it appears to be something with django-cms' urls that are causing
issues with testing. I'm able to test any URL that isn't controlled by
dajngo-cms, like '/admin/' or whatever.

Anyone else using django-cms v2 and Django 1.1.1 experiencing these
issues?

TIA,
Brandon

On Sep 24, 6:40 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
> So here's something else that's weird...
>
> I can start a shell, load up the test Client and get the page in
> question:
>
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
> [GCC 4.4.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)>>> from django.test.client import Client
> >>> c = Client()
> >>> response = c.get('/categories/')
> >>> response.status_code
>
> 200
>
> Anyone have any ideas what could be wrong with the unit test?
>
> On Sep 23, 10:51 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
>
>
> > Hi everyone,
>
> > I'm having a problem with reversing a URL in a unit test:
>
> > class ProductTestCase(TestCase):
> >     def setUp(self):
> >         self.client = Client
>
> >     def test_project_permalink(self):
> >         project = Project.approved.all()[0]
> >         url = project.get_absolute_url()
>
> > I'm using an initial_data.json fixture that I exported from my current
> > database, and I'm able to use the get_absolute_url method to navigate
> > to a project detail page without error.
>
> > When I try to reverse this url pattern in a test, I get a
> > NoReverseMatch exception. django-cms is also running on my site, but
> > disabling that app, and its url patterns doesn't make a difference.
>
> > Anyone have any ideas on why this method would fail?
>
> > TIA,
> > Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Problem with reversing url in test

2010-09-24 Thread Brandon Taylor
So here's something else that's weird...

I can start a shell, load up the test Client and get the page in
question:

Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.test.client import Client
>>> c = Client()
>>> response = c.get('/categories/')
>>> response.status_code
200

Anyone have any ideas what could be wrong with the unit test?

On Sep 23, 10:51 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi everyone,
>
> I'm having a problem with reversing a URL in a unit test:
>
> class ProductTestCase(TestCase):
>     def setUp(self):
>         self.client = Client
>
>     def test_project_permalink(self):
>         project = Project.approved.all()[0]
>         url = project.get_absolute_url()
>
> I'm using an initial_data.json fixture that I exported from my current
> database, and I'm able to use the get_absolute_url method to navigate
> to a project detail page without error.
>
> When I try to reverse this url pattern in a test, I get a
> NoReverseMatch exception. django-cms is also running on my site, but
> disabling that app, and its url patterns doesn't make a difference.
>
> Anyone have any ideas on why this method would fail?
>
> TIA,
> Brandon

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



Problem with reversing url in test

2010-09-23 Thread Brandon Taylor
Hi everyone,

I'm having a problem with reversing a URL in a unit test:


class ProductTestCase(TestCase):
def setUp(self):
self.client = Client

def test_project_permalink(self):
project = Project.approved.all()[0]
url = project.get_absolute_url()


I'm using an initial_data.json fixture that I exported from my current
database, and I'm able to use the get_absolute_url method to navigate
to a project detail page without error.

When I try to reverse this url pattern in a test, I get a
NoReverseMatch exception. django-cms is also running on my site, but
disabling that app, and its url patterns doesn't make a difference.

Anyone have any ideas on why this method would fail?

TIA,
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Tools to ease template/ui development

2010-09-14 Thread Brandon Taylor
I use Aptana with PyDev and get code completion for Python, HTML, CSS,
JavaScript (and jQuery) and more. It's cross-platform, free and the
Beta 3 version has even more Django support thanks to the latest
version of PyDev.

There are plugins for Git, Mercurial, SVN and more.

Brandon

On Sep 14, 5:38 pm, Javier Guerra Giraldez  wrote:
> On Tue, Sep 14, 2010 at 4:18 PM, pixelcowboy  wrote:
> > I would really love something like pyjamas but that works with jquery
> > or something like that. What I would really love is to forget every
> > other programming language and just use python everywhere. Wouldn't
> > that be sweet?
>
> the problem with pyjamas (and similar 'translators') is that you use
> Python syntax with all the common limitations of JavaScript.  for
> example, in JS you use 'objects' for dicts, and they can only use
> strings for keys.  another one: when i first tried it, it didn't
> support yield(), so many built-in iterators just didn't work.  i guess
> it has improved, but you could only forget about JS if they reproduce
> all of python standard libraries.  that would be a _huge_ bloat for
> the browser.
>
> --
> Javier

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



Need to access fieldsets for custom model admin from ModelForm

2010-09-14 Thread Brandon Taylor
Hi everyone,

I need to add a checkbox field to an ModelForm, which is easy enough
by overriding __init__ on the ModelForm, but I'm also using a custom
fieldset on the ModelAdmin.

So, I need to be able to add the field to the fieldset from the form's
__init__

Possible? I'm not sure how I can get to the ModelAdmin through the
Model...

#my forms.py
class BidAdminForm(forms.ModelForm):
class Meta:
model = Bid

def __init__(self, *args, **kwargs):
super(BidAdminForm, self).__init__(*args, **kwargs)
#Only show the inherit checkbox for a new Bid
if not self.instance.id:
self.fields['inherit_entity_location_groups'] =
forms.BooleanField()

...at this point, self.instance will get me to the Bid model, but when
I try to access the model_admin on the instance, I get an
AttributeException.

I'd really appreciate some help!

TIA,
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Overriding queryset for admin.ModelAdmin

2010-09-14 Thread Brandon Taylor
The solution is to add the foreign key field as a list_filter, then
Django will accept the querystring parameter.

Hope that helps someone!

On Sep 13, 7:29 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi everyone,
>
> I have a very strange problem I'm trying to get a handle on. I need to
> filter a model admin with a value from the querystring, so I am doing
> an override of queryset in my ModelAdmin like so:
>
> def queryset(self, request):
>     id = request.GET.get('id', None)
>     if id:
>         return BidLocationGroup.objects.filter(bid__pk=id)
>     else:
>         return BidLocationGroup.objects.all()
>
> When I watch the development server in Terminal and print out the
> variable "id", here's what I see:
>
> [13/Sep/2010 19:20:10] "GET /admin/bids/bidlocationgroup/ HTTP/1.1"
> 200 3292
> [13/Sep/2010 19:20:10] "GET /static/js/jquery-1.4.2.min.js HTTP/1.1"
> 200 72174
> [13/Sep/2010 19:20:10] "GET /static/js/admin_shared.js HTTP/1.1" 200
> 1239
> [13/Sep/2010 19:20:10] "GET /static/js/parseuri.js HTTP/1.1" 200 1055
> [13/Sep/2010 19:20:10] "GET /static/css/custom_admin.css HTTP/1.1" 200
> 1657
> bid_id: 19
> [13/Sep/2010 19:20:16] "GET /admin/bids/bidlocationgroup/?bid_id=19
> HTTP/1.1" 302 0
> bid_id: None
> [13/Sep/2010 19:20:16] "GET /admin/bids/bidlocationgroup/?e=1 HTTP/
> 1.1" 200 3292
>
> What the hell?! Why is passing in a parameter causing a redirect? How
> can I prevent this from happening?
>
> TIA,
> Brandon

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



Overriding queryset for admin.ModelAdmin

2010-09-13 Thread Brandon Taylor
Hi everyone,

I have a very strange problem I'm trying to get a handle on. I need to
filter a model admin with a value from the querystring, so I am doing
an override of queryset in my ModelAdmin like so:

def queryset(self, request):
id = request.GET.get('id', None)
if id:
return BidLocationGroup.objects.filter(bid__pk=id)
else:
return BidLocationGroup.objects.all()

When I watch the development server in Terminal and print out the
variable "id", here's what I see:

[13/Sep/2010 19:20:10] "GET /admin/bids/bidlocationgroup/ HTTP/1.1"
200 3292
[13/Sep/2010 19:20:10] "GET /static/js/jquery-1.4.2.min.js HTTP/1.1"
200 72174
[13/Sep/2010 19:20:10] "GET /static/js/admin_shared.js HTTP/1.1" 200
1239
[13/Sep/2010 19:20:10] "GET /static/js/parseuri.js HTTP/1.1" 200 1055
[13/Sep/2010 19:20:10] "GET /static/css/custom_admin.css HTTP/1.1" 200
1657
bid_id: 19
[13/Sep/2010 19:20:16] "GET /admin/bids/bidlocationgroup/?bid_id=19
HTTP/1.1" 302 0
bid_id: None
[13/Sep/2010 19:20:16] "GET /admin/bids/bidlocationgroup/?e=1 HTTP/
1.1" 200 3292

What the hell?! Why is passing in a parameter causing a redirect? How
can I prevent this from happening?

TIA,
Brandon

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



Misbehaving queryset override in admin

2010-06-05 Thread Brandon Taylor
Hello everyone,

I have two models: PublicAccount and Order.

I need to provide a link to filter Orders by PublicAccount. So, I
added a field to the list display of my PublicAccount:

def orders(self):
return 'View' % \
(reverse('admin:orders_order_changelist'), self.pk)
orders.allow_tags = True


Here's my override for the Order queryset:

def queryset(self, request):
qs = super(OrderAdmin, self).queryset(request)
public_account_id = request.GET.get('public_account_id', None)
if public_account_id:
qs.filter(public_account__id=str(public_account_id))
return qs


What's happening is that the admin view is reloading. When I pass in
the public_account_id= through the querystring, the queryset will get
filtered as expected, but then the page immediately reloads and I end
up with a parameter: ?e=1 in the querystring.

If I print the qs variable, I get the result I expect, but then I get
another unfiltered list. I have no other overrides in my OrderAdmin
class. Does anyone know what's going on?

TIA,
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: "format" error with django-piston

2010-03-31 Thread Brandon Taylor
I ended up using jezdez's fork of Piston, and it works as expected:
https://bitbucket.org/jezdez/django-piston/

On Mar 31, 9:57 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi everyone,
>
> I know there's a Google Group for django-piston, but there's not very
> much conversation on that group, so I'm re-posting here as well.
>
> I'm getting an error when running the "blogserver" example site
> included with Piston:
>
> AttributeError at /api/posts/
> 'Blogpost' object has no attribute 'format'
>
> Googling this has turned up one post on the Bitbucket 
> site:http://bitbucket.org/jespern/django-piston/issue/54/got-an-error-on-p...,
> which says there's a patch, like 9 months ago, but that the patch
> doesn't work.
>
> The problem seems related to the @classmethod resource_uri, but I'm
> uncertain as to how to fix this.
>
> Kind regards,
> Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Admin Add Page

2010-03-31 Thread Brandon Taylor
You can extend the change_form.html and change_list.html templates for
those views, or the base_site.html template.

Look in your: django/contrib/admin/templates/admin/ folder to see all
of the templates. Also, check out the documentation at:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-vs-replacing-an-admin-template

Cheers,
Brandon

On Mar 30, 1:16 pm, Asim Yuksel  wrote:
> I want to use a custom admin add page with custom admin look and feel.
> What is the template to extend? I want to use something like this
>
> http://picasaweb.google.com/110428031719333287170/BaslKsZAlbum#545448...
>
> I tried to hack the html by viewing the source but it is time
> consuming and it always show a message "This field is required.". I
> want to show this message when I click save.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: word processing django apps

2010-03-31 Thread Brandon Taylor
At The Texas Tribune (texastribune.org), we use a combination of
TinyMCE and django-reversion. It doesn't track changes between
versions, but it maintains a history table of each previous version of
our main content types.

Cheers,
Brandon

On Mar 30, 4:18 pm, John Griessen  wrote:
> Some potential Django site users I know asked for word processing with 
> revisions
> for group writing they do.
>
> Is there a web hostable word processor with savable version history that is 
> easy to integrate with Django?
>
> A web based editor search turns up
> wymeditor
> TinyMCE
>
> Anyone integrated these along with versions?
>
> etherpad looks interesting.  Anyone using it along side Django?
> If so, what's that like?
>
> John

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Getting strange email from "dreamhost"

2010-03-31 Thread Brandon Taylor
I'm getting those from this forum as well.

On Mar 31, 10:13 am, Wiiboy  wrote:
> Hi guys,
> I've gotten two emails from "Mail Delivery Subsystem
> " with the subject "Your message was NOT
> received by django-us...@googlegroups.com!".
> The body is below.  Anyone know why I'm getting these?  Is anyone else
> getting them?  I have no affiliation with Dreamhost or at all, so this
> is...strange.
>
> We're sorry.. your email was unable to be processed by our automatic
> support system, and so is being returned to you.
>
> We could not find your email address in our customer database and so
> couldn't accept your email. Due to the HUGE volume of spam we receive
> at this address, we've been forced to implement this new policy.
>
> Therefore, please just re-submit your message at:
>
>      http://www.dreamhost.com/contact.cgi
>
> All messages submitted through that form are guaranteed to be
> received,
> even if you aren't currently a customer!
>
> Our apologies for the inconvenience,
> --
> The Happy DreamHost Support Team!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: modelform validation

2010-03-31 Thread Brandon Taylor
Hi there,

When calling def clean_name(self):, you can see if your instance has
an id or not:

def clean_name(self):
if not self.id:
#this would be a new record
else:
#this would be an existing record

HTH,
Brandon

On Mar 31, 9:24 am, Emanuel  wrote:
> Hi all!
>
> I have a modelform and I want to customize validation.
>
> I'm overriding the method clean_().
>
> When I'm saving the form I want to see if a specific user has been already
> assigned to a project. The only way he can ben assigned again is if he's an
> inactive user, so:
>
> models.py
> Class User(models.Model):
>         name = models.CharField(...)
>         active = models.BooleanField()
>         ...
>
> Class Project(models.Model):
>         user = models.ForeignKey(User)
>         
> **
>
> forms.py
> Class ProjectForm(ModelForm)
>         
>         def clean_name(self):
>                 user = self.cleaned_data['user']
>                 if User.objecs.filter(user.id, active=True):
>                         raise forms.ValidationError(_("This man has been
> already assign
> to a partner"))
>                 return user
>
> When I'm creating a new project it works fine (I believe, haven't been tested
> yet), but when editing it throws an error because the user already exists, and
> that's obvious. So, I want to be able to verify if it is a new instance or if
> it is an instance being edited.
>
> 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-us...@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: Passing hidden foreign key to form as initial value

2010-03-31 Thread Brandon Taylor
Hi there,

Instead of using the course object in your initial data, which will
pass in the __unicode__ representation of the object, pass in the id:

form = CouseBook(initial = {'course': course.id})

That should get you the numeric id, but you'll also need to override
your save method to get the course object to assign when you save your
CourseBook form, as you can't assign an integer (coming from your
hidden form field) to the value of a ForeignKey field on a model.

HTH,
Brandon

On Mar 31, 8:20 am, phoebebright  wrote:
> Displayed fields resolve as expected, hidden fields cause errors.
>
> This works:
>
> in the model
> CourseBook has a foreign key to Course
>
> In the view:
>
> course = Course.objects.get(pk=whatever)
> form = CouseBook(initial = {'course': course})
>
> in the Form:
>
> class CourseBook(ModelForm):
>     class Meta:
>         model = CourseBooking
>
> The web page now displays a picklist of courses with the initial value
> highlighted.  I can now do a form.save() no problem.
>
> However, if I make the course a hidden field, which is what I want.
>
> class CourseBook(ModelForm):
>     course = forms.CharField(widget=forms.HiddenInput())
>
>     class Meta:
>         model = CourseBooking
>
> then when I come to save() I get a ValueError, unable to assign "My
> course"  etc. as it tries to put the name of the course into the
> foreign key instead of a course instance.
>
> I can work around this putting a save method on the form, but it seems
> to me django should resolve this for me

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



"format" error with django-piston

2010-03-31 Thread Brandon Taylor
Hi everyone,

I know there's a Google Group for django-piston, but there's not very
much conversation on that group, so I'm re-posting here as well.

I'm getting an error when running the "blogserver" example site
included with Piston:

AttributeError at /api/posts/
'Blogpost' object has no attribute 'format'

Googling this has turned up one post on the Bitbucket site:
http://bitbucket.org/jespern/django-piston/issue/54/got-an-error-on-piston-022-blogpost-object-has-no-attribute,
which says there's a patch, like 9 months ago, but that the patch
doesn't work.

The problem seems related to the @classmethod resource_uri, but I'm
uncertain as to how to fix this.

Kind regards,
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: limit_choices_to a value on a field in the same model

2010-03-14 Thread Brandon Taylor
Walt, you're a lifesaver!

Many thanks for the great example. I only made a couple of minor
tweeks:

class AgencyForm(forms.ModelForm):
class Meta:
model = Agency

def __init__(self, *args, **kwargs):
super(AgencyForm, self).__init__(*args, **kwargs)
if self.instance.id:
if self.instance.state:
counties =
County.objects.filter(us_state=self.instance.state)
county_field = self.fields['counties'].widget
county_choices = []
if counties is None:
county_choices.append(('', '-'))
for county in counties:
county_choices.append((county.id, county.name))
county_field.choices = county_choices

Kind regards,
Brandon

On Mar 14, 8:23 am, Walt  wrote:
> Here is an idea of what your forms.py should contain:
>
> class AgencyForm(ModelForm):
>
>     class Meta:
>         model = Agency
>
>     def __init__(self, *args, **kwargs):
>         super(AgencyForm, self).__init__(*args, **kwargs)
>         if self.instance.id:
>             if self.instance.state_id:
>                 counties =
> County.objects.filter(state=self.instance.state_id)
>
>                 county_field = self.fields['counties'].widget
>                 county_choices = []
>                 county_choices.append(('', '--'))
>                 for county in counties:
>                     county_choices.append((county.id, county.name))
>                     county_field.choices = county_choices
>
> Then in admin.py, make sure you have:
>
> class AgencyAdmin(admin.ModelAdmin):
>     form = AgencyForm
>
> Hope this helps,
> Walt
>
> -~

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



limit_choices_to a value on a field in the same model

2010-03-13 Thread Brandon Taylor
Evening Everyone,

I have a model "Agency" with "state" as a foreign key and "counties"
as a many-to-many.
County has a foreign key to "state"

I would like to limit the County choices in Django admin to the state
of the Agency being edited, but, I can't seem to find the right place
to get an instance of the Agency being edited so I can override the
queryset for the many-to-many.

I've search quite a few posts, but can't find one with a working
example. Does anyone know where I might be able to find a good example
of this?

TIA,
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Permissions help

2010-03-12 Thread Brandon Taylor
Thanks raj, I'll give that a shot.

On Mar 12, 11:11 am, raj <rajeeshrn...@gmail.com> wrote:
> If you want to impose the restriction only upon delete through admin
> interface, try to override modelAdmin's has_delete_permission()
> method. Or else, model.delete().
>
> On Mar 12, 8:37 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > I need to add a custom permission to only allow deletes on an object
> > if it has a certain property and the user is in a specific group, and
> > I need it to work in Django admin.
> > TIA,
> > Brandon

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



Permissions help

2010-03-12 Thread Brandon Taylor
Hi Everyone,

I need to add a custom permission to only allow deletes on an object
if it has a certain property and the user is in a specific group, and
I need it to work in Django admin.

Possible? I was thinking I might just override the template and remove
the delete link, but permissions seems like the cleaner way to do it.

TIA,
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Need help understanding a custom upload example

2010-02-16 Thread Brandon Taylor
Thanks Thanos, that answered my question! Btw, which plan do you have
your site on? I was going to suggest a Shared 4 with extra RAM.

On Feb 16, 1:17 pm, thanos <than...@gmail.com> wrote:
> I would use Django's current behavior. This defaults to using  64K
> chunks when a file is bigger that FILE_UPLOAD_MAX_MEMORY_SIZE.
> Since 64k chunks  should be small enough for Webfaction. You just need
> to set  FILE_UPLOAD_MAX_MEMORY_SIZE  in the settings.py to something
> low such as 102500 (100K).
>
> I'm also using WebFaction and that's the strategy I'm using to handle
> very large images (> 100 Meg).
>
> Yours
>
> Thanos.
>
> On Feb 16, 10:07 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
>
>
> > Hi Everyone,
>
> > I'm confused about creating a custom upload handler and how it ties
> > into my model. From the docs, this is an example of a custom upload
> > handler, which I'm assuming goes in my view, or is accessed from my
> > view:
>
> > def handle_uploaded_file(f):
> >     destination = open('some/file/name.txt', 'wb+')
> >     for chunk in f.chunks():
> >         destination.write(chunk)
> >     destination.close()
>
> > Let's say my model is:
>
> > class MyModel(models.Model):
> >     my_file = models.FileField(upload_to='uploads/')
>
> > How do the FileField "my_file" and the handler "handled_uploaded_file"
> > work together? In my project, I need to allow users to upload large-
> > ish files. Say 10 - 20 MB. What's the best way to handle this
> > functionality? I would sincerely appreciate an example if someone has
> > one.
>
> > Kindest Regards,
> > Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Need help understanding a custom upload example

2010-02-16 Thread Brandon Taylor
Hi Michael,

I'm familiar with using with. The documentation states that it's
usually easiest to use chunks of a file to prevent memory over use. My
client's site needs to run in a shared environment at WebFaction, so
I'm just trying to limit memory use on these file uploads as much as
possible.

So, what I'm looking for is an example of how to do what the
documentation states - use chunks all the time instead of loading the
file into memory if it's 2.5MB or less.

Thanks,
Brandon

On Feb 16, 12:18 pm, msmit...@naz.edu wrote:
> I'm wondering where you got the idea that your custom handler is a function 
> that goes into your view. From what I'm reading 
> (http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#upload...) it 
> looks like a custom handler needs to be a class that implements at least 
> receive_data_chunk(self, raw_data, start) and file_complete(self, file_size).
>
> (As an aside, if you're using Python 2.5 or greater you might consider using 
> the 'with' statement in your handler... 
> <http://www.python.org/doc/2.5.2/ref/with.html>)
>
> Best wishes,
> Michael A. Smith
> Web & Digital / Academic Technologies Manager
> Nazareth College
>
> - "Brandon Taylor" <btaylordes...@gmail.com> wrote:
>
>
>
> > Hi Everyone,
>
> > I'm confused about creating a custom upload handler and how it ties
> > into my model. From the docs, this is an example of a custom upload
> > handler, which I'm assuming goes in my view, or is accessed from my
> > view:
>
> > def handle_uploaded_file(f):
> >     destination = open('some/file/name.txt', 'wb+')
> >     for chunk in f.chunks():
> >         destination.write(chunk)
> >     destination.close()
>
> > Let's say my model is:
>
> > class MyModel(models.Model):
> >     my_file = models.FileField(upload_to='uploads/')
>
> > How do the FileField "my_file" and the handler
> > "handled_uploaded_file"
> > work together? In my project, I need to allow users to upload large-
> > ish files. Say 10 - 20 MB. What's the best way to handle this
> > functionality? I would sincerely appreciate an example if someone has
> > one.
>
> > Kindest Regards,
> > Brandon
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To post to this group, send email to django-us...@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-us...@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.



Need help understanding a custom upload example

2010-02-16 Thread Brandon Taylor
Hi Everyone,

I'm confused about creating a custom upload handler and how it ties
into my model. From the docs, this is an example of a custom upload
handler, which I'm assuming goes in my view, or is accessed from my
view:

def handle_uploaded_file(f):
destination = open('some/file/name.txt', 'wb+')
for chunk in f.chunks():
destination.write(chunk)
destination.close()


Let's say my model is:

class MyModel(models.Model):
my_file = models.FileField(upload_to='uploads/')


How do the FileField "my_file" and the handler "handled_uploaded_file"
work together? In my project, I need to allow users to upload large-
ish files. Say 10 - 20 MB. What's the best way to handle this
functionality? I would sincerely appreciate an example if someone has
one.

Kindest Regards,
Brandon

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



Problem with long running processes and db records

2010-02-09 Thread Brandon Taylor
Hi everyone,

Our basic content model pseudo-code is:

class Content(models.Model)

class Image(Content)

class Story(Content)
lead_art = ForeignKey(Content)


Content has an ID of course, and Image, Story, etc have a
content_ptr_id

What we're experiencing from time to time in Django admin is this
scenario:

A Story will be saved, creating:

Content id: 100
Story content_ptr_id: 100

Then an image will be saved, kicking off an upload process. What's
happening is that the Content ID will be created, but the Image
content_ptr_id won't be created until the file upload completes. This
creates a race condition on the Images table. When someone is trying
to relate an Image as lead art, we're getting a 500 error because the
Content ID we just created doesn't exist yet in Images.

So, we're trying to figure out the best way to prevent this from
happening. Can anyone offer any advice?

Kindest regards,
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: What hosting companies do you use for django hosting?

2010-02-09 Thread Brandon Taylor
WebFaction. They are simply awesome.

On Feb 9, 9:52 am, adamjamesdrew  wrote:
> 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-us...@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: Form validation: Add at least one item to inline model

2009-11-23 Thread Brandon Taylor
http://wadofstuff.blogspot.com/2009/08/requiring-at-least-one-inline-formset.html

On Nov 23, 6:06 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi everyone,
>
> I need to validate that at lease one item has been added to an inline
> model in Django admin. I'm not quite sure where to put this
> validation...can someone help me out?
>
> TIA,
> Brandon

--

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




Form validation: Add at least one item to inline model

2009-11-23 Thread Brandon Taylor
Hi everyone,

I need to validate that at lease one item has been added to an inline
model in Django admin. I'm not quite sure where to put this
validation...can someone help me out?

TIA,
Brandon

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Apache/mod_wsgi woes

2009-11-19 Thread Brandon Taylor
Well, for whatever reason, my setup is working again after updating to
Fusion 3. I'm not sure if something within Fusion got hosed, but I
doubt it, since I was seeing the same behavior on two different Macs,
one at home, one at the office.

After a clean install of Ubuntu 9.1, Apache2 and mod_wsgi,
everything's working again, finally. Ugh.

Cheers,
Brandon

On Nov 19, 9:40 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi Andy,
>
> Thanks for the reply. The Ubuntu instance only has one Python
> installed - 2.6.4. I thought it might be a problem related to that as
> well. This has been a really, really frustrating problem! Even setting
> up a new VM from scratch and re-installing everything hasn't solved
> this issue.
>
> I can't explain why it won't work in a VM, but it will if I'm dual-
> booting, or just running Ubuntu native.
>
> b
>
> On Nov 19, 9:14 am, Andy McKay <a...@clearwind.ca> wrote:
>
>
>
> > On 09-11-19 6:40 AM, Brandon Taylor wrote:
>
> > > ImproperlyConfigured: ImportError filebrowser: No module named
> > > filebrowser
>
> > > I can start python from the command line, and import filebrowser,
> > > django, or any of my other modules without errors.
>
> > You could be using a different python. If you installed mod_wsgi through
> > a package manager, which Python does it use 2.5 or 2.6 (I don't know the
> > answer to that, but the traceback might). Do you have multiple pythons
> > on your machine?
> > --
> >    Andy McKay, @clearwind
> >    Training:http://clearwind.ca/training/

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Apache/mod_wsgi woes

2009-11-19 Thread Brandon Taylor
Hi Andy,

Thanks for the reply. The Ubuntu instance only has one Python
installed - 2.6.4. I thought it might be a problem related to that as
well. This has been a really, really frustrating problem! Even setting
up a new VM from scratch and re-installing everything hasn't solved
this issue.

I can't explain why it won't work in a VM, but it will if I'm dual-
booting, or just running Ubuntu native.

b

On Nov 19, 9:14 am, Andy McKay <a...@clearwind.ca> wrote:
> On 09-11-19 6:40 AM, Brandon Taylor wrote:
>
> > ImproperlyConfigured: ImportError filebrowser: No module named
> > filebrowser
>
> > I can start python from the command line, and import filebrowser,
> > django, or any of my other modules without errors.
>
> You could be using a different python. If you installed mod_wsgi through
> a package manager, which Python does it use 2.5 or 2.6 (I don't know the
> answer to that, but the traceback might). Do you have multiple pythons
> on your machine?
> --
>    Andy McKay, @clearwind
>    Training:http://clearwind.ca/training/

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Apache/mod_wsgi woes

2009-11-19 Thread Brandon Taylor
Hi everyone,

I'm developing on Ubuntu 9.1 in a VM Ware Fusion instance on OS X,
10.5.8. I have apache2-mpm-worker and mod_wsgi installed through
aptitude.

I have Django 1.1.1 installed in /usr/local/lib/python2.6/dist-
packages.

My django project is in:
/home/btaylor/django_projects/cit

My .wsgi file is in:
/home/btaylor/django_projects/cit/apache/django.wsgi

My wsgi file code is at: http://dpaste.com/122399/


I created a virtual server in my /etc/apache2/sites-available and
symlinked it into /etc/apache2/sites-enabled, stopped, and restarted
apache.

My virtual server config is at: http://dpaste.com/122400/


I have several python packages installed, like filebrowser, sorl,
django-tinymce, django-tagging, etc. When I hit:
local.careersintax.com, I get a 500 error:

ImproperlyConfigured: ImportError filebrowser: No module named
filebrowser

I can start python from the command line, and import filebrowser,
django, or any of my other modules without errors.

Obviously the Python Path isn't being set properly, but I have
absolutely no idea what the problem is. The exact same code, and
apache setup works perfectly if I boot into Ubuntu instead of running
it in a VM.

Can someone please shed some light onto what might be happening? I'm
stumped, and have been at this for hours.

TIA,
Brandon

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Scanning uploads for viruses

2009-11-13 Thread Brandon Taylor
Thank you very much for the reply David. I was compiling ClamAV from
source very late last night, but if I can go through apt-get, I'll
certainly do that. I'm with you, I would certainly rather catch these
on the upload than the download. I tried to talk the client into only
using a the text from the resume, which I'm going to grab and stick
into the DB anyway, but for some reason, they insist on letting people
upload.

Kindest regards,
Brandon

On Nov 13, 6:08 am, David De La Harpe Golden
<david.delaharpe.gol...@ichec.ie> wrote:
> Brandon Taylor wrote:
> > Greetings all,
>
> > My project involves uploading Word documents (resumes), and I would
> > like to be able to scan them for viruses. I've found ClamAV, but
> > installation is proving a little testy. So, I thought I'd ping the
> > community for advice. Should I even be concerned with this? My
> > deployment server is Linux, and the client is running anti virus
> > software on their PCs, which I'm sure scan downloads.
>
> > I'd appreciate your advice!
>
> I'd certainly be vaguely concerned about it.
>
> Installing clamav-daemon, clamav-freshclam, python-pyclamd etc. should
> be a straightforward "aptitude install" operation on debian at least.
>
> I'm presently using clamav via pyclamd to scan uploaded docs in django
> via a forms.FileField subclass, something along the lines of the example
> below:
>
> from django.forms import fields
>
> import pyclamd
> from pyclamd import ScanError
>
> # really this should be a setting, and of course allow network_socket
> pyclamd.init_unix_socket(filename='/var/run/clamav/clamd.ctl')
>
> class VirusScannedFileField(forms.FileField):
>     default_error_messages = {
>         'virus_found': u"Warning! Warning! Uploaded File may contain a
> VIRUS! %(virus_detail)s",
>         'virus_commerr': u"Failed to contact virus scanner. Please try
> again later.",
>     }
>     def clean(self, data, initial=None):
>         """
>         Uses pyclamd to virus check an uploaded file
>         """
>         f = super(VirusScannedFileField, self).clean(data, initial)
>         if f is None:
>             return None
>         elif not data and initial:
>             return initial
>
>         # We might have a path or we might
>         # have to read the data into memory
>         # FIXME: use scan_file and scan_stream as appropriate
>         if hasattr(data, 'temporary_file_path'):
>             buf = file(data.temporary_file_path(),'rb').read()
>         else:
>             if hasattr(data, 'read'):
>                 buf = data.read()
>             else:
>                 buf = data['content']
>         try:
>             ret = pyclamd.scan_stream(buf)
>             if ret:
>                 raise
> fields.ValidationError(self.error_messages['virus_found'] %
> {'virus_detail': ', '.join([i for i in ret.itervalues()])})
>
>         except ScanError, e:
>             raise
> fields.ValidationError(self.error_messages['virus_commerr'])
>
>         if hasattr(f, 'seek') and callable(f.seek):
>             f.seek(0)
>         return f

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Scanning uploads for viruses

2009-11-13 Thread Brandon Taylor
Greetings all,

My project involves uploading Word documents (resumes), and I would
like to be able to scan them for viruses. I've found ClamAV, but
installation is proving a little testy. So, I thought I'd ping the
community for advice. Should I even be concerned with this? My
deployment server is Linux, and the client is running anti virus
software on their PCs, which I'm sure scan downloads.

I'd appreciate your advice!

Kind regards,
Brandon

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




formfield_overrides for Auth.User?

2009-09-20 Thread Brandon Taylor

Hello everyone,

I've implemented a custom backend to use an email address instead of a
username. Unfortunately, this prevents me from using the built-in User
change form within admin.

I'm looking for a way to override the username form field with my own
field, or at least change the validation on the username field to
accept an email address.

Does anyone know of a quick way to override the built-in change form
for Auth.User?

TIA,
Brandon
--~--~-~--~~~---~--~~
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 invoke hasNoProfanities?

2009-09-09 Thread Brandon Taylor

Hi everyone,

I would like to do some obscenity filtering on posts, and I see there
is a setting: PROFANITIES_LIST

But, how to I invoke the hasNoProfanities validator? I searched the
django source code for this, but the only thing I could find was the
setting in conf > global_settings.py

I'd appreciate some pointers.

Thanks,
Brandon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



MySQL-Python and Snow Leopard

2009-09-08 Thread Brandon Taylor

Hi everyone,

After following the custom build instructions for MySQL from
Hivelogic, http://hivelogic.com/articles/compiling-mysql-on-snow-leopard/
MySQL is running just fine.

However, I can't get MySQL-Python 1.2.3c1 to compile. I have re-
installed Xcode for 10.6, but I get an error trace a mile long, ending
with error: Setup script exited with error: command 'gcc' failed with
exit status 1

Fun times. Has anyone been able to get this running? I'd appreciate
some pointers!

Thanks,
Brandon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



zxJDBC.DatabaseError: driver [org.postgresql.Driver] not found Jython

2009-09-03 Thread Brandon Taylor

Hi Everyone,

I'm running Jython 2.5.0 and Django 1.0.3 on OS X Snow Leopard.

Having an issue connecting to Postgres. I can create and run a project
fine, but attempting to connect to a database using the django-jython
database backend - doj.backends.zxjdbc.postgresql, throws the error:

zxJDBC.DatabaseError: driver [org.postgresql.Driver] not found Jython

I found a post: 
http://stackoverflow.com/questions/468763/how-to-connect-to-database-from-jython

I'm not a Java developer, but correct me if I'm wrong...isn't Java SE
6 the same as JDK 1.6? The post indicates that switching from JDK 1.5
32 bit to JDK 1.6 64 bit solves the issue.

I would certainly appreciate some pointers!

Cheers,
Brandon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem with Django/Jython and Postgres backend

2009-08-18 Thread Brandon Taylor

Hi everyone,

I'm getting this exception with the latest Django-Jython and
Jython2.5:

wks-btaylor:test_project btaylor$ jython manage.py runserver
Validating models...
Unhandled exception in thread started by 
Traceback (most recent call last):
  File "/Users/btaylor/jython2.5.0/Lib/site-packages/django/core/
management/commands/runserver.py", line 48, in inner_run
self.validate(display_num_errors=True)
  File "/Users/btaylor/jython2.5.0/Lib/site-packages/django/core/
management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
  File "/Users/btaylor/jython2.5.0/Lib/site-packages/django/core/
management/validation.py", line 22, in get_validation_errors
from django.db import models, connection
  File "/Users/btaylor/jython2.5.0/Lib/site-packages/django/db/
__init__.py", line 50, in 
connection = backend.DatabaseWrapper({
  File "/Users/btaylor/jython2.5.0/Lib/site-packages/doj/backends/
zxjdbc/postgresql/base.py", line 54, in __init__
self.client = DatabaseClient()
TypeError: __init__() takes exactly 2 arguments (1 given)


Anyone able to get Django running on Jython on OS X 10.5.x ? I'd
appreciate some pointers!
TIA,
Brandon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Receiving email, similar to Rails

2009-08-03 Thread Brandon Taylor

Hi everyone,

Does anyone know of a way to mimic the functionality Rails has to set
up a URL pattern to receive emails and handle attachments, such as
photos?

TIA,
Brandon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Error with runserver using jython

2009-07-31 Thread Brandon Taylor

Hi everyone,

I created a new project through jython/django-admin.py and now I'm
receiving this error when attempting to start the development server
using jython...

iMac:musaic bt$ jython manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 4, in 
import settings # Assumed to be in the same directory.
  File "manage.py", line 4, in 
import settings # Assumed to be in the same directory.
java.lang.ArrayIndexOutOfBoundsException: 12840
at org.python.objectweb.asm.ClassReader.readClass(Unknown Source)
at org.python.objectweb.asm.ClassReader.accept(Unknown Source)
at org.python.objectweb.asm.ClassReader.accept(Unknown Source)
at org.python.core.AnnotationReader.(AnnotationReader.java:44)
at org.python.core.imp.readCode(imp.java:154)
at org.python.core.imp.createFromPyClass(imp.java:120)
at org.python.core.imp.loadFromSource(imp.java:504)
at org.python.core.imp.find_module(imp.java:410)
at org.python.core.imp.import_next(imp.java:620)
at org.python.core.imp.import_name(imp.java:731)
at org.python.core.imp.importName(imp.java:791)
at org.python.core.ImportFunction.__call__(__builtin__.java:1236)
at org.python.core.PyObject.__call__(PyObject.java:367)
at org.python.core.__builtin__.__import__(__builtin__.java:1207)
at org.python.core.__builtin__.__import__(__builtin__.java:1190)
at org.python.core.imp.importOne(imp.java:802)
at org.python.pycode._pyx0.f$0(manage.py:11)
at org.python.pycode._pyx0.call_function(manage.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1197)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:
166)
at org.python.util.jython.run(jython.java:229)
at org.python.util.jython.main(jython.java:117)

java.lang.ArrayIndexOutOfBoundsException:
java.lang.ArrayIndexOutOfBoundsException: 12840

My project structure is simply:

~/jython_django_projects/
__init__.py
manage.py
settings.py
urls.py

Thoughts?
Brandon
--~--~-~--~~~---~--~~
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 on Jython

2009-07-31 Thread Brandon Taylor

Hello everyone,

I'm getting a Jython environment set up, and have it installed and
working properly. Now it's time to install django-jython and django
itself.

The problem is, I can't install django-jython because I don't have
distutils installed for Jython. I also can't seem to find distutils
ANYWHERE so I can install it.

Can someone please point me in the direction of distutils that I can
install for Jython?

TIA,
Brandon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Branding block tag missing for login in Grappelli?

2009-06-17 Thread Brandon Taylor

Hi everyone,

I'm looking into Grappelli's awesome admin interface, but my login is
missing any sort of branding, and it looks like I'd have to override
their template and add some CSS to fix it. Am I just missing
something? or are other people seeing the same thing?

Kind regards,
Brandon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



FileField will not validate

2009-06-12 Thread Brandon Taylor

Hi Everyone,

I'm using Django trunk, Python 2.6.

I have a model form with a FileField. The relevant portions of the
HTML are:


{{ job_seeker_form.resume }}
{{ job_seeker_form.resume.label_tag }}
{{ job_seeker_form.resume.help_text }}
{{ job_seeker_form.resume.errors }}


In my view, the relevant portions of code are:

def create_career_profile(request):
if request.method == 'POST':
job_seeker_form = JobSeekerProfileForm(request.POST,
request.FILES, prefix='job_seeker')
#do more stuff here
else:
job_seeker_form = JobSeekerProfileForm(prefix='job_seeker')

return render_to_response, etc

Every time I post this form, I get a required validation error on the
resume field. Can anyone see what I'm doing wrong?

TIA,
Brandon
--~--~-~--~~~---~--~~
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: Anyone else having issues with filter_horizontal in trunk?

2009-05-04 Thread Brandon Taylor

I was modifying the form submission with some Ajax code that busted
the filter_horizontal apparently. Preventing the default action of the
form with jQuery is not a good idea :)

On May 4, 10:41 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi George,
>
> I wonder what the deal is then. I've noticed this issue on two apps
> I'm working on. The only thing those apps have in common is that I'm
> also leveraging jQuery and overriding the change_form.html template.
>
> I guess I'll just make a new app and start adding things until it
> breaks.
>
> On May 4, 10:30 am, George Song <geo...@damacy.net> wrote:
>
> > On 5/4/2009 8:24 AM, Brandon Taylor wrote:
>
> > > filter_vertical also appears to be suffering the same problem.
>
> > > On May 4, 10:23 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
> > >> Hi everyone,
>
> > >> When I specify filter_horizontal for any ManyToMany field on a model
> > >> using Django trunk, and that field is required, admin will not allow
> > >> me to save the choice(s). it will tell me the field is required, no
> > >> matter how many choices I select.
>
> > >> If I remove the filter_horizontal, and I make selection(s), the form
> > >> will submit properly.
>
> > >> Anyone else seeing the same issue?
>
> > I just tested it in my app and it's fine.
>
> > --
> > George
--~--~-~--~~~---~--~~
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: Anyone else having issues with filter_horizontal in trunk?

2009-05-04 Thread Brandon Taylor

Hi George,

I wonder what the deal is then. I've noticed this issue on two apps
I'm working on. The only thing those apps have in common is that I'm
also leveraging jQuery and overriding the change_form.html template.

I guess I'll just make a new app and start adding things until it
breaks.

On May 4, 10:30 am, George Song <geo...@damacy.net> wrote:
> On 5/4/2009 8:24 AM, Brandon Taylor wrote:
>
> > filter_vertical also appears to be suffering the same problem.
>
> > On May 4, 10:23 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
> >> Hi everyone,
>
> >> When I specify filter_horizontal for any ManyToMany field on a model
> >> using Django trunk, and that field is required, admin will not allow
> >> me to save the choice(s). it will tell me the field is required, no
> >> matter how many choices I select.
>
> >> If I remove the filter_horizontal, and I make selection(s), the form
> >> will submit properly.
>
> >> Anyone else seeing the same issue?
>
> I just tested it in my app and it's fine.
>
> --
> George
--~--~-~--~~~---~--~~
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: Anyone else having issues with filter_horizontal in trunk?

2009-05-04 Thread Brandon Taylor

filter_vertical also appears to be suffering the same problem.

On May 4, 10:23 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi everyone,
>
> When I specify filter_horizontal for any ManyToMany field on a model
> using Django trunk, and that field is required, admin will not allow
> me to save the choice(s). it will tell me the field is required, no
> matter how many choices I select.
>
> If I remove the filter_horizontal, and I make selection(s), the form
> will submit properly.
>
> Anyone else seeing the same issue?
>
> TIA,
> Brandon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Anyone else having issues with filter_horizontal in trunk?

2009-05-04 Thread Brandon Taylor

Hi everyone,

When I specify filter_horizontal for any ManyToMany field on a model
using Django trunk, and that field is required, admin will not allow
me to save the choice(s). it will tell me the field is required, no
matter how many choices I select.

If I remove the filter_horizontal, and I make selection(s), the form
will submit properly.

Anyone else seeing the same issue?

TIA,
Brandon
--~--~-~--~~~---~--~~
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: Anyone else having issues with saving M2M in trunk?

2009-04-17 Thread Brandon Taylor

Ugh. My pastie was bad - had multiple versions of the same file open,
and didn't get the most recent one: http://dpaste.com/34983/

On Apr 17, 3:54 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi Alex,
>
> Thanks for the reply. Here's the link:http://dpaste.com/34979/
>
> b
>
> On Apr 17, 3:50 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
>
> > On Fri, Apr 17, 2009 at 4:48 PM, Brandon Taylor 
> > <btaylordes...@gmail.com>wrote:
>
> > > Hi everyone,
>
> > > I have an abstract model called Page. Two classes inherit this, and
> > > there is a ManyToMany field on Page. syncdb is creating the
> > > intermediary tables correctly, and admin shows me the correct values
> > > to the related model.
>
> > > But, when I go to save the record, none of the m2m data is getting
> > > saved in the intermediary at all.
>
> > > TIA,
> > > Brandon
>
> > Could you dpaste some code that actually exhibits this issue(preferably the
> > smallest amount of code that shows the issue).  It should be noted that we
> > have a rather large test suite, and it all currently runs just fine for me,
> > and it would be failing quite loudly if saivng m2ms didn't work.  So my
> > inclination i that the bug is not in Django.
>
> > Alex
>
> > --
> > "I disapprove of what you say, but I will defend to the death your right to
> > say it." --Voltaire
> > "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
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: Anyone else having issues with saving M2M in trunk?

2009-04-17 Thread Brandon Taylor

Sorry Alex, my bad. I see the error. Doh!

On Apr 17, 3:54 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi Alex,
>
> Thanks for the reply. Here's the link:http://dpaste.com/34979/
>
> b
>
> On Apr 17, 3:50 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
>
> > On Fri, Apr 17, 2009 at 4:48 PM, Brandon Taylor 
> > <btaylordes...@gmail.com>wrote:
>
> > > Hi everyone,
>
> > > I have an abstract model called Page. Two classes inherit this, and
> > > there is a ManyToMany field on Page. syncdb is creating the
> > > intermediary tables correctly, and admin shows me the correct values
> > > to the related model.
>
> > > But, when I go to save the record, none of the m2m data is getting
> > > saved in the intermediary at all.
>
> > > TIA,
> > > Brandon
>
> > Could you dpaste some code that actually exhibits this issue(preferably the
> > smallest amount of code that shows the issue).  It should be noted that we
> > have a rather large test suite, and it all currently runs just fine for me,
> > and it would be failing quite loudly if saivng m2ms didn't work.  So my
> > inclination i that the bug is not in Django.
>
> > Alex
>
> > --
> > "I disapprove of what you say, but I will defend to the death your right to
> > say it." --Voltaire
> > "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
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: Anyone else having issues with saving M2M in trunk?

2009-04-17 Thread Brandon Taylor

Hi Alex,

Thanks for the reply. Here's the link: http://dpaste.com/34979/

b

On Apr 17, 3:50 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Fri, Apr 17, 2009 at 4:48 PM, Brandon Taylor 
> <btaylordes...@gmail.com>wrote:
>
>
>
> > Hi everyone,
>
> > I have an abstract model called Page. Two classes inherit this, and
> > there is a ManyToMany field on Page. syncdb is creating the
> > intermediary tables correctly, and admin shows me the correct values
> > to the related model.
>
> > But, when I go to save the record, none of the m2m data is getting
> > saved in the intermediary at all.
>
> > TIA,
> > Brandon
>
> Could you dpaste some code that actually exhibits this issue(preferably the
> smallest amount of code that shows the issue).  It should be noted that we
> have a rather large test suite, and it all currently runs just fine for me,
> and it would be failing quite loudly if saivng m2ms didn't work.  So my
> inclination i that the bug is not in Django.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Anyone else having issues with saving M2M in trunk?

2009-04-17 Thread Brandon Taylor

Hi everyone,

I have an abstract model called Page. Two classes inherit this, and
there is a ManyToMany field on Page. syncdb is creating the
intermediary tables correctly, and admin shows me the correct values
to the related model.

But, when I go to save the record, none of the m2m data is getting
saved in the intermediary at all.

TIA,
Brandon
--~--~-~--~~~---~--~~
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: Trouble with DateField

2009-04-13 Thread Brandon Taylor

Well, I'm not sure what the matter was, maybe some bad cache or
something, but the problem seems to have corrected itself. Weird!

On Apr 13, 12:06 pm, Brian Neal <bgn...@gmail.com> wrote:
> On Apr 13, 11:47 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
>
>
> > Hi everyone,
>
> > I need a sanity check here. I'm using a jQueryUI DatePicker, with the
> > dateFormat option set to 'yy-mm-dd', which is returning a date in -
> > MM-DD format, if I check my request.POST values.
>
> > I have a DateField - "effective_from", on my model, and am using a
> > corresponding ModelForm. When I check the form.cleaned_data
> > ['effective_from'], I get a Python datetime object as: 2009-04-13.
>
> > However, I'm getting an exception error for the view, saying:
> > ValidationError at /codes/create/
> > Enter a valid date in -MM-DD format.
>
> > I have also parsed the date by hand:
> > , MM, DD = map(int, request.POST['effective_from'].split('-'))
> > effective_from = datetime.date(, MM, DD)
>
> > The portion of the view in question is:
> > form = ActivityCodeForm(request.POST)
> >         if form.is_valid():
> >             activity_code = form.save(commit=False)
> >             activity_code.created_by = request.user
> >             activity_code.category = Category.objects.get(pk=int
> > (form.cleaned_data['kategory']))
> >             activity_code.effective_from = form.cleaned_data
> > ['effective_from']
> >             activity_code.slug = slugify(form.cleaned_data['title'])
> >             activity_code.save()
>
> > Can anyone see what I'm doing wrong here?
>
> Here:
>
> activity_code.effective_from = form.cleaned_data['effective_from']
>
> You are assigning a string to what I assume is a models.DateTimeField
> or DateField. I don't think that works. You need to turn the string
> into a Python datetime object first. I think this is done
> automatically for you if you were using a ModelForm.
>
> Best,
> BN
--~--~-~--~~~---~--~~
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: Trouble with DateField

2009-04-13 Thread Brandon Taylor

Hi Brian,

Yes, I've also made certain that the value returned for effective date
from form.cleaned_data['effective_date'] is a valid Python datetime
object.

Something seems to be amiss. The exception is happening in: django/db/
models/fields/__init__.py in to_python, line 473

If I put a print statement in there to print the 'value' variable
handed to the 'to_python' function, it doesn't return None or the
value, in fact it prints an empty line, which is making me think it's
an empty string...?

b



On Apr 13, 12:06 pm, Brian Neal <bgn...@gmail.com> wrote:
> On Apr 13, 11:47 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
>
>
> > Hi everyone,
>
> > I need a sanity check here. I'm using a jQueryUI DatePicker, with the
> > dateFormat option set to 'yy-mm-dd', which is returning a date in -
> > MM-DD format, if I check my request.POST values.
>
> > I have a DateField - "effective_from", on my model, and am using a
> > corresponding ModelForm. When I check the form.cleaned_data
> > ['effective_from'], I get a Python datetime object as: 2009-04-13.
>
> > However, I'm getting an exception error for the view, saying:
> > ValidationError at /codes/create/
> > Enter a valid date in -MM-DD format.
>
> > I have also parsed the date by hand:
> > , MM, DD = map(int, request.POST['effective_from'].split('-'))
> > effective_from = datetime.date(, MM, DD)
>
> > The portion of the view in question is:
> > form = ActivityCodeForm(request.POST)
> >         if form.is_valid():
> >             activity_code = form.save(commit=False)
> >             activity_code.created_by = request.user
> >             activity_code.category = Category.objects.get(pk=int
> > (form.cleaned_data['kategory']))
> >             activity_code.effective_from = form.cleaned_data
> > ['effective_from']
> >             activity_code.slug = slugify(form.cleaned_data['title'])
> >             activity_code.save()
>
> > Can anyone see what I'm doing wrong here?
>
> Here:
>
> activity_code.effective_from = form.cleaned_data['effective_from']
>
> You are assigning a string to what I assume is a models.DateTimeField
> or DateField. I don't think that works. You need to turn the string
> into a Python datetime object first. I think this is done
> automatically for you if you were using a ModelForm.
>
> Best,
> BN
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Trouble with DateField

2009-04-13 Thread Brandon Taylor

Hi everyone,

I need a sanity check here. I'm using a jQueryUI DatePicker, with the
dateFormat option set to 'yy-mm-dd', which is returning a date in -
MM-DD format, if I check my request.POST values.

I have a DateField - "effective_from", on my model, and am using a
corresponding ModelForm. When I check the form.cleaned_data
['effective_from'], I get a Python datetime object as: 2009-04-13.

However, I'm getting an exception error for the view, saying:
ValidationError at /codes/create/
Enter a valid date in -MM-DD format.

I have also parsed the date by hand:
, MM, DD = map(int, request.POST['effective_from'].split('-'))
effective_from = datetime.date(, MM, DD)


The portion of the view in question is:
form = ActivityCodeForm(request.POST)
if form.is_valid():
activity_code = form.save(commit=False)
activity_code.created_by = request.user
activity_code.category = Category.objects.get(pk=int
(form.cleaned_data['kategory']))
activity_code.effective_from = form.cleaned_data
['effective_from']
activity_code.slug = slugify(form.cleaned_data['title'])
activity_code.save()

Can anyone see what I'm doing wrong here?
TIA,
Brandon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem saving dynamically added form in formset

2009-04-01 Thread Brandon Taylor

Hi everyone,

I'm using an inline formset on a model. I have some jQuery that adds
an additional form to the page, and augments the TOTAL_FORMS parameter
by 1.

The problem is that the dynamically added form is not present in the
collection of forms when I save the formset. All of the name and ID
parameters follow the pattern established by the formset factory for
the inputs, but if I iterate over the instances in the formset, those
dynamically added forms are nowhere to be found.

Does anyone have any ideas on what could be wrong? I have verified the
number of TOTAL_FORMS in the management form matches the number of
forms present after adding the new form, but I'm not sure what else to
check.

Kind regards,
Brandon
--~--~-~--~~~---~--~~
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: More DJango Tagging Oracle Issues

2009-03-24 Thread Brandon Taylor

I have confirmed that it also works as expected with cx_Oracle-5.0.1

Woohoo

On Mar 24, 2:14 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> After much digging, I was able to find the problem. In fields.py in
> django-tagging, the tags are pulled from cache when they are saved,
> rather than going back to the database.
>
> The problem I was seeing wasn't that tags werent' being applied to
> objects, or added to the database, but the input field was NOT
> reflecting the changes to the tags. The cache was not being set with
> the new values.
>
> So, I found a ticket on the tagging 
> site:http://code.google.com/p/django-tagging/issues/detail?id=28=1=c...
>
> Which has a patch, but that doesn't work for the svn checkout of
> django-tagging. I changed the _post_init method to:
>
> #fields.py
> def contribute_to_class(self, cls, name):
>         super(TagField, self).contribute_to_class(cls, name)
>
>         # Make this object the descriptor for field access.
>         setattr(cls, self.name, self)
>
>         # Save tags back to the database post-save
>         signals.post_save.connect(self._save, cls, True)
>         signals.post_init.connect(self._post_init, cls, True) #wire it
> up here
>
> def _post_init(self, **kwargs):
>         instance = kwargs['instance']
>         if instance._get_pk_val() is None:
>             self._set_instance_tag_cache(instance, '')
>         else:
>             self._set_instance_tag_cache(instance, edit_string_for_tags
> (Tag.objects.get_for_object(instance)))
>             #this re-sets the tags from the database
>
> This caused some interesting behavior on the form field. Instead of
> tags being separated by commas, and multi-word tags being enclosed in
> quotes, everything was just separated by a space. This causes tags to
> be improperly assigned on the next save. So, I changed the
> edit_string_for_tags method to:
>
> def edit_string_for_tags(tags):
>     names = []
>     for tag in tags:
>         name = tag.name
>         if u' ' in name:
>             names.append('"%s"' % name)
>             continue
>         names.append(name)
>
>     return ', '.join(names)
>
> Now tags are properly formatted in my tags text field, and tags are
> properly assigned to objects. This also does not break compatibility
> with other DB types for me. Last step will be to replace my
> cx_Oracle-4.4.1 driver with the latest 5.0.1, and see if it still
> works.
>
> Hope this helps someone out!
>
> Cheers,
> Brandon
>
> On Mar 23, 5:40 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > Hi Ian,
>
> > I'm not that familiar with Oracle, so I have no idea if the problems
> > I'm experiencing are related in some way to permissions, etc, but I
> > have been reassured by my Oracle person that my user has full
> > permissions on my schema.
>
> > That being said, the TagField() will show up in admin when specifying:
>
> > from tagging.fields import TagField
>
> > class MyModel(models.Model):
> >     tags = TagField()
>
> > When I create a new record, any tags that I have entered will be saved
> > to the tagging tables and associated to the record. However, when I
> > update the record, and add tags that aren't already present, or remove
> > all of the tags, no changes to the record will occur. All of the tags
> > that were there when I created the record are still there, but no new
> > tags, and no tags removed.
>
> > If I take the *exact* same model code, and switch my database to
> > SQLite or MySQL, I have no issues. I can only deduce that it's
> > something either wrong with my Oracle permissions, or with cx_Oracle
> > itself. I have wiped out my tables, re-validated, re-sync'd. Quadruple-
> > checked my code. And still the same problem. But yes, at least I can
> > add tags.
>
> > Perplexed,
> > Brandon
>
> > On Mar 23, 4:31 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote:
>
> > > On Mar 23, 1:52 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > > > Hi Everyone,
>
> > > > Is anyone having issues with Django Tagging (svn) not updating tags on
> > > > an existing model? I'm running cx_Oracle-4.4.1 - thanks to (Ian Kelly)
> > > > and Django Trunk.
>
> > > Hmm.  I tried running the same model you posted before with Python 2.6
> > > and cx_Oracle 5.0.1, and I can't see that it makes any difference; it
> > > still works for me.  Glad you got it (at least partially) working,
> > > though.
>
> > > > I can add tags when a model instance is created, but update/delete is
> > > > not working.
>
> > > Can you be more specific?  It seems to be working for me.
>
> > > Regards,
> > > Ian
--~--~-~--~~~---~--~~
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: More DJango Tagging Oracle Issues

2009-03-24 Thread Brandon Taylor

After much digging, I was able to find the problem. In fields.py in
django-tagging, the tags are pulled from cache when they are saved,
rather than going back to the database.

The problem I was seeing wasn't that tags werent' being applied to
objects, or added to the database, but the input field was NOT
reflecting the changes to the tags. The cache was not being set with
the new values.

So, I found a ticket on the tagging site:
http://code.google.com/p/django-tagging/issues/detail?id=28=1=cache

Which has a patch, but that doesn't work for the svn checkout of
django-tagging. I changed the _post_init method to:

#fields.py
def contribute_to_class(self, cls, name):
super(TagField, self).contribute_to_class(cls, name)

# Make this object the descriptor for field access.
setattr(cls, self.name, self)

# Save tags back to the database post-save
signals.post_save.connect(self._save, cls, True)
signals.post_init.connect(self._post_init, cls, True) #wire it
up here

def _post_init(self, **kwargs):
instance = kwargs['instance']
if instance._get_pk_val() is None:
self._set_instance_tag_cache(instance, '')
else:
self._set_instance_tag_cache(instance, edit_string_for_tags
(Tag.objects.get_for_object(instance)))
#this re-sets the tags from the database


This caused some interesting behavior on the form field. Instead of
tags being separated by commas, and multi-word tags being enclosed in
quotes, everything was just separated by a space. This causes tags to
be improperly assigned on the next save. So, I changed the
edit_string_for_tags method to:

def edit_string_for_tags(tags):
names = []
for tag in tags:
name = tag.name
if u' ' in name:
names.append('"%s"' % name)
continue
names.append(name)

return ', '.join(names)


Now tags are properly formatted in my tags text field, and tags are
properly assigned to objects. This also does not break compatibility
with other DB types for me. Last step will be to replace my
cx_Oracle-4.4.1 driver with the latest 5.0.1, and see if it still
works.

Hope this helps someone out!

Cheers,
Brandon

On Mar 23, 5:40 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi Ian,
>
> I'm not that familiar with Oracle, so I have no idea if the problems
> I'm experiencing are related in some way to permissions, etc, but I
> have been reassured by my Oracle person that my user has full
> permissions on my schema.
>
> That being said, the TagField() will show up in admin when specifying:
>
> from tagging.fields import TagField
>
> class MyModel(models.Model):
>     tags = TagField()
>
> When I create a new record, any tags that I have entered will be saved
> to the tagging tables and associated to the record. However, when I
> update the record, and add tags that aren't already present, or remove
> all of the tags, no changes to the record will occur. All of the tags
> that were there when I created the record are still there, but no new
> tags, and no tags removed.
>
> If I take the *exact* same model code, and switch my database to
> SQLite or MySQL, I have no issues. I can only deduce that it's
> something either wrong with my Oracle permissions, or with cx_Oracle
> itself. I have wiped out my tables, re-validated, re-sync'd. Quadruple-
> checked my code. And still the same problem. But yes, at least I can
> add tags.
>
> Perplexed,
> Brandon
>
> On Mar 23, 4:31 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote:
>
> > On Mar 23, 1:52 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > > Hi Everyone,
>
> > > Is anyone having issues with Django Tagging (svn) not updating tags on
> > > an existing model? I'm running cx_Oracle-4.4.1 - thanks to (Ian Kelly)
> > > and Django Trunk.
>
> > Hmm.  I tried running the same model you posted before with Python 2.6
> > and cx_Oracle 5.0.1, and I can't see that it makes any difference; it
> > still works for me.  Glad you got it (at least partially) working,
> > though.
>
> > > I can add tags when a model instance is created, but update/delete is
> > > not working.
>
> > Can you be more specific?  It seems to be working for me.
>
> > Regards,
> > Ian
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Anyone have experience with this recursion template tag?

2009-03-23 Thread Brandon Taylor

Hi everyone,

I'm following this tutorial for recursion in templates:
http://www.undefinedfire.com/lab/recursion-django-templates/
Here is my model:

#models.py
class Category(models.Model):
parent = models.ForeignKey('self', blank=True, null=True)
name = models.CharField(max_length=50)
slug = models.SlugField()

class Meta:
verbose_name_plural = 'Categories'

def __unicode__(self):
parent = ''
if self.parent:
parent = str(self.parent) + ' - '
return '%s%s' % (parent, self.name)

class CategoryAdmin(admin.ModelAdmin):
prepopulated_fields = ({ 'slug' : ('name',) })

admin.site.register(Category, CategoryAdmin)


#categories.html
{% load recurse %}
{% recurse category.category_set.all with categories as category
%}

{% loop %}

{{ category.name }}
{% child %}

{% endloop %}

{% endrecurse %}


Let's say I have the following data:
Children
Children > Toys
Children > Clothing

The output I'm seeing is:

Children
Clothing

When I would expect it to be:
Children
Clothing
Toys


Here is my view:
def get_categories(request):
categories = Category.objects.filter(parent__isnull=True)
return render_to_response('categories.html', {'categories' :
categories})


If I get my first category root object, and call:
print categories[0].category_set.all()

I get:
[, ]


Does anyone see what I did wrong?
Kind regards,
Brandon
--~--~-~--~~~---~--~~
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: More DJango Tagging Oracle Issues

2009-03-23 Thread Brandon Taylor

Hi Ian,

I'm not that familiar with Oracle, so I have no idea if the problems
I'm experiencing are related in some way to permissions, etc, but I
have been reassured by my Oracle person that my user has full
permissions on my schema.

That being said, the TagField() will show up in admin when specifying:

from tagging.fields import TagField

class MyModel(models.Model):
tags = TagField()


When I create a new record, any tags that I have entered will be saved
to the tagging tables and associated to the record. However, when I
update the record, and add tags that aren't already present, or remove
all of the tags, no changes to the record will occur. All of the tags
that were there when I created the record are still there, but no new
tags, and no tags removed.

If I take the *exact* same model code, and switch my database to
SQLite or MySQL, I have no issues. I can only deduce that it's
something either wrong with my Oracle permissions, or with cx_Oracle
itself. I have wiped out my tables, re-validated, re-sync'd. Quadruple-
checked my code. And still the same problem. But yes, at least I can
add tags.

Perplexed,
Brandon

On Mar 23, 4:31 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote:
> On Mar 23, 1:52 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > Hi Everyone,
>
> > Is anyone having issues with Django Tagging (svn) not updating tags on
> > an existing model? I'm running cx_Oracle-4.4.1 - thanks to (Ian Kelly)
> > and Django Trunk.
>
> Hmm.  I tried running the same model you posted before with Python 2.6
> and cx_Oracle 5.0.1, and I can't see that it makes any difference; it
> still works for me.  Glad you got it (at least partially) working,
> though.
>
> > I can add tags when a model instance is created, but update/delete is
> > not working.
>
> Can you be more specific?  It seems to be working for me.
>
> Regards,
> Ian
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



More DJango Tagging Oracle Issues

2009-03-23 Thread Brandon Taylor

Hi Everyone,

Is anyone having issues with Django Tagging (svn) not updating tags on
an existing model? I'm running cx_Oracle-4.4.1 - thanks to (Ian Kelly)
and Django Trunk.

I can add tags when a model instance is created, but update/delete is
not working.

TIA,
Brandon
--~--~-~--~~~---~--~~
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-Tagging not working with Oracle

2009-03-23 Thread Brandon Taylor

Downgrading to cx_Oracle-4.4.1 solved the problem. Now I can use the
tagging.fields TagField() as expected and everything shows up
correctly in the admin.

b

On Mar 20, 4:15 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hmm. I might downgrade my cs_Oracle and see if that makes a
> difference. I double-checked my import statements and they match what
> you have:
>
> fromtagging.models import Tag
> fromtagging.fields import TagField
>
> but still, no dice. I'll post my findings here. It may well be a bug
> in cx_Oracle-5.0.1. Lord knows I had enough issues getting it to
> install. Wouldn't surprise me at all if there's something messed up in
> it.
>
> Thanks for taking the time to help, I sincerely appreciate it. I'll
> post my findings later.
>
> Cheers,
> b
>
> On Mar 20, 3:33 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote:
>
> > On Mar 20, 1:52 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > > Hmm. Well, I guess the only thing left to ask is what version of
> > >DjangoandTaggingyou're running?
>
> > > I'm usingOracle10g, cx_Oracle-5.0.1,DjangoandTaggingfrom svn.
> > > Other than that, I'm at a loss :)
>
> > The same, but cx_Oracle 4.4.1.
>
> > On Mar 20, 1:54 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > > When you say "fixed the import" how so? I'm not seeing where I can
> > > import TagField from any other location intaggingother than
> > > forms.py.
>
> > Sorry, I guess I wasn't clear before.  I just meant that I changed
> > this line:
>
> > fromtagging.forms import TagField
>
> > to this:
>
> > fromtagging.fields import TagField
>
> > Both forms.py and fields.py define a TagField class, and they're not
> > the same thing.
>
> > HTH,
> > Ian
--~--~-~--~~~---~--~~
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-Tagging not working with Oracle

2009-03-20 Thread Brandon Taylor

Hmm. I might downgrade my cs_Oracle and see if that makes a
difference. I double-checked my import statements and they match what
you have:

from tagging.models import Tag
from tagging.fields import TagField

but still, no dice. I'll post my findings here. It may well be a bug
in cx_Oracle-5.0.1. Lord knows I had enough issues getting it to
install. Wouldn't surprise me at all if there's something messed up in
it.

Thanks for taking the time to help, I sincerely appreciate it. I'll
post my findings later.

Cheers,
b

On Mar 20, 3:33 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote:
> On Mar 20, 1:52 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > Hmm. Well, I guess the only thing left to ask is what version of
> > Django and Tagging you're running?
>
> > I'm using Oracle 10g, cx_Oracle-5.0.1, Django and Tagging from svn.
> > Other than that, I'm at a loss :)
>
> The same, but cx_Oracle 4.4.1.
>
> On Mar 20, 1:54 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > When you say "fixed the import" how so? I'm not seeing where I can
> > import TagField from any other location in tagging other than
> > forms.py.
>
> Sorry, I guess I wasn't clear before.  I just meant that I changed
> this line:
>
> from tagging.forms import TagField
>
> to this:
>
> from tagging.fields import TagField
>
> Both forms.py and fields.py define a TagField class, and they're not
> the same thing.
>
> HTH,
> Ian
--~--~-~--~~~---~--~~
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-Tagging not working with Oracle

2009-03-20 Thread Brandon Taylor

Ugh, sorry, that's: fields.py, not forms.py

On Mar 20, 2:54 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> When you say "fixed the import" how so? I'm not seeing where I can
> import TagField from any other location in tagging other than
> forms.py.
>
> On Mar 20, 2:52 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > Hmm. Well, I guess the only thing left to ask is what version of
> > Django and Tagging you're running?
>
> > I'm using Oracle 10g, cx_Oracle-5.0.1, Django and Tagging from svn.
> > Other than that, I'm at a loss :)
>
> > b
>
> > On Mar 20, 2:12 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote:
>
> > > On Mar 20, 12:08 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > > > Nope, still not working. If you're not defining tags = TagField() in
> > > > the model, how are you defining it? As a CharField? I'd like to see
> > > > how your model is set up.
>
> > > > Of course, if I create a CharField and call it tags, it will show up.
> > > > Even overriding the form for the admin, and overriding tags: tags =
> > > > TagField() does not invoke any of the Tagging functionality for me.
>
> > > All I did was to take the model you posted and fix the import.
> > > Running syncdb created the tags column, and the field appears in the
> > > admin and is fully functional.  I didn't have to create a custom form
> > > for the admin at all.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django-Tagging not working with Oracle

2009-03-20 Thread Brandon Taylor

When you say "fixed the import" how so? I'm not seeing where I can
import TagField from any other location in tagging other than
forms.py.

On Mar 20, 2:52 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hmm. Well, I guess the only thing left to ask is what version of
> Django and Tagging you're running?
>
> I'm using Oracle 10g, cx_Oracle-5.0.1, Django and Tagging from svn.
> Other than that, I'm at a loss :)
>
> b
>
> On Mar 20, 2:12 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote:
>
> > On Mar 20, 12:08 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > > Nope, still not working. If you're not defining tags = TagField() in
> > > the model, how are you defining it? As a CharField? I'd like to see
> > > how your model is set up.
>
> > > Of course, if I create a CharField and call it tags, it will show up.
> > > Even overriding the form for the admin, and overriding tags: tags =
> > > TagField() does not invoke any of the Tagging functionality for me.
>
> > All I did was to take the model you posted and fix the import.
> > Running syncdb created the tags column, and the field appears in the
> > admin and is fully functional.  I didn't have to create a custom form
> > for the admin at all.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django-Tagging not working with Oracle

2009-03-20 Thread Brandon Taylor

Hmm. Well, I guess the only thing left to ask is what version of
Django and Tagging you're running?

I'm using Oracle 10g, cx_Oracle-5.0.1, Django and Tagging from svn.
Other than that, I'm at a loss :)

b

On Mar 20, 2:12 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote:
> On Mar 20, 12:08 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > Nope, still not working. If you're not defining tags = TagField() in
> > the model, how are you defining it? As a CharField? I'd like to see
> > how your model is set up.
>
> > Of course, if I create a CharField and call it tags, it will show up.
> > Even overriding the form for the admin, and overriding tags: tags =
> > TagField() does not invoke any of the Tagging functionality for me.
>
> All I did was to take the model you posted and fix the import.
> Running syncdb created the tags column, and the field appears in the
> admin and is fully functional.  I didn't have to create a custom form
> for the admin at all.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django-Tagging not working with Oracle

2009-03-20 Thread Brandon Taylor

Nope, still not working. If you're not defining tags = TagField() in
the model, how are you defining it? As a CharField? I'd like to see
how your model is set up.

Of course, if I create a CharField and call it tags, it will show up.
Even overriding the form for the admin, and overriding tags: tags =
TagField() does not invoke any of the Tagging functionality for me.

b

On Mar 20, 11:49 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hmm. Curious. The exact same code works with MySQL and SQLite3 for me.
>
> Oh well, let me switch it up and see if it's happy.
>
> Kind regards,
> b
>
> On Mar 20, 11:37 am, Ian Kelly <ian.g.ke...@gmail.com> wrote:
>
> > On Mar 20, 8:26 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > > Hi Ian,
>
> > > Thanks for the response. The test case is adding the TagField() to any
> > > model.
>
> > > Here's an excerpt from my model class:
>
> > > #models.py
> > > from django.db import models
> > > from django.contrib import admin
> > > from tagging.models import Tag
> > > from tagging.forms import TagField
>
> > Here's the problem.  The models.py is importing TagField from
> > tagging.forms instead of tagging.fields, and so you're adding a form
> > field to your model rather than a model field.
>
> > HTH,
> > Ian
--~--~-~--~~~---~--~~
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-Tagging not working with Oracle

2009-03-20 Thread Brandon Taylor

Hmm. Curious. The exact same code works with MySQL and SQLite3 for me.

Oh well, let me switch it up and see if it's happy.

Kind regards,
b

On Mar 20, 11:37 am, Ian Kelly <ian.g.ke...@gmail.com> wrote:
> On Mar 20, 8:26 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > Hi Ian,
>
> > Thanks for the response. The test case is adding the TagField() to any
> > model.
>
> > Here's an excerpt from my model class:
>
> > #models.py
> > from django.db import models
> > from django.contrib import admin
> > from tagging.models import Tag
> > from tagging.forms import TagField
>
> Here's the problem.  The models.py is importing TagField from
> tagging.forms instead of tagging.fields, and so you're adding a form
> field to your model rather than a model field.
>
> HTH,
> Ian
--~--~-~--~~~---~--~~
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-Tagging not working with Oracle

2009-03-20 Thread Brandon Taylor

Hi Ian,

Thanks for the response. The test case is adding the TagField() to any
model.

Here's an excerpt from my model class:

#models.py
from django.db import models
from django.contrib import admin
from tagging.models import Tag
from tagging.forms import TagField

class ActivityCode(models.Model):
created_on = models.DateField(auto_now=True, editable=False)
title = models.CharField(max_length=100)
tags = TagField()

class Meta:
verbose_name = 'Activity Code'
verbose_name_plural = 'Activity Codes'
ordering = ['title']

def __unicode__(self):
return self.title

def set_tags(self, tags):
Tag.objects.update_tags(self, tags)

def get_tags(self):
return Tag.objects.get_for_object(self)

admin.site.register(ActivityCode)


When I validate, I get 0 errors. When I sync, I do not get a "tags"
varchar added to the ActivityCode table, however it will add the
Tagging application tables to the schem, which it's picking up from
installed_apps form settings.py.

Thoughts?
Brandon

On Mar 19, 4:01 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote:
> On Mar 19, 9:21 am, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > Hi Everyone,
>
> > I'm using the svn checkout of Django-Tagging and Django-Trunk. Tagging
> > is working perfectly for me with any other database except, of course,
> > Oracle, which is what I need it to work in.
>
> > I can't get the TagField() to show up in the admin at all without
> > adding a custom form for my ModelAdmin class, and when I do, it won't
> > populate the Tags table.
>
> This is working correctly for me with the same setup.  Can you come up
> with a simple test case that exhibits the problem?
>
> Regards,
> Ian
--~--~-~--~~~---~--~~
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-Tagging not working with Oracle

2009-03-19 Thread Brandon Taylor

Hi Everyone,

I'm using the svn checkout of Django-Tagging and Django-Trunk. Tagging
is working perfectly for me with any other database except, of course,
Oracle, which is what I need it to work in.

I can't get the TagField() to show up in the admin at all without
adding a custom form for my ModelAdmin class, and when I do, it won't
populate the Tags table.

Creating a ModelForm instance also omits the tags = TagField() field
from the form.

'tagging' is in my installed apps, and the tagging tables get created
when I syncdb. When compared to another project that leverages Django-
Tagging, the tables look ok, so I'm not sure what might be causing it
not to work.

Does anyone know of a workaround?

Kind regards,
Brandon
--~--~-~--~~~---~--~~
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: Many to Many is empty when saving parent object

2009-03-17 Thread Brandon Taylor

Ah, gotcha, so my signal is attached to the wrong sender. I was
thinking I would have access to the categories during the Entry's save
operation due to the m2m relationship on the field, but obviously not.

I'll move the signal and see what happens.

Thank you,
Brandon

On Mar 16, 6:53 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Mon, 2009-03-16 at 08:48 -0700, Brandon Taylor wrote:
> > Hi everyone,
>
> > I'm running Python 2.6.1, Django Trunk.
>
> > I have a model (Entry) with a ManyToMany (Categories). I need to be
> > able to iterate over these categories whenever my parent model is
> > saved.
>
> > I've tried overriding save_model in the admin, and adding a post_save
> > signal to Entry in order to be able to iterate over the categories.
> > The problem only occurs on an insert. If I do:
>
> > class Entry(models.Model):
> >     name = models.CharField(max_length=100)
> >     categories = models.ManyToManyField(Category)
>
> >     class Meta:
> >         verbose_name_plural = 'Entries'
>
> >     def __unicode__(self):
> >         return self.name
>
> > class EntryAdmin(admin.ModelAdmin):
> >     def save_model(self, request, obj, form, change):
> >         obj.save()
> >         print obj.categories.all()
>
> > obj.categories.all() = []
>
> > However, when performing an update, I have a list of Category objects.
> > Is this a model lifecycle issue as far as when the ManyToMany gets
> > saved? What can I do to be able to access the list of categories when
> > the object is created?
>
> Many-to-many relations cannot be saved until the object itself is saved,
> since they need ot know the object's pk value to use in the relation
> table. Consequently, many-to-many handling in forms is done after saving
> the model itself. You're trying to look up the categories before they've
> been saved.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Many to Many is empty when saving parent object

2009-03-16 Thread Brandon Taylor

Hi everyone,

I'm running Python 2.6.1, Django Trunk.

I have a model (Entry) with a ManyToMany (Categories). I need to be
able to iterate over these categories whenever my parent model is
saved.

I've tried overriding save_model in the admin, and adding a post_save
signal to Entry in order to be able to iterate over the categories.
The problem only occurs on an insert. If I do:

class Entry(models.Model):
name = models.CharField(max_length=100)
categories = models.ManyToManyField(Category)

class Meta:
verbose_name_plural = 'Entries'

def __unicode__(self):
return self.name

class EntryAdmin(admin.ModelAdmin):
def save_model(self, request, obj, form, change):
obj.save()
print obj.categories.all()

obj.categories.all() = []

However, when performing an update, I have a list of Category objects.
Is this a model lifecycle issue as far as when the ManyToMany gets
saved? What can I do to be able to access the list of categories when
the object is created?

TIA,
Brandon
--~--~-~--~~~---~--~~
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: Not able to select from Oracle view

2009-03-09 Thread Brandon Taylor

Hi Alex, thanks for the response.

I see that Django is trying to select a property that doesn't exist
from this view...

SELECT "LU_CSU_CODE"."ID", "LU_CSU_CODE"."DEPARTMENT",
"LU_CSU_CODE"."TITLE" FROM "LU_CSU_CODE" ORDER BY
"LU_CSU_CODE"."DEPARTMENT" ASC

There is no field LU_CSU_CODE.ID

Here is my model:

from django.db import models

class CSUCode(models.Model):
department = models.CharField(max_length=10,
db_column='DEPARTMENT')
title = models.CharField(max_length=255, db_column='TITLE')

class Meta:
verbose_name = 'CSU Code'
verbose_name_plural = 'CSU Codes'
ordering = ['department']
managed = False
db_table = 'LU_CSU_CODE'

def __unicode__(self):
return self.title

Thoughts?

Brandon

On Mar 9, 2:40 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Mon, Mar 9, 2009 at 2:38 PM, Brandon Taylor <btaylordes...@gmail.com>wrote:
>
>
>
> > Hi everyone,
>
> > Is there something special I need to know in order to select records
> > from a view in Oracle? My user has select permissions on the schema in
> > question.
>
> > When I output the SQL from the connection, everything looks in order.
> > I'm using Django trunk, Python 2.6.1 and cx_Oracle-5.0.1
>
> > TIA,
> > Brandon
>
> Nope, it should just work.  What happens when you try to do the query, do
> you get an exception?
>
> ALex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Not able to select from Oracle view

2009-03-09 Thread Brandon Taylor

Hi everyone,

Is there something special I need to know in order to select records
from a view in Oracle? My user has select permissions on the schema in
question.

When I output the SQL from the connection, everything looks in order.
I'm using Django trunk, Python 2.6.1 and cx_Oracle-5.0.1

TIA,
Brandon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Trouble passing keyword arg to post_save signal

2009-03-07 Thread Brandon Taylor

Hi everyone,

Syntax trouble. My post_save signal is defined as:

def scrub_directory(sender, instance, **kwargs):
pass


When I attempt to pass a keyword arg to it:

models.signals.post_save.connect(scrub_directory, sender=TheModel,
{'my_kwarg' : 'some_value'})

I get a syntax error: keyword argument appeared after a non-keyword
argument. I don't understand how instance gets passed to the method,
but it's there if I print it out. No combination of placement of my
kwargs makes a difference, so I'd appreciate some help.

TIA,
Brandon
--~--~-~--~~~---~--~~
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: Programmtically accessing properties on a model field?

2009-03-07 Thread Brandon Taylor

Wonderful! Thank you so much for the help.

Brandon

On Mar 6, 3:24 pm, Rajesh D  wrote:
> > I'm working on some code to scrub an images directory of anything not
> > currently stored in the database, and would like to de-couple some
> > things. I'm using signals, passing in an instance of a model that I
> > would like to be able to grab some data from, namely, the 'upload_to'
> > parameter of the ImageField in question.
>
> > How can I access this property programmatically?
>
> > If I'm passing in the instance of the object, I should be able to
> > access the __class__ property of the object, but I can't seem to get
> > to the 'upload_to' property on the field.
>
> Try this:
>
> c = instance.__class__ # where instance is your model object's
> instance
> img_field = c._meta.get_field_by_name('image')[0]
> # In the above, substitute 'image' with your image field's name
> upload_to = img_field.upload_to
>
> Obviously, you can reduce all that to a one-liner once you understand
> what this does.
>
> -RD
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Programmtically accessing properties on a model field?

2009-03-06 Thread Brandon Taylor

Hi everyone,

I'm working on some code to scrub an images directory of anything not
currently stored in the database, and would like to de-couple some
things. I'm using signals, passing in an instance of a model that I
would like to be able to grab some data from, namely, the 'upload_to'
parameter of the ImageField in question.

How can I access this property programmatically?

If I'm passing in the instance of the object, I should be able to
access the __class__ property of the object, but I can't seem to get
to the 'upload_to' property on the field.

TIA,
Brandon

--~--~-~--~~~---~--~~
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: Trouble overriding UserAdmin

2009-03-03 Thread Brandon Taylor

Hi Alex,

Actually, the 'user_profile' app is the last one in my list. I can't
explain why it works on a previously developed site using Django trunk
and not this one.

Brandon

On Mar 3, 11:54 am, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Tue, Mar 3, 2009 at 12:41 PM, Brandon Taylor 
> <btaylordes...@gmail.com>wrote:
>
>
>
>
>
> > Hi everyone,
>
> > Not sure what's up here, the same code works on another site.
> > Basically what I'm doing is adding an inline model form to the User
> > change form...
>
> > from django.db import models
> > from django.contrib import admin
> > from django.contrib.auth.models import User
> > from django.contrib.auth.admin import UserAdmin
>
> > class UserProfile(models.Model):
> >    user = models.ForeignKey(User, unique=True, blank=True, null=True)
> >    receives_job_seeker_emails = models.BooleanField(blank=True)
>
> >    class Meta:
> >        verbose_name = 'Admin User Profile'
> >        verbose_name_plural = 'Admin User Profile'
>
> >    def __unicode__(self):
> >        return ''
>
> > class UserProfileInline(admin.TabularInline):
> >    model = UserProfile
> >    fk_name = 'user'
> >    max_num = 1
>
> > class UserProfileAdmin(UserAdmin):
> >    inlines = [UserProfileInline]
>
> > admin.site.unregister(User)
> > admin.site.register(User, UserProfileAdmin)
>
> > But, admin.site.unregister(User) is throwing an error on validation:
> > django.contrib.admin.sites.NotRegistered: The model User is not
> > registered
>
> > I have the UserProfile app module added to my installed apps, same as
> > my other project, and that one validates. Can someone see what I'm
> > doing wrong?
>
> > TIA,
> > Brandon
>
> The not registered problem is probably because you have your user profile
> application before django.contrib.auth in the installed apps list in your
> settings, simply switch these around to fix that.  The next thing you want
> to do is make sure your new user admin subclasses the old one, since the old
> one adds the password change view to the admin.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Trouble overriding UserAdmin

2009-03-03 Thread Brandon Taylor

Hi everyone,

Not sure what's up here, the same code works on another site.
Basically what I'm doing is adding an inline model form to the User
change form...

from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin

class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True, blank=True, null=True)
receives_job_seeker_emails = models.BooleanField(blank=True)

class Meta:
verbose_name = 'Admin User Profile'
verbose_name_plural = 'Admin User Profile'

def __unicode__(self):
return ''

class UserProfileInline(admin.TabularInline):
model = UserProfile
fk_name = 'user'
max_num = 1

class UserProfileAdmin(UserAdmin):
inlines = [UserProfileInline]

admin.site.unregister(User)
admin.site.register(User, UserProfileAdmin)


But, admin.site.unregister(User) is throwing an error on validation:
django.contrib.admin.sites.NotRegistered: The model User is not
registered

I have the UserProfile app module added to my installed apps, same as
my other project, and that one validates. Can someone see what I'm
doing wrong?

TIA,
Brandon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Anyone using FCKEditor?

2009-02-26 Thread Brandon Taylor

Hi everyone,

I've had pretty good success with TinyMCE/django-admin-uploads so far,
but FCKEditor is boasting Python integration. Sure would be nice to
get built-in file handling support for Images, Flash, etc without
having to integrate any other 3rd party apps.

Has anyone been able to integrate FCKEditor with admin and use their
File Browser?

Cheers,
Brandon
--~--~-~--~~~---~--~~
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: Connecting to Oracle

2009-02-26 Thread Brandon Taylor

Hi Karen,

5.0.1 just came out a few days ago. Upgrading solved the issue and now
I can get connected to Oracle. Woohoo.

b

On Feb 20, 11:44 am, Karen Tracey <kmtra...@gmail.com> wrote:
> On Fri, Feb 20, 2009 at 10:52 AM, Brandon Taylor 
> <btaylordes...@gmail.com>wrote:
>
>
>
>
>
> > Hi everyone,
>
> > I'm having a hell of a time getting connected to Oracle...
>
> > We're running Intel MacBooks, OS X 10.5.6, Python 2.6.1, Django Trunk,
> > Oracle InstantClient 10_2.
>
> > We have tried using cx_Oracle-5.0 and 4.4.1. cx_Oracle seems to
> > compile and install successfully, but, when we attempt to run a
> > project using the built-in server, we're getting an error with both
> > versions:
>
> > Unhandled exception in thread started by  > 0x782030>
> > [snip]
> >  Referenced from: /Users/bft228/.python-eggs/cx_Oracle-4.4.1-py2.6-
> > macosx-10.3-i386.egg-tmp/cx_Oracle.so
> >  Reason: image not found
>
> > Can anyone out there help me get this working? I have very limited
> > experience with Oracle, so please bear with me.
>
> Have you read this page or the ones it references:
>
> http://codingnaked.wordpress.com/2008/05/07/build-and-install-cx_orac...
>
> ?
>
> Someone in the comments there had the same error message and seemed to
> figure out how to fix it.
>
> Also, do not use cx_oracle 5.0.  It has a bug that will cause problems, see:
>
> http://code.djangoproject.com/ticket/9935#comment:4
>
> 5.0.1 will apparently be OK, but 5.0 is definitely not good.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Environment variable not set

2009-02-24 Thread Brandon Taylor

Hi Matt,

Yes, I have that env var added to my .bash_profile as well, and it's
set to $ORACLE_HOME. If I run Python in a shell, import os and
os.environ, I can see the variables and their values appear to be
correct...just not running from the built-in Django server.

b

On Feb 24, 1:55 pm, Matt Boersma <m...@sprout.org> wrote:
> On Tue, Feb 24, 2009 at 12:44 PM, Brandon Taylor
>
> <btaylordes...@gmail.com> wrote:
> > When connecting to Oracle with Django through a shell, everything
> > works as expected. However, when I use Aptana/PyDev to debug...
>
> It sounds likely that debugging environment differs from what
> "manage.py shell" gets.
>
> The other environment variable to be aware of for cx_Oracle is
> LD_LIBRARY_PATH.  That should include the directory with the oracle
> client libs (for Instant Client, I think it's the same as
> ORACLE_HOME).  Is that set the same in your general environment and
> the debugging environment?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Environment variable not set

2009-02-24 Thread Brandon Taylor

Hi everyone,

Still battling with Oracle, but found something interesting...

When connecting to Oracle with Django through a shell, everything
works as expected. However, when I use Aptana/PyDev to debug and I set
a breakpoint on my view action, I get an error:

InterfaceError: Unable to acquire Oracle environment handle

If I: echo $ORACLE_HOME
I get: /Users/bft228/Library/Oracle/instantclient_10_2

I've tried adding this variable to the os.environ in manage.py, but it
appears that it is never set, or doesn't live long enough to affect
this view action. I have this variable in my .bash_profile and .bashrc
files in OS X (10.5.6)

What am I doing wrong to make that variable not available to Python?

Here is that portion of my .bash_profile:

ORACLE_HOME="$HOME/Library/Oracle/instantclient_10_2"
export ORACLE_HOME

TIA,
Brandon
--~--~-~--~~~---~--~~
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: Table or view does not exist - Oracle

2009-02-24 Thread Brandon Taylor

Hi Karen,

Yes, that is exactly what I'm seeing.

On Feb 23, 6:02 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Mon, Feb 23, 2009 at 10:15 AM, Brandon Taylor 
> <btaylordes...@gmail.com>wrote:
>
>
>
>
>
> > Hi everyone,
>
> > Still fighting with Oracle :(
>
> > Quick recap...my setup is:
>
> > OS X 10.5.6 (Intel), cx_Oracle-5.0.1 (Intel), instantclient_10_2,
> > Django Trunk, Python 2.6.1
>
> > If I run Django in shell, I am able to connect to Oracle, retrieve
> > objects via the ORM, etc. However, when I executing a view action
> > while running Django using the built-in server, I get the error:
>
> > DatabaseError: ORA-00942: table or view does not exist
>
> > My Oracle person has confirmed that the username I'm using has
> > permissions to view/create/drop/update.
>
> > Why would it work from the shell, using all of the same connection
> > information from settings.py and fail from the built-in server? I
> > don't know what else to try.
>
> Just to be clear -- you're seeing a difference in the ability to run (the
> exact same) queries against Oracle when you use:
>
> python manage.py shell
>
> versus
>
> python manage.py runserver
>
> ?
>
> And you start both of those from the exact same command shell environment?
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelChoiceField and initial value

2009-02-23 Thread Brandon Taylor

Solved: ModelChoiceField(empty_label=None)

On Feb 23, 9:14 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi everyone,
>
> What's the trick to getting a ModelChoiceField to use the first object
> in a QuerySet as the initial value to get rid of -?
>
> If I do:
> qs = Model.objects.all()
> my_field = forms.ModelChoiceField(queryset=qs, initial=qs[0])
>
> I still get -- as the first choice.
>
> TIA,
> Brandon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ModelChoiceField and initial value

2009-02-23 Thread Brandon Taylor

Hi everyone,

What's the trick to getting a ModelChoiceField to use the first object
in a QuerySet as the initial value to get rid of -?

If I do:
qs = Model.objects.all()
my_field = forms.ModelChoiceField(queryset=qs, initial=qs[0])

I still get -- as the first choice.


TIA,
Brandon
--~--~-~--~~~---~--~~
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: Oracle connection issue

2009-02-23 Thread Brandon Taylor

Hi Brett,

I have that environment variable set as well, but no dice. The weird
thing is I can connect to Oracle and retrieve objects when running
Django in shell, but not through the built in server when executing a
view action.

Thanks,
Brandon

On Feb 23, 11:00 am, Brett Parker <idu...@sommitrealweird.co.uk>
wrote:
> On 20 Feb 14:43, Brandon Taylor wrote:
>
>
>
> > No proxy server configured in FireFox 3. I'm stumped as well. Guess I
> > need to have the Oracle people in my office get in touch with their
> > support people. There is one other Django person here at the
> > University that might be able to help.
>
> > I'll post my findings here if we're able to come up with a solution.
>
> > Many thanks to everyone for their help!
>
> My guess would be that you're missing the oracle shared object files
> from the LD_LIBRARY_PATH, so:
>     echo $LD_LIBRARY_PATH
> if it's empty, do:
>     export LD_LIBRARY_PATH=/path/to/the/oracle/libraries
>
> And then try starting the server.
>
> Cheers,
> --
> Brett Parker
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Table or view does not exist - Oracle

2009-02-23 Thread Brandon Taylor

Hi everyone,

Still fighting with Oracle :(

Quick recap...my setup is:

OS X 10.5.6 (Intel), cx_Oracle-5.0.1 (Intel), instantclient_10_2,
Django Trunk, Python 2.6.1


If I run Django in shell, I am able to connect to Oracle, retrieve
objects via the ORM, etc. However, when I executing a view action
while running Django using the built-in server, I get the error:

DatabaseError: ORA-00942: table or view does not exist

My Oracle person has confirmed that the username I'm using has
permissions to view/create/drop/update.

Why would it work from the shell, using all of the same connection
information from settings.py and fail from the built-in server? I
don't know what else to try.

Kind regards,
Brandon
--~--~-~--~~~---~--~~
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: Oracle connection issue

2009-02-20 Thread Brandon Taylor

No proxy server configured in FireFox 3. I'm stumped as well. Guess I
need to have the Oracle people in my office get in touch with their
support people. There is one other Django person here at the
University that might be able to help.

I'll post my findings here if we're able to come up with a solution.

Many thanks to everyone for their help!
b

On Feb 20, 4:37 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote:
> On Feb 20, 3:26 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > Yes, I'm just using the built-in server for local development. I've
> > restarted it dozens of times, cleared my browser cache, etc.
>
> > Is the built-in server not compatible with Oracle? If not, I'll just
> > get an Apache/mod_wsgi instance running on my MacBook and use that
> > instead. Would be nice if I could just use the built-in server though.
>
> The development server should be fine.  You might check whether your
> browser is configured to use a proxy server, though.  If it is, then I
> suspect there may be some caching going on at the proxy server.
>
> If that's not the problem, then I'm stumped.
>
> Hope that helps,
> Ian
--~--~-~--~~~---~--~~
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: Oracle connection issue

2009-02-20 Thread Brandon Taylor

Yes, I'm just using the built-in server for local development. I've
restarted it dozens of times, cleared my browser cache, etc.

Is the built-in server not compatible with Oracle? If not, I'll just
get an Apache/mod_wsgi instance running on my MacBook and use that
instead. Would be nice if I could just use the built-in server though.

On Feb 20, 4:20 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote:
> On Feb 20, 3:01 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > Actually I was referring to my action in views.py to get the Category
> > objects:
>
> > from activity_codes.models import * (this is the auto-generated
> > models.py)
>
> > def home(request):
> >     categories = Categories.objects.all()
> >     return render_to_response('test.html', {'categories' :
> > categories})
>
> Have you restarted the web server since fixing the models?  Is there
> any caching going on in between your browser and the server?  Those
> are the only reasons I can think of why it would work in a manage.py
> shell, but not in a view.  Also, this may seem obvious, but are you
> using the same settings and models modules in both places?
>
> Ian
--~--~-~--~~~---~--~~
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: Oracle connection issue

2009-02-20 Thread Brandon Taylor

I think I may have found the culprit (?), but I have no idea how to
fix this. In my project folder, there is a file called sqlnet.log.
Here's the last entry:

Fatal NI connect error 12505, connecting to:
 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)
(HOST=devportal2.dcs.its.utexas.edu)(PORT=1521))(CONNECT_DATA=
(SID=viprt.dcs.its.utexas.edu)(CID=(PROGRAM=Python)(HOST=btaylor-
MacBook.local)(USER=root

  VERSION INFORMATION:
TNS for MacOS X Server: Version 10.2.0.4.0 - Production
TCP/IP NT Protocol Adapter for MacOS X Server: Version 10.2.0.4.0 -
Production
  Time: 20-FEB-2009 14:00:59
  Tracing not turned on.
  Tns error struct:
ns main err code: 12564
TNS-12564: Message 12564 not found; No message file for
product=network, facility=TNS
ns secondary err code: 0
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0


Check out the last value in the connection: USER=root
When I start up my dev server, I usually override port 80 on my Mac,
so I can just run at : localhost/

Shouldn't the USER parameter be the DATABASE_USER from settings.py? or
am I smoking crack?

b


On Feb 20, 4:01 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Actually I was referring to my action in views.py to get the Category
> objects:
>
> from activity_codes.models import * (this is the auto-generated
> models.py)
>
> def home(request):
>     categories = Categories.objects.all()
>     return render_to_response('test.html', {'categories' :
> categories})
>
> On Feb 20, 3:34 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote:
>
> > On Feb 20, 2:25 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > > however attempting to retrieve the Category objects from a view
> > > results in:
> > > DatabaseError: ORA-00942: table or view does not exist
>
> > > Thoughts?
>
> > You can definitely use views with Django (although inspectdb will
> > blissfully ignore them).  We do that all the time.  Again, I'd need to
> > see the models.py to understand what's going on.  Or it could be that
> > the Django user has permissions on the table, but not on the view.
>
> > Ian
--~--~-~--~~~---~--~~
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: Oracle connection issue

2009-02-20 Thread Brandon Taylor

Actually I was referring to my action in views.py to get the Category
objects:

from activity_codes.models import * (this is the auto-generated
models.py)

def home(request):
categories = Categories.objects.all()
return render_to_response('test.html', {'categories' :
categories})



On Feb 20, 3:34 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote:
> On Feb 20, 2:25 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > however attempting to retrieve the Category objects from a view
> > results in:
> > DatabaseError: ORA-00942: table or view does not exist
>
> > Thoughts?
>
> You can definitely use views with Django (although inspectdb will
> blissfully ignore them).  We do that all the time.  Again, I'd need to
> see the models.py to understand what's going on.  Or it could be that
> the Django user has permissions on the table, but not on the view.
>
> Ian
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



  1   2   3   >