Re: Oracle connection issue

2009-02-20 Thread Brandon Taylor
> but they were insufficient, and thus we're pinning our hopes on the > "general schema support" enhancement coming someday. > > Shorter me: "What Ian said." > > On Fri, Feb 20, 2009 at 2:15 PM, Brandon Taylor <btaylordes...@gmail.com> > wrote: >

Re: Oracle connection issue

2009-02-20 Thread Brandon Taylor
SUB" WHERE ROWNUM <= 21) WHERE "_RN" > 0'}, {'time': '0.004', 'sql': u'SELECT "CATEGORIES"."ID", "CATEGORIES"."NAME", "CATEGORIES"."CREATED_AT", "CATEGORIES"."UPDATED_AT" FROM "CATEGORIES"'}]

Re: Oracle connection issue

2009-02-20 Thread Brandon Taylor
Ok, now I am absolutely confounded... I ran: manage.py inspectdb > models.py Then I tried to get objects from the models THAT IT CREATED FOR ME - same friggin' error! What in the world is up with this thing? I'm at a loss. b On Feb 20, 3:08 pm, Brandon Taylor <btaylordes...@gmail.com&

Re: Oracle connection issue

2009-02-20 Thread Brandon Taylor
' ; categories}) I get: DatabaseError: ORA-00942: table or view does not exist ? ? ? On Feb 20, 2:53 pm, Brandon Taylor <btaylordes...@gmail.com> wrote: > Hi Matt, > > Thanks for the reply. Well, I can get connected via sqlplus and I can: > desc activities... not sure what's up fr

Re: Oracle connection issue

2009-02-20 Thread Brandon Taylor
als.  If the tables live in a > different schema, you may need to create private synonyms to them in > the Django user's schema--we nearly always end up with that structure > in our Django/Oracle apps. > > Hope this helps, > > Matt > > On Fri, Feb 20, 2009 at 12:50 PM, Br

Re: Oracle connection issue

2009-02-20 Thread Brandon Taylor
setting. If I set my DATABASE_NAME to my SID, and try to retrieve objects, I get: DatabaseError: ORA-00942: table or view does not exist ? ? ? b On Feb 20, 1:21 pm, Brandon Taylor <btaylordes...@gmail.com> wrote: > Hi Matt, > > Ok, I modified manage.py to add two environ variables

Re: Oracle connection issue

2009-02-20 Thread Brandon Taylor
t; and > looking at what's in os.environ--if you don't see ORACLE_HOME set to > the correct location there, try fixing that first. > > Matt > > On Fri, Feb 20, 2009 at 9:41 AM, Brandon Taylor <btaylordes...@gmail.com> > wrote: > > > Hi everyone, > > &

Oracle connection issue

2009-02-20 Thread Brandon Taylor
Hi everyone, I'm using Oracle instantclient_10_2 (Intel), cx_Oracle-5.0.1, OS X 10.5.6 (Intel), Python 2.6.1 and Django trunk. My built-in server will start up correct, but, when I attempt to get objects for a model, I receive the following error: InterfaceError: Unable to acquire Oracle

Re: Add value to request header?

2009-02-20 Thread Brandon Taylor
:16 -0800, Brandon Taylor wrote: > > Hi everyone, > > > I know how to modify a responseheadervalue, but not arequestheader > > value. I need to integrate with an external system that is injecting a > > value in therequestheaderthat I need to check for. > > > Is it

Connecting to Oracle

2009-02-20 Thread Brandon Taylor
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

Add value to request header?

2009-02-18 Thread Brandon Taylor
Hi everyone, I know how to modify a response header value, but not a request header value. I need to integrate with an external system that is injecting a value in the request header that I need to check for. Is it possible to mock this behavior in Django? I'm not very familiar with how these

Re: WYSIWYG Image upload challenge

2009-02-18 Thread Brandon Taylor
FWIW, I have been able to successfully integrate Django Admin Uploads http://code.google.com/p/django-admin-uploads/ with jQuery. I'm not certain as to how difficult this would be to port to YUI. There are a couple of JS issues that I've had to fix with this, but otherwise, it works very well.

Difficulty with filtering a queryset using the "in" method

