Need details re: deletion of a referenced model instance

2012-02-14 Thread Jeff Blaine
Hi all, I'm having trouble detecting changes that happen to a M2M field behind the scenes: as a result of one of the *referenced objects being deleted* I'm using Django 1.3.1 with PostgreSQL 8 Let's say we have the following simple proof of concept models: class Topping(models.Model): name

Re: Need details re: deletion of a referenced model instance

2012-02-15 Thread Jeff Blaine
> > >> Known Facts: > >> > >> 1. Deleting any Topping object (for example, deleting id=1, > >> name="Pepperoni") also removes it from foopizza.toppings. Good. > >> 2. No m2m_changed signal is sent when 1 (above happens). BAD. > > ... > > Check this out ;) > https://docs.djangoproject.com/en/d

A little InlineModelAdmin help please?

2012-03-15 Thread Jeff Blaine
Easier for me to just draw you a picture: ++ | noodle | ++ | | | | +-+ ++ ||

Re: A little InlineModelAdmin help please?

2012-03-16 Thread Jeff Blaine
Thanks for the reply, Marc. On Thursday, March 15, 2012 4:32:48 PM UTC-4, Jeff Blaine wrote: > > Easier for me to just draw you a picture: > >++ >

Logging works from 'manage.py shell', not from app

2012-04-13 Thread Jeff Blaine
Hi all. I'm stumped on something. Using logging via 'manage.py shell' is working as expected. Using it in the webapp generates zero data and zero errors. NOTE: /var/log/hostdb.log is WORLD WRITABLE (in order to dodge any permissions errors right now while debugging this) My logging settings are a

Confused by STATICFILES_DIRS not working

2011-12-16 Thread Jeff Blaine
I'm having a heck of a time getting STATICFILES_DIRS working. If anyone could shed some light on this or just point me to the "All of your Django STATIC* Settings Clarified Completely Once and For All" blog post or somesuch, I would really appreciate it. STATIC_ROOT = '' # DEFAULT STATIC_URL =

Re: Confused by STATICFILES_DIRS not working

2011-12-16 Thread Jeff Blaine
On Friday, December 16, 2011 11:18:09 AM UTC-5, Tom Evans wrote: > > On Fri, Dec 16, 2011 at 4:17 PM, Tom Evans wrote: > > > > 1) Is staticfiles in INSTALLED_APPS ? > Yes, django.contrib.staticfiles is in INSTALLED_APPS > > 2) Is DEBUG=True? > Yes > > 3) What is the output of: > > python

pre_remove and post_remove "actions" not sent via m2m_changed signalling?

2012-01-18 Thread Jeff Blaine
Hi all, http://dpaste.org/1vhf6/ With the following models.py, and the output seen further down, can anyone explain why pre_remove and post_remove "actions" are not happening when I remove an item from a M2M relation? class Interface(models.Model): name = models.CharField('Interface',

Re: pre_remove and post_remove "actions" not sent via m2m_changed signalling?

2012-01-18 Thread Jeff Blaine
Answering my own question: https://code.djangoproject.com/ticket/16073 :( Thanks to IRC #django-users : carljm and domguard -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/

base.html (extended by others) has to be in project (not app) root?

2011-04-14 Thread Jeff Blaine
Django 1.3 Hi all, I can't seem to get around this. It appears that, the following "index.html" template in */whatever/myproject/myapp* {% extends "base.html %} Looks for base.html as /whatever/myproject/base.html instead of /whatever/myproject/myapp/base.html My TEMPLATE_DIRS is set as fo

Re: base.html (extended by others) has to be in project (not app) root?

2011-04-14 Thread Jeff Blaine
o: TEMPLATE_DIRS = ( '/myproject/myapp', ) Which then results in failure to find even /myproject/myapp/index.html TemplateDoesNotExist at / > > Best of Luck. > > -- > Gladys > http://blog.bixly.com > > > On Apr 15, 3:56 am, Jeff Blaine

Re: base.html (extended by others) has to be in project (not app) root?