2009-02-02 Thread Brandon Taylor
Hi everyone, I need to return a queryset using the "in" statement. My IDs are in an array of int values. vehicle_ids = [1, 2, 3] If I do: vehicles = VehiclePhoto.objects.filter(vehicle__id__in= [vehicle_ids]) I get a type error: sequence item 0, expected string, int found. I've tried just

Re: order by count

2009-01-29 Thread Brandon Taylor
Hello, You can use the sorted() function in Python to order any iterable. It asks for a key to order by, which can be a lambda, or you could use the operator module to get attributes of the object(s) in your QuerySet object to provide the key. My $0.02, Brandon On Jan 29, 12:38 pm, lollerikken

Re: Need help changing the ordering of a queryset stored in session

2009-01-22 Thread Brandon Taylor
vehicles.reverse() to toggle ascending or descending. Thanks for getting me on the right track, I appreciate it! Brandon On Jan 22, 2:19 am, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Wed, 2009-01-21 at 21:40 -0800, Brandon Taylor wrote: > > Hi everyone, > > >

Need help changing the ordering of a queryset stored in session

2009-01-21 Thread Brandon Taylor
Hi everyone, I need to do some table sorting and paging. To reduce trips to the DB, I'm storing my initial queryset in a session using the file system backend for local development. I was thinking I might be able to use the dictsort filter and just pass in the column as a variable to do the

Re: Login form on every page and session weirdness

2009-01-13 Thread Brandon Taylor
into pickling errors. On Jan 13, 11:43 am, Brandon Taylor <btaylordes...@gmail.com> wrote: > Hi everyone, > > I have a login form on every page and want to leverage the > AuthenticationForm from contrib.auth. So, I thought I would have a > middleware tier to process the request and ch

Login form on every page and session weirdness

2009-01-13 Thread Brandon Taylor
Hi everyone, I have a login form on every page and want to leverage the AuthenticationForm from contrib.auth. So, I thought I would have a middleware tier to process the request and check for a GET or POST and create the appropriate form, either bound or un-bound. Here is my middleware: from

Re: Need help writing file to specific directory

2008-12-20 Thread Brandon Taylor
solved: os.chdir(path) Hope that helps someone! On Dec 20, 10:13 pm, Brandon Taylor <btaylordes...@gmail.com> wrote: > Hi everyone, > > I'm unpacking files in a .zip and need to save each file into a > particular directory, but I can't seem to find a way to set the &

Need help writing file to specific directory

2008-12-20 Thread Brandon Taylor
Hi everyone, I'm unpacking files in a .zip and need to save each file into a particular directory, but I can't seem to find a way to set the directory to save into. Here is part of my code where I'm opening the .zip and iterating over the files: thumb_zip_file =

Re: image uploading, validation by using form

2008-12-20 Thread Brandon Taylor
Hi, You can do validation on images by using a custom form for your admin Model. This example validates that a thumbnail image is a specific dimension, file type and file size, from django.core.files.images import get_image_dimensions class MyModelAdminForm(forms.ModelForm): model =

Re: Help with batch processing

2008-12-19 Thread Brandon Taylor
I've been looking at the methods from those libs. Glad to know I'm on the right track. Thanks, b On Dec 19, 7:27 pm, Masklinn <maskl...@masklinn.net> wrote: > On 19 déc. 08, at 23:50, Brandon Taylor <btaylordes...@gmail.com>   > wrote: > > > Hi everyone, >

Help with batch processing

2008-12-19 Thread Brandon Taylor
Hi everyone, My client needs some batch processing capabilities that I haven't coded in Python/Django yet, and I need advice on the best way to read images contained in a .zip file. I'm pretty comfortable extending Django admin, just not working with files this way. I will need to: 1. Read and

Re: UserChangeForm not working

2008-12-05 Thread Brandon Taylor
Hi Karen, I did finally get this figured out, but decided not to implement the functionality after all :) Thanks, Brandon On Dec 5, 7:47 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Fri, Dec 5, 2008 at 3:18 AM, Brandon Taylor <[EMAIL PROTECTED]>wrote: > >

UserChangeForm not working

2008-12-05 Thread Brandon Taylor
Hi everyone, I want to allow users to change their username in a non-admin form. I have a login form already working, and I can successfully show user information. I have granted the change user permission to the user that is logged in. When I pull in the UserChangeForm from contrib.auth.forms

Re: Populating form from instance not working