2011-04-15 Thread Jeff Blaine
Thank you all. I will digest the replies when I have the time to properly focus back on the issue (it's obviously small, since I have a workaround in place by shoving base.html into the project root). It still, regardless of solutions, even in light of the words shared in this thread (which I'

Re: base.html (extended by others) has to be in project (not app) root?

2011-04-15 Thread Jeff Blaine
On Friday, April 15, 2011 4:21:56 PM UTC-4, Brian Neal wrote: > > You didn't post how you loaded the template in your view function. In > particular, what path string you used. > Ah. The missing piece to bring order to all of this confusion on my part. I was using "myapp/index.html", per

Put an "inline" at the top of admin form instead of bottom?

2011-04-15 Thread Jeff Blaine
I'm using the admin functionality for most of my needs (a nice CRUD DB frontend, not a user-facing website). Is there a best way to get one of my inline models presented at the top of the form instead of the bottom? I would greatly prefer not to have to specify all of the fields (via ModelAdm

Cannot submit tickets - always marked as spam!

2011-04-19 Thread Jeff Blaine
I've tried twice now to interact with the Django trac. Last week and just now. Both resulted in: badip:state/blacklist.d/127.0.0.1 Please tell me what I am doing wrong. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gro

Re: website path

2011-04-19 Thread Jeff Blaine
I imagine you need to configure your urls.py I suggest going through the whole tutorial, starting at the following page. This is all explained there. http://docs.djangoproject.com/en/1.3/intro/tutorial01/ -- You received this message because you are subscribed to the Google Groups "Django us

Re: Why i can reach my media files from my static url?

2011-04-19 Thread Jeff Blaine
Please show your settings: STATIC_ROOT STATICFILES_DIR STATIC_URL MEDIA_ROOT MEDIA_URL -- 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 emai

Re: website path

2011-04-19 Thread Jeff Blaine
How to avoid hardcoding URL paths in your templates: http://docs.djangoproject.com/en/1.3/ref/templates/builtins/#url Maybe that helps some? I don't think I can be of more help. I'm too new. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Admin bug w/ deleting a TabularInline'd object?

2011-04-23 Thread Jeff Blaine
I'd like to vet this through the users here before submitting a bug report. Per the tutorial, all of my models have a defined __unicode__(self) which returns a string. The code is below, but here's the scenario: 1. I add a 'Device' with associated 'Interface'. 2. I edit the 'Device', with th

.save() works with no (custom, not 'id') primary key specified?

2011-04-29 Thread Jeff Blaine
How is this possible based on the model below? d = Device() d.save() # no errors class Device(models.Model): propertyno = models.CharField('Property Number', max_length=10, primary_key=True) -- You received

Re: .save() works with no (custom, not 'id') primary key specified?

2011-04-29 Thread Jeff Blaine
"If Django sees you've explicitly set Field.primary_key, it won't add the automatic id column." http://docs.djangoproject.com/en/1.3/topics/db/models/#automatic-primary-key-fields -- You received this

Re: .save() works with no (custom, not 'id') primary key specified?

2011-04-29 Thread Jeff Blaine
A specified primary_key should not be auto-incrementing from my understanding. The following shows 2 objects with the same value for a field I specified should be the primary_key: >>> from hostdb.models import Device >>> d = Device() >>> d.propertyno '' >>> d.save() >>> d = Device() >>> d.prope

Re: .save() works with no (custom, not 'id') primary key specified?

2011-04-29 Thread Jeff Blaine
"primary_key=True implies null=False and unique=True. Only one primary key is allowed on an object." So that unique=True

Re: .save() works with no (custom, not 'id') primary key specified?

2011-04-29 Thread Jeff Blaine
Thank you both. That's a great explanation, Jacob. I'll consider your message more closely and play around on Monday a bit. PS: I said it *seems* broken to me, as in "Maybe I just don't understand the reason.", which I clearly didn't :) -- You received this message because you are subscribed

Stuck at integration step w/ WSGI

2011-05-03 Thread Jeff Blaine
I've read the following and am still stuck and wondering what piece of this puzzle I am missing. If anyone has any ideas, please do comment! http://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/ http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango Using the Django 1.3 developme

Re: Stuck at integration step w/ WSGI

2011-05-03 Thread Jeff Blaine
On Tuesday, May 3, 2011 2:03:14 PM UTC-4, Daniel Roseman wrote: > > I don't know why you think this is a WSGI error. As you say, Apache is > finding your WSGI app with no problem, and the error you get is a Django one > - you simply don't seem to have any data in your Site table, whereas the > D

Re: Stuck at integration step w/ WSGI

2011-05-03 Thread Jeff Blaine
Also, adding an example.com site (via /admin via dev server) doesn't change the behavior. Same error. I'm not sure if that's what you were suggesting to do or not. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send e

Re: Stuck at integration step w/ WSGI

2011-05-03 Thread Jeff Blaine
I'd certainly like to hear more about this, but I got it all working fine by commenting out 'django.contrib.sites' from INSTALLED_APPS That's obviously not the right solution... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this g

Re: Stuck at integration step w/ WSGI

2011-05-03 Thread Jeff Blaine
On Tuesday, May 3, 2011 4:42:25 PM UTC-4, Jacob Kaplan-Moss wrote: > > Hi Jeff -- > > To make the admin work w/r/t sites, you'll need three things: > > * An entry in the sites table. > * A setting SITE_ID set to the ID of the Site entry you'd like to use > (i.e. SITE_ID = 1). > * `django.contrib.si

Re: Stuck at integration step w/ WSGI

2011-05-03 Thread Jeff Blaine
On Tuesday, May 3, 2011 6:33:20 PM UTC-4, Jacob Kaplan-Moss wrote: > > On Tue, May 3, 2011 at 5:07 PM, Jeff Blaine wrote: > > Thanks Jacob -- does the site entry in the database have to be anything > > specific? We don't really use that. Just put any old thing in the

REMOTE_USER authentication to 'Admin'?

2011-05-17 Thread Jeff Blaine
Hi folks, I'm successfully using Apache with mod_authnz_ldap, WSGI, Django 1.3. If I hit '/admin', I get asked to authenticate (BasicAuth done through LDAP). I succeed. However, this just results in me then seeing the Django admin login screen instead of logging me in to Admin. What am I mis

Re: REMOTE_USER authentication to 'Admin'?

2011-05-17 Thread Jeff Blaine
[ *sigh* - I wish the web UI to google groups had an 80-column marker. ] [ Sorry for the formatting in the previous message. I'm used to hitting ] [ enter. ] Thanks for the reply, Jacob. That gets us somewhere, because authenticating to Apache/LDAP as jblaine did NOT make a Django user jblaine.

Re: REMOTE_USER authentication to 'Admin'?

2011-05-17 Thread Jeff Blaine
On Tuesday, May 17, 2011 3:10:03 PM UTC-4, Jacob Kaplan-Moss wrote: > > On Tue, May 17, 2011 at 2:00 PM, Jeff Blaine wrote: > > That gets us somewhere, because authenticating to Apache/LDAP as jblaine > > did NOT make a Django user jblaine. > > That's interesting

Re: REMOTE_USER authentication to 'Admin'?

2011-05-17 Thread Jeff Blaine
Also, FWIW, the REMOTE_USER is definitely getting set to 'jblaine' 1xx.xx.xx.231 - jblaine [17/May/2011:16:12:41 -0400] "GET /static/admin/img/admin/nav-bg.gif HTTP/1.1" 200 273 "http://rcf-hostdb.our.org/admin/"; "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .N

Re: REMOTE_USER authentication to 'Admin'?

2011-05-18 Thread Jeff Blaine
I'm failing so far. I copied backends.py to my project root as mybackends.py I edited it and renamed ModelBackend to MyModelBackend I changed RemoteUserBackend(ModelBackend) to MyRemoteUserBackend(MyModelBackend) I changed settings.py to: AUTHENTICATION_BACKENDS = ( 'mybackends.MyRemoteUse

Re: REMOTE_USER authentication to 'Admin'?

2011-05-19 Thread Jeff Blaine
I'm kind of at the point where I consider this a bug in some fashion, regardless of my specific problem (which persists). AUTHENTICATION_BACKENDS = ( 'mybackends.MyRemoteUserBackend', ) If I define AUTHENTICATION_BACKENDS in settings, no default fallen back on. If my hand-specified stuff do

Re: REMOTE_USER authentication to 'Admin'?

2011-05-19 Thread Jeff Blaine
Thanks Jacob and Ramiro. I finally figured it out, and unfortunately it was, of course, something stupid :( I had changed the directory name holding my WSGI app and had not changed the Apache config's path reference in *both* places (ScriptAlias and Directory). SIGH. That was causing the stati

Making command-line clients to Django data

2011-06-13 Thread Jeff Blaine
We've got our Django site complete for now. It consists entirely of just a customized default "admin" setup. We'd like to develop some command-line interfaces to the data. Is there a good/best approach to doing this? Can I (recommended?) use templates for formatting text to the terminal? Any

Re: Making command-line clients to Django data

2011-06-13 Thread Jeff Blaine
> > Why not? To want a decent CLI integrated with your app, but without using > management commands, is a pretty dumb idea. > It's not how we want the end-users to interface with it. Why is it a dumb idea? -- You received this message because you are subscribed to the Google Groups "Django

How do I access a field's verbose_name?

2011-06-20 Thread Jeff Blaine
I'd like to make use of a field's verbose_name in some code instead of duplicating that sort of info. Can someone show me how? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d

Re: How do I access a field's verbose_name?

2011-06-20 Thread Jeff Blaine
On Monday, June 20, 2011 11:56:00 AM UTC-4, Shawn Milochik wrote: > > On 06/20/2011 11:54 AM, Jeff Blaine wrote: > > I'd like to make use of a field's verbose_name in some code instead of > > duplicating that sort of info. Can someone show me how? > > > >

Re: How do I access a field's verbose_name?

2011-06-20 Thread Jeff Blaine
Thanks all. For anyone coming across this later, some enlightening noodling. All sorts of good stuff in there, as Shawn indicated! >>> from hostdb.models import Device >>> dir(Device._meta) ['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__ini

Re: How do I access a field's verbose_name?

2011-06-20 Thread Jeff Blaine
Here's what I came up with, in case someone else finds this useful. I'm quite proud, actually. from django.core.management.base import BaseCommand, CommandError from hostdb.models import Device, Interface def sanitized_value(v): if v == None: return "" return v class Command(Bas

Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-20 Thread Jeff Blaine
I can't seem to figure out what is causing this: According to the following 2 models and the 'python manage.py shell' session shown after them, I am getting 2L as a return value from a certain call when I would expect u'redhat 5.6' or similar. If anyone has any ideas, please let me know. I am

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-20 Thread Jeff Blaine
PS: Django 1.3 -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Moc8-Pa5qJ4J. To post to this group, send email to django-users@googlegroups.com. To unsubscr

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Jeff Blaine
Yes, seems that way, Malcom, but *why* class Device(models.Model): # ... status = models.ForeignKey(Status, blank=True, null=True, verbose_name="Status",

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Jeff Blaine
Okay, here's the problem. >>> f = dev._meta.get_field('distro') >>> f.value_from_object(dev) 2L value_from_object is defined as: def value_from_object(self, obj): "Returns the value of this field in the given model instance."

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Jeff Blaine
On Tuesday, June 21, 2011 11:00:37 AM UTC-4, Tom Evans wrote: > > On Tue, Jun 21, 2011 at 3:47 PM, Jeff Blaine wrote: > > Any ideas? I really want (concept) > > "myfield.unicode_representation_of_object(myobject)" > > > > unicode(myobject.myfield) // unic

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Jeff Blaine
> > But why do you need to get that value via the *field* object? The usual way > to do it is simply to access the attribute directly on the model instance: > > unicode(dev.distro) > > or, if you have the field name as a string as you imply originally, use > `getattr`: > > unicode(getatt

Re: Making command-line clients to Django data

2011-06-24 Thread Jeff Blaine
Just a follow-up: Well, I took your advice and did it via manage command(s) with wrapper scripts for the users. It's working well so far. I do wish I had a clearer understanding of what the downside to the "standalone" method is, but I suspect I will never know unless I go out of my way and t

Re: REMOTE_USER authentication to 'Admin'?

2011-06-27 Thread Jeff Blaine
Sorry, I have no knowledge of Oracle SSO, what it allows, how it works, etc. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/kFeKEvDSqZYJ. To post to this g

Re: REMOTE_USER authentication to 'Admin'?

2011-06-28 Thread Jeff Blaine
It's all right here: https://docs.djangoproject.com/en/1.3/howto/auth-remote-user/ and other details in the mailing list thread you are reading/posting to (this one!) -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on

ManyRelatedManager.add() acting funny?

2011-08-13 Thread Jeff Blaine
What happened here? Do I not understand .add()? I would have expected to see [(u'rcf_clients',)] not [(u'rcf_clients', u'')] >>> print d.tags.values_list() [] >>> d.tags.add('rcf_clients') >>> d.save() >>> print d.tags.values_list() [(u'rcf_clients', u'')] >>> -- You received this message bec

Re: ManyRelatedManager.add() acting funny?

2011-08-13 Thread Jeff Blaine
Nevermind. I get it. 'tags' has another field, description, which is what the extra u'' is for. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/jnvlX18nW