2008-12-05 Thread Brandon Taylor
Hi David, Stupid error on my part. Problem has been resolved. On Dec 5, 1:34 am, "David Zhou" <[EMAIL PROTECTED]> wrote: > On Fri, Dec 5, 2008 at 1:44 AM, Brandon Taylor <[EMAIL PROTECTED]> wrote: > > > But, the form fields aren't being populated. What am I

Populating form from instance not working

2008-12-04 Thread Brandon Taylor
Hi everyone, I'm using 1.0.2 final. I have a form for a model and am passing in an instance of my model object to the form, but the form is not being populated. #views.py example def my_view(request, id): if request.method == 'POST': pass else: model_instance =

Re: Exclude fields in form by language

2008-11-14 Thread Brandon Taylor
for your help, I really appreciate it. b On Nov 14, 7:34 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2008-11-14 at 10:44 -0800, Brandon Taylor wrote: > > Hi Malcom, > > > So, I manged to pass in the language_code parameter successfully: > > > class

Re: Exclude fields in form by language

2008-11-14 Thread Brandon Taylor
) The problem I have now is accessing that parameter in the Meta subclass: class Meta: self.language_code#returns: self is not defined. Do you know how I can access that self.language_code parameter in the Meta subclass? TIA, Brandon On Nov 13, 11:11 pm, Brandon Taylor <[EMAIL PROTEC

Re: Exclude fields in form by language

2008-11-13 Thread Brandon Taylor
Thanks Malcom, I'll give that a shot. Cheers, Brandon On Nov 13, 10:47 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2008-11-13 at 20:36 -0800, Brandon Taylor wrote: > > Hi Malcom, > > > This is what I have so far, but is not working... &

Re: Exclude fields in form by language

2008-11-13 Thread Brandon Taylor
t; On Thu, 2008-11-13 at 18:06 -0800, Brandon Taylor wrote: > > Hi everyone, > > > I'm doing an internationalization project and have a form with fields > > that need to be localized. I would like to have one form, pass in the > > language code and exclude the appropriat

Exclude fields in form by language

2008-11-13 Thread Brandon Taylor
Hi everyone, I'm doing an internationalization project and have a form with fields that need to be localized. I would like to have one form, pass in the language code and exclude the appropriate fields. How would I go about passing in the variable to the form? I know I have to pick it up in the

Re: Problem with named URL and parameters

2008-11-13 Thread Brandon Taylor
Hi everyone, Gerard's suggestion worked. Moving the pattern into a separate definition fixed it. But, I couldn't explain why :) Many thanks! Brandon On Nov 13, 6:48 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2008-11-14 at 01:20 +0300, Alex Koshelev wrote: > > Hmm... Why in

Re: Problem with named URL and parameters

2008-11-13 Thread Brandon Taylor
13, 2008 at 02:56:26PM +1100, Malcolm Tredinnick wrote: > > On Wed, 2008-11-12 at 22:39 -0500, Karen Tracey wrote: > > > On Wed, Nov 12, 2008 at 10:27 PM, Brandon Taylor > > > <[EMAIL PROTECTED]> wrote: > > > > Hi everyone, > > > > So I have

Re: Problem with named URL and parameters

2008-11-12 Thread Brandon Taylor
EMAIL PROTECTED]> wrote: > On Wed, 2008-11-12 at 22:39 -0500, Karen Tracey wrote: > > On Wed, Nov 12, 2008 at 10:27 PM, Brandon Taylor > > <[EMAIL PROTECTED]> wrote: > > >         Hi everyone, > > >         So I have a question/problem with a named U

Problem with named URL and parameters

2008-11-12 Thread Brandon Taylor
Hi everyone, So I have a question/problem with a named URL pattern... #urls.py url(r'^resources/conversions/(?P[-\w]+)/$', 'my_site.views.conversions', name='conversions'), This is a mostly static site, but I would like to be able to pass the "conversion_template" parameter to do a dynamic

Re: Interesting result when displaying errors for contrib.auth.forms AuthenticationForm

2008-11-09 Thread Brandon Taylor
errors` just holds all form errors as a dict. > > On Mon, Nov 10, 2008 at 00:52, Brandon Taylor <[EMAIL PROTECTED]>wrote: > > > > > Here you go: > > > > method="post">

Re: Interesting result when displaying errors for contrib.auth.forms AuthenticationForm

2008-11-09 Thread Brandon Taylor
%} On Nov 9, 12:01 pm, "Alex Koshelev" <[EMAIL PROTECTED]> wrote: > Please show complete template code > > On Sun, Nov 9, 2008 at 20:55, Brandon

Interesting result when displaying errors for contrib.auth.forms AuthenticationForm

2008-11-09 Thread Brandon Taylor
Hi everyone, I'm leveraging auth and have a login form that uses contrib.auth.forms AuthenticationForm. When displaying non-field-specific errors, I get interesting results: #template.html # if form.errors __all__ Please enter a correct username and password. Note that both fields are

Having trouble with django-multilingual

2008-11-06 Thread Brandon Taylor
Hi Everyone, I'm having a hard time getting django-multilingual to work the way I expect. #settings.py LANGUAGES = ( ('en', 'English'), ('es', 'Spanish'), ) TEMPLATE_CONTEXT_PROCESSORS = ( ... 'multilingual.context_processors.multilingual', ) MIDDLEWARE_CLASSES = ( ..

i18n strategy

2008-11-06 Thread Brandon Taylor
Hi everyone, I'm tasked with translating a mostly database-driven site into Spanish. I'm familiar with how to use Django's internationalization on static strings in templates, but not with text coming from a database, so I'm looking for some best practices advice... Should I: 1. Make a

Re: Where can I download xgettext?

2008-11-05 Thread Brandon Taylor
I was not able to successfully compile the latest version of the GNU gettext tools (0.17) on OS X 10.5, but I was able to grab version 0.14.5-3 using Fink and now I can successfully run django-admin.py makemessages. Hope this helps someone! On Nov 5, 11:43 pm, Brandon Taylor <[EMAIL PROTEC

Where can I download xgettext?

2008-11-05 Thread Brandon Taylor
Hi everyone, I'm needing to do some internationalization, but can't run makemessages because I don't have xgettext. I'm running Mac OS X 10.5, and can't seem to find an installer anywhere for this. I have found gettext, but not xgettext. Any help appreciated! Brandon

Problem with contrib.comments and signals: instance is not defined

2008-10-23 Thread Brandon Taylor
Hi everyone, I'm using Django 1.0, and attempting to do some comment moderation with Akismet. When I try to wire up a pre_save signal, I'm getting an error saying 'instance' is not defined. Here is my code: def moderate_comment(sender, **kwargs): if not instance.id: # <-- instance is not

Re: django.contrib.comments and returning to the original object

2008-10-23 Thread Brandon Taylor
Found the solution. I can pass in: request.GET, which contains a QueryDict object containing the 'c' variable for the comment. Hope this helps someone! Brandon On Oct 23, 8:50 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm using 1.0 and have added contrib

django.contrib.comments and returning to the original object

2008-10-23 Thread Brandon Taylor
Hi everyone, I'm using 1.0 and have added contrib.comments to my project which has a blog. I can preview a comment just fine, but I would like to provide a way for the user to get back to the original blog entry once they've posted their comment. Out of the box, comments get redirected after

Re: Error in django.contrib.comments with {% comment_form_target %}

2008-10-22 Thread Brandon Taylor
Hi Dmitry, After some digging, I found that folder as well. Now everything's working correctly again. Cпасибо, Brandon On Oct 22, 7:08 am, Dmitry Dzhus <[EMAIL PROTECTED]> wrote: > Brandon Taylor wrote: > > I see there is an closed ticket:http://code.djangoproject.com/ticket/8

Re: Reverse error in contrib.comments

2008-10-22 Thread Brandon Taylor
vn because of .pyc files. After deleting the folder, comments are working correctly again. Hope this helps someone out! Kind regards, Brandon On Oct 22, 6:10 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Wed, Oct 22, 2008 at 12:30 PM, Brandon Taylor > > <[EM

Reverse error in contrib.comments

2008-10-21 Thread Brandon Taylor
Hi everyone, I'm using Django 1.0 and I'm attempting to add comments to a blog, following along in the "Practical Django Projects" book. The error is: Reverse for '' with arguments '()' and keyword arguments '{}' not found. when {% comment_form_target %} is present in the template.

Error in django.contrib.comments with {% comment_form_target %}

2008-10-21 Thread Brandon Taylor
Hi everyone, I'm using Django 1.0 and I'm attempting to add comments to a blog, following along in the "Practical Django Projects" book. The error is: Reverse for '' with arguments '()' and keyword arguments '{}' not found. when {% comment_form_target %} is present in the template.

Re: ManyToManyField with extra content and Django admin

2008-10-16 Thread Brandon Taylor
TED]> wrote: > On Wed, 2008-10-15 at 21:21 -0700, Brandon Taylor wrote: > > Hi everyone, > > Hi Brandon > > > I'm using 1.0 final. I have the following models: > > > Page > > SidebarModule > > PageSidebarModule (the intermediary table) > > ... &g

Re: ManyToManyField with extra content and Django admin

2008-10-15 Thread Brandon Taylor
is the best web framework I've used in 12 years of development. Kind regards, Brandon On Oct 15, 11:25 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Wed, Oct 15, 2008 at 11:21 PM, Brandon Taylor > > <[EMAIL PROTECTED]> wrote: > > The admin no longer shows S

ManyToManyField with extra content and Django admin

2008-10-15 Thread Brandon Taylor
Hi everyone, I'm using 1.0 final. I have the following models: Page SidebarModule PageSidebarModule (the intermediary table) When I have SidebarModule defined as a simple ManyToMany in Page, the admin is quite happy to display the list of choices. When I define: class Page(models.Model):

Re: Practical Django Projects source code

2008-10-08 Thread Brandon Taylor
Hi, Unfortunately the source code isn't available from the Apress site yet, and there's no mention of when it might be available either. I've been through all of the samples in that book, and they work, with a few tweeks for 1.0. You can download Coltrane from DjangoPlugables.com, but there are

Re: Problem generating permalink for date-based view

2008-10-08 Thread Brandon Taylor
Using the following template tag resolved the issue: {% url archive_month obj.year obj|date:"b" %} On Oct 7, 9:04 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm using the generic date-based views. > > Here's a snippet of my "Ent

Problem generating permalink for date-based view

2008-10-07 Thread Brandon Taylor
Hi everyone, I'm using the generic date-based views. Here's a snippet of my "Entry" model for a blog: #models.py pub_date = models.DateTimeField(auto_now_add=True) @models.permalink def get_month_entries(self): return ('archive_month', (), { 'year' :

Re: generic.date_based.archive_year throws "invalid literal for int() with base 10: ''

2008-10-07 Thread Brandon Taylor
Oh for $hit's sake - how can I be so blind?! Thanks Malcom, Brandon On Oct 7, 7:48 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-10-07 at 16:01 -0700, Brandon Taylor wrote: > > Hi everyone, > > > Here is my code: > > > entry_info_dict = { &g

Re: generic.date_based.archive_year throws "invalid literal for int() with base 10: ''

2008-10-07 Thread Brandon Taylor
, year = u'' I'm using 1.0 Final, MySQL 5. Help! On Oct 7, 6:01 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Hi everyone, > > Here is my code: > > entry_info_dict = { >     'queryset' : Entry.live.all(), >     'date_field' : 'pub_date', >     'allow_future

generic.date_based.archive_year throws "invalid literal for int() with base 10: ''

2008-10-07 Thread Brandon Taylor
Hi everyone, Here is my code: entry_info_dict = { 'queryset' : Entry.live.all(), 'date_field' : 'pub_date', 'allow_future' : True } urlpatterns = patterns('django.views.generic.date_based', url(r'^blog/(?P)\d{4}/$', 'archive_year', entry_info_dict, name='archive_year'), ) So,

Re: Django Admin, Custom Views and the ChangeList object

2008-10-07 Thread Brandon Taylor
Thanks Karen! On Oct 7, 4:43 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Tue, Oct 7, 2008 at 2:43 PM, Brandon Taylor <[EMAIL PROTECTED]>wrote: > > > > > > > Hi everyone, > > > On a recent project, I was tasked with adding a workflo

Date-based generic views and 404 errors

2008-10-07 Thread Brandon Taylor
Hi everyone, I'm following along with the Blog example in the Practical Django Projects book. Here are my URLs: entry_info_dict = { 'queryset' : Entry.live.all(), 'date_field' : 'pub_date' } urlpatterns = patterns('django.views.generic.date_based', url(r'^blog/$', 'archive_index',

Re: Django Hosting Survey

2008-10-07 Thread Brandon Taylor
WebFaction definitely gets my vote. Setting up a Django app with their control panel couldn't be easier, and their customer service is excellent. Brandon Taylor bTaylor Design www.btaylordesign.com On Oct 6, 12:30 pm, Jeff <[EMAIL PROTECTED]> wrote: > I am about to begin a new Djang

Django Admin, Custom Views and the ChangeList object

2008-10-07 Thread Brandon Taylor
Hi everyone, On a recent project, I was tasked with adding a workflow around a model, which required some customization in the admin. I found that when I did and override of a view, I no longer had access to the "cl", or ChangeList object containing all of the objects for the view. Filters and

Re: A little refactoring help please

2008-10-02 Thread Brandon Taylor
Thanks guys, I appreciate it. On Oct 2, 3:29 am, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 2 oct, 07:33, Travis Parker <[EMAIL PROTECTED]> wrote: > > > Instead of calling render_to_response on an empty template file you > > could simply return an empty django.http.HttpResponse and

A little refactoring help please

2008-10-01 Thread Brandon Taylor
Hi everyone, I have a view to do some re-ordering of a list via ajax: @staff_member_required def reorder(request): collections = Collection.objects.all() if request.method == 'POST': pk_ids = request.POST['pk_ids'].split(',') length = len(pk_ids) for collection

Best way to preserve a queryset across GETs?

2008-09-28 Thread Brandon Taylor
Hi everyone, I have a search results page and need to be able to go to a detail page for any result. I would like to provide the user a way to return to their search results and not clutter the querystring with search parameters. What's the best approach for this using Django? Should I stuff

Filtering a queryset with arrays of IDs

2008-09-28 Thread Brandon Taylor
Hi everyone, I have a search form where I have multi-selects that contain foreign key values. When I post to my results page, I get a QueryDict object and can get the data out of the post into lists. My question is, what's the best way to go about filtering objects where the foreign keys are

Re: Problem with named paths

2008-09-17 Thread Brandon Taylor
ECTED]> wrote: > Brandon Taylor wrote: > > Hello everyone, > > > I'm using named paths as such: > > > url(r'^[-\w]+/(?P[-\w]+)/$', 'render_page', > > name='nested_page_link'), > > url(r'^(?P[-\w]+)/$', 'render_page', name='page_link'), > > > The only diffe

Problem with named paths

2008-09-17 Thread Brandon Taylor
Hello everyone, I'm using named paths as such: url(r'^[-\w]+/(?P[-\w]+)/$', 'render_page', name='nested_page_link'), url(r'^(?P[-\w]+)/$', 'render_page', name='page_link'), The only difference between these two urls is that some pages in this site can be nested under another page. So, I would

Re: Integrity Error (1062, "Duplicate entry '0' for key 1") ???

2008-09-14 Thread Brandon Taylor
Well, after validating, syncing, re-validating and re-syncing, I ended up just dropping the entire database and now it works fine. On Sep 14, 10:10 am, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm using 1.0 Final, MySQL 5, and I'm getting this lovely error

Integrity Error (1062, "Duplicate entry '0' for key 1") ???

2008-09-14 Thread Brandon Taylor
Hi everyone, I'm using 1.0 Final, MySQL 5, and I'm getting this lovely error for the first time. Here is my model: from django.db import models from django.contrib import admin from crider_law.sidebar_modules.models import SidebarModule class Page(models.Model): name =

Re: Pre-populating an integer field with a count of model objects

2008-08-21 Thread Brandon Taylor
Hi Daniel, Thanks for the reply. I'll just go with overriding the save. Cheers, Brandon On Aug 21, 11:29 am, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Aug 21, 4:42 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > > > Hi everyone, > > > I

Pre-populating an integer field with a count of model objects

2008-08-21 Thread Brandon Taylor
Hi everyone, I have a column, 'position', which is a PositiveIntegerField, to allow my end-user to order records with. I would like to pre-populate the field when creating a new record, with the count of the model objects + 1. The models documentation says 'default' can be a value or a

Re: Custom permission problem in newforms-admin

2008-07-23 Thread Brandon Taylor
? In the model, or in the change_form? I'm not very experienced in customizing the admin, but am very eager to learn. Kind regards, Brandon On Jul 21, 5:50 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2008-07-21 at 15:46 -0700, Brandon Taylor wrote: > > Hi everyone, &

Custom permission problem in newforms-admin

2008-07-22 Thread Brandon Taylor
Hi everyone, I'm trying to enforce a customer permission on Add/Update. In my model, I have defined the permission: permissions = ( ('can_approve_stories','Can Approve Stories'), ) in my model.ModelAdmin I have: def change_view(self, request, obj_id):

Dynamic upload_to for ImageField in newforms admin?

2008-07-16 Thread Brandon Taylor
Hi everyone, I'm following this tutorial for specifying a dynamic "upload_to" attribute: http://scottbarnham.com/blog/2007/07/31/uploading-images-to-a-dynamic-path-with-django/ But, it doesn't seem to want to work with Django admin. Does anyone have any experience tweeking this custom class to

Re: Named URL not picking up parameter value

2008-07-09 Thread Brandon Taylor
OMG. I definitely need more sleep! Many thanks, Brandon On Jul 9, 3:20 pm, "Norman Harman" <[EMAIL PROTECTED]> wrote: > Brandon Taylor wrote: > >     url(r'^(?P[w-]+)/$', 'my_site.groups.views.show_group', > > That regex matches one or more w's and hyphens.  You

Named URL not picking up parameter value

2008-07-09 Thread Brandon Taylor
Hi everyone, According to: http://www.djangoproject.com/documentation/url_dispatch/ I'm supposed to be able to use {% url url-name parameter(s) %}, to de- couple models form URLs. Here's a snippet from my template: {% for group in groups %} {{ group.name }} {% endfor %} #in urls.py

Re: Need help filtering a queryset

2008-07-01 Thread Brandon Taylor
means EVERY > > occurence associated with that event object.  You haven't done > > anything to filter out occurrences based on date in that step. > > > -Brian > > > On Jul 1, 9:51 am, Brandon Taylor <[EMAIL PROTECTED]> wrote: > > > > Hi

Re: Need help filtering a queryset

2008-07-01 Thread Brandon Taylor
rks, but is this the best way this can be handled? I'm still relatively new to Django, and I can't help but think this can be handled at the Database API level in some way that I'm overlooking. Thoughts? Advice greatly appreciated. On Jul 1, 11:51 am, Brandon Taylor <[EMAIL PROTECTED]> wrote: >

Need help filtering a queryset

2008-07-01 Thread Brandon Taylor
Hi everyone, I have Events and Occurrences of an Event. Occurrence contains a foreign_key for the Event. In my template, I need to display the Event and Occurrences as such: Event Title One June 1, 2008 [times] July 23, 2008 [times] Event Title Two August 25, 2008 [times]

Re: Need help including a queryset in every view

2008-06-27 Thread Brandon Taylor
, Brandon On Jun 27, 6:14 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Fri, Jun 27, 2008 at 4:27 PM, Brandon Taylor <[EMAIL PROTECTED]> wrote: > > What's the best way to go about this? Obviously I don't want to have > > to pass the queryset into the c

Re: sessions in template (outside of views)

2008-06-27 Thread Brandon Taylor
Hi Bobby, Typically what I do is set the value from the session into a variable that I pass into the context. #in views.py def my_action(request) account_num = request.session['AccountNum'] return render_to_response('the_template.html', {'account_num' : account_num}) #in

Need help including a queryset in every view

2008-06-27 Thread Brandon Taylor
Hello everyone, I have a navigation list powered by a model in my base site template. So, I need to create a queryset object that will be available to every view. What's the best way to go about this? Obviously I don't want to have to pass the queryset into the context of every action, in every

Re: Need help encapsulating a form

2008-06-20 Thread Brandon Taylor
or the views (and sometimes within the > models).  I have a tendency to write pretty complex views (and model > functions) for processing asynchronous stuff to limit the complexity of my > javascript, but that is primarily because I am far more comfortable with > python than JS. >

Re: Need help encapsulating a form

2008-06-20 Thread Brandon Taylor
and efficiently ignored, then returns > a render_to_response from the view. > > Move: > return HttpResponseRedirect('/articles-and-books/thanks/') > back to the views and get rid of the render_to_response. > > On 6/20/08, Brandon Taylor <[EMAIL PROTECTED]> wrote: > > > > &g

Re: Need help encapsulating a form

2008-06-20 Thread Brandon Taylor
           reference_name = form.cleaned_data['reference_name'] >            url = form.cleaned_data['url'] > >            processemail(email, reference_name): > >            request.session['first_name'] = first_name >            return HttpResponseRedirect('/articles-and-books/tha

Need help encapsulating a form

2008-06-20 Thread Brandon Taylor
Hi everyone, I have a feedback form which needs to be functional across 3 different actions within the same view... My actions are: references_list reference_detail thanks Here's my current form processing code: if request.method == 'POST': form =

Re: Help using Model Managers please

2008-05-30 Thread Brandon Taylor
if I can. Thanks again for the help! Kind regards, Brandon On May 30, 3:47 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > On May 30, 4:28 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > > > Ok, sorry, I'm a dork, I forgot how to run patches. I successfully > >

Re: Help using Model Managers please

2008-05-30 Thread Brandon Taylor
Ok, sorry, I'm a dork, I forgot how to run patches. I successfully merged the first patch into my newforms-admin install, but it still doesn't work. On May 30, 3:16 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > I manually copied and pasted the code from the patch into > fi

Re: Help using Model Managers please

2008-05-30 Thread Brandon Taylor
the patch? Please excuse my ignorance if that's a really stupid question, I have a knack for missing the obvious :) Thanks, Brandon On May 30, 3:00 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > On May 30, 3:54 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > > > I switched

Re: Help using Model Managers please

2008-05-30 Thread Brandon Taylor
I switched out the code in the path into my newforms-admin install, but it still doesn't want to work. Ugh! I'm going to try switching to trunk on a different computer to see if it will work in trunk. Any further thoughts before I move on a create a completely separate model for Staff Members

Re: Help using Model Managers please

2008-05-30 Thread Brandon Taylor
Hi, Here is "Member" MEMBER_TYPE_CHOICES = ( ('staff','Staff'), ('board','Board'), ) class Member(models.Model): member_type = models.CharField(max_length=30, choices=MEMBER_TYPE_CHOICES) first_name = models.CharField(max_length=30)

Re: Help using Model Managers please

2008-05-30 Thread Brandon Taylor
Hi Rajesh, Thanks for pointing that out in the documentation, I wasn't aware of that filter. However, I can't seem to get it to work. I've tried specifying the values as: staff_members_to_notify = models.ManyToManyField(Member, limit_choices_to = {'member_type' : 'staff'}) and several other

Help using Model Managers please

2008-05-30 Thread Brandon Taylor
Hello everyone, I have two Models: Member, Job Member has two types: Staff, Board Job needs to have a ManyToMany field for Member, so I can send emails to those associated records. So, what I'm trying to accomplish is to filter the list of Members that are shown in the ManyToMany to include

Re: Issue with newforms-admin

2008-05-23 Thread Brandon Taylor
OMG. I can't believe I missed the trailing slash when I set up the get_absolute_url for the results page. I need sleep. Thanks Karen, Brandon On May 22, 4:19 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Thu, May 22, 2008 at 3:21 PM, Brandon Taylor <[EMAIL PROTECTED]&

Issue with newforms-admin

2008-05-22 Thread Brandon Taylor
Hi everyone, I'm having a problem with an url pattern. When I try to do a custom view using the newforms admin, such as: (r'^admin/surveys/survey/answers/(?P[-\w]+)/$', 'app.surveys.views.answers_list'), If I remove: (r'^admin/(.*)', admin.site.root), #the default routing for newforms-

Re: Problem displaying value(s) from ManyToMany relationship

2008-05-18 Thread Brandon Taylor
own sanity :) Cheers, Brandon On May 18, 6:57 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Here is my code: > > #in models.py > class Instructor(models.Model): >     prefix = models.CharField(max_length=50, blank=True, null=True) >     first_name = models

Re: Trouble installing PIL

2008-05-18 Thread Brandon Taylor
Hi Austin, I followed this tutorial to install JPEG support into PIL: http://paul.annesley.cc/articles/2007/11/19/django-and-python-imaging-library-pil-on-leopard Hope this helps, Brandon On May 18, 6:22 pm, Austin Govella <[EMAIL PROTECTED]> wrote: > I used MacPorts to install jpeg (libjpeg),

Re: Problem displaying value(s) from ManyToMany relationship

2008-05-18 Thread Brandon Taylor
18, 5:56 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I have a ManyToMany field on a model, and when I want to get the > related items and display them in a template in a for loop, the loop > executes the correct number of times, but in my output blocks

<    1   2   3   >