Security in AJAX POSTing

2008-12-18 Thread Taylor
for the django-developers group), it would be really nice to have a document that outlines all of the precautions you should take for security. Thanks so much! Taylor --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Security in AJAX POSTing

2008-12-18 Thread Taylor
oint me in the right direction? Or do I need to figure this out myself. Thanks folks! Taylor On Dec 18, 9:08 pm, anb wrote: > > Each of my views use the @login_required decorator, is there anything > > else I need to do to ensure that the user is logged in and active > &

Re: Security in AJAX POSTing

2008-12-19 Thread Taylor
Oh awesome! I didn't know that, and yes it helps a lot! I suppose I could compliment this with the request.is_ajax() and I'm all set. Thanks again! Taylor On Dec 19, 5:47 am, Srdjan Popovic wrote: > Taylor, > > If you are worried about POST data submitted through Ajax re

Re: Boosting your productivity when debugging Django apps

2008-08-23 Thread Taylor
I find the unit test and python shell to work very well for debugging. If you have never used unit testing... learn it and love it, and love how well it is built into django. I will usually write a unit test right after I have finished programming something, and then work with the test, using the

using request.POST as keyword args

2008-10-09 Thread Taylor
I want to be able to do this: result = ab.perform(**request.POST) where: def perform(self, **kwargs): Of course, this doesn't work, and I get the error "keywords must be strings". After some searching, I suppose this is because the POST dict uses unicode, but Python expects strings or somethin

Re: using request.POST as keyword args

2008-10-09 Thread Taylor
Dave, that is the problem. I need to be able to call perform elsewhere in the code (not necessarily from a view), and it would be difficult to build the datadict to do that. I like your solution, though. For now I'm using this loop: data = {} for key in request.POST.keys(): data[str(key

XML Serialization Speed

2009-01-25 Thread Taylor
I'm thinking of changing my views so that they work with XSLT and an XML representation of my data. I see 3 options: 1. Use django's xml serializer. 2. Use python's xml tools to make my own XML. 3. Use django's template systems to drop my data into xml. Like so: {{ monster.hp }} ... My questi

Re: XML Serialization Speed

2009-01-26 Thread Taylor
Okay, that makes sense. Thanks for the link to Python timing! Can anyone familiar with the internals of django's serialization and templating offer any suggestions? Thanks! On Jan 26, 2:57 am, Antoni Aloy wrote: > 2009/1/26 Taylor : > > > > > I'm thinking of ch

Re: XML Serialization Speed

2009-01-26 Thread Taylor
nd it looks like it's a pain to get lxml running there. I'll try some timings and report back on what I find (if anything). Thanks everybody! Taylor On Jan 26, 6:01 pm, Russell Keith-Magee wrote: > On Tue, Jan 27, 2009 at 12:35 AM, Taylor wrote: > > > Okay, that makes

Link that performs an action

2008-04-10 Thread Taylor
ink this would be a great addition to django. Many frameworks are adding things like this, and I would gladly fill out a ticket requesting this. Thanks a bunch, Taylor --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &quo

Re: Link that performs an action

2008-04-10 Thread Taylor
use a in my template. Thanks On Apr 10, 6:34 pm, "Norman Harman" <[EMAIL PROTECTED]> wrote: > Taylor wrote: > > Does something exist so that a link on a page performs an action > > rather than just showing a view? > > For example: I have a counter saved to th

Re: Link that performs an action

2008-04-11 Thread Taylor
ht is to create a custom tag that automatically builds the from with a hidden data in it, but I haven't looked into custom tags to see if that's possible yet. Thanks! On Apr 11, 10:11 am, "Norman Harman" <[EMAIL PROTECTED]> wrote: > Taylor wrote: > > Thanks for t

Re: Should I set up Django locally or on a web server?

2008-05-02 Thread Taylor
say suffer through a couple of tough installs, document what you do so that you can do it again, and then you will be a lot better off, and have a greater understanding of how everything works. At least, that's what I do. Taylor On May 1, 10:43 pm, selmac <[EMAIL PROTECTED]> wrote:

Deprecating model field (Deleting model field, but keeping DB column)

2017-07-05 Thread taylor
the Field level. If anyone has other approaches to the problem, I would be very excited to find alternative methods. Thanks, Taylor -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving ema

Re: Deprecating model field (Deleting model field, but keeping DB column)

2017-07-05 Thread taylor
e DB, but >> Django model doesn't query for it or allow it to be used in creates and >> updates? Very similar to the managed=False on the Model, but on the Field >> level. If anyone has other approaches to the problem, I would be very >> excited to find alternative

Re: Deprecating model field (Deleting model field, but keeping DB column)

2017-07-05 Thread taylor
for the column, but the column would still be in the DB. On >>>> the next release, I could remove the column completely (with a RemoveField >>>> operation) and the existing code would not error because it has no >>>> knowledge of the column. >>>> >>>>

Re: Deprecating model field (Deleting model field, but keeping DB column)

2017-07-05 Thread taylor
>> column, so it needs to be run before. I am wondering if anyone has solved >>>>> this issue? >>>>> >>>>> My best solution (I don't think Django supports this) would be to have >>>>> a special type of field called a DeprecatedF

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. 'django.con

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. 'django.con

Re: Reverse error in contrib.comments

2008-10-22 Thread Brandon Taylor
svn 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 > > <[

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/tic

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 bei

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 hav

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 de

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 --~--~-~--~~

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

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 separate

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 = ( ..

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 case

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

2008-11-09 Thread Brandon Taylor
s` 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">

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 incl

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 na

Re: Problem with named URL and parameters

2008-11-13 Thread Brandon Taylor
gt; On Thu, Nov 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, > > >

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 temp

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: Exclude fields in form by language

2008-11-13 Thread Brandon Taylor
ECTED]> wrote: > 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 a

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-14 Thread Brandon Taylor
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-14 Thread Brandon Taylor
__. Thanks 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: >

Re: Django new comments framework error

2008-11-19 Thread Greg Taylor
I've been seeing this same exact issue, even after completely deleting and re-exporting Django and my project's source (minus all .pyc files). It appears to be something else that's being buried by that non-descriptive error message. On Oct 1, 2:53 pm, hotani <[EMAIL PROTECTED]> wrote: > It's bac

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 = my_model.

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

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 a

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: > >

FTP'ing without locking

2008-12-17 Thread Greg Taylor
This is somewhat of a core Python question with a Django twist. I'm running mod_wsgi and am trying to figure out how to FTP a file from my Django app to a remote host without locking the thread up. I've tried something like: from subprocess import Popen print Popen(["python", command_str, "53363"

Re: FTP'ing without locking

2008-12-17 Thread Greg Taylor
Dec 18, 2008 at 6:15 AM, Greg Taylor wrote: > > > This is somewhat of a core Python question with a Django twist. I'm > > running mod_wsgi and am trying to figure out how to FTP a file from my > > Django app to a remote host without locking the thread up. I've tried

Re: FTP'ing without locking

2008-12-17 Thread Greg Taylor
Keith-Magee" wrote: > On Thu, Dec 18, 2008 at 7:55 AM, Greg Taylor wrote: > > > Yeah, I was afraid this would be the case. The interval polling script > > was something I really wanted to avoid. > > > I can't believe this isn't possible, though. I assu

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: 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 wrote: > On 19 déc. 08, at 23:50, Brandon Taylor   > wrote: > > > Hi everyone, > > > My client needs some batch processing capabi

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 = MyModel

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 = zipfile.ZipFile(obj.thumbnail_ima

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 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 > directory to save into

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 dja

Re: Importing old projects into a fresh django installation

2009-01-13 Thread Patrick Taylor
Just tossing this out, but it might be worth checking to see what manage.py or django-admin.py reports as the version of Django installed: http://docs.djangoproject.com/en/dev/ref/django-admin/#determining-the-version At least then you'll be certain whether it's 0.96, 0.97svn or 1.0. On Jan 1

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 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 check for a GET or POST and >

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

Custom permission problem in newforms-admin

2008-07-21 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): i

Re: Custom permission problem in newforms-admin

2008-07-23 Thread Brandon Taylor
g where I should try to disable the field? 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,

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 callable,

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

Forms problem?

2008-08-28 Thread Greg Taylor
I'm getting the following error on some of my models with DateTimeFields. Any ideas? Traceback (most recent call last): File "/home/clemsoncrew/site-packages/django/core/handlers/base.py", line 86, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/home/

Re: Database schema migration - any tools available?

2008-08-28 Thread Greg Taylor
There are quite a few that take different approaches. Your best bet may be to use the search feature with the keywords 'schema migration' within the group. On Aug 28, 10:05 am, Alex <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a migrations tool made by me for an internal project. > I couldn't

Re: Forms problem?

2008-08-28 Thread Greg Taylor
ideas, I'm all ears, this is a bit of a showstopper for me. Thanks! Greg On Aug 28, 10:31 am, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Aug 28, 3:01 pm, Greg Taylor <[EMAIL PROTECTED]> wrote: > > > I'm getting the following error on some of my models

Re: Forms problem?

2008-08-28 Thread Greg Taylor
te, whereas Django is expecting a datetime.datetime.  Does that > make sense?  Perhaps you are passing in something like > "datetime.date.today()" where you should be passing in something like > "datetime.datetime.now()".  Or else maybe your field really should be a d

USStateField has gone missing

2008-09-04 Thread Brandon Taylor
Hello everyone, Is anyone else missing USStateField? None of my models that use this field are validating. I've tried trunk and the 1.0 official release I get the same error on both versions. If you look in django > db > models > fields > __init__.py You will not find USStateField, although it'

Re: USStateField has gone missing

2008-09-04 Thread Brandon Taylor
My bad. I see it's not in the latest version of the documentation : http://docs.djangoproject.com/en/dev/ref/models/fields/#model-field-types I guess we can just make a list of static choices using the states list in localflavor.us On Sep 4, 8:23 pm, Brandon Taylor <[EMAIL PROTECTED

Re: USStateField has gone missing

2008-09-04 Thread Brandon Taylor
Thanks everyone. I guess I just overlooked the localflavor documentation. Kind regards, Brandon On Sep 4, 8:30 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2008-09-04 at 18:23 -0700, Brandon Taylor wrote: > > Hello everyone, > > > Is anyone else missing

Re: USStateField has gone missing

2008-09-04 Thread Brandon Taylor
ep 4, 8:34 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Thanks everyone. I guess I just overlooked the localflavor > documentation. > > Kind regards, > Brandon > > On Sep 4, 8:30 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: > > > On Thu, 2008-

Re: USStateField has gone missing

2008-09-04 Thread Brandon Taylor
Thanks Malcom, I apperciate it! On Sep 4, 8:49 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2008-09-04 at 18:46 -0700, Brandon Taylor wrote: > > So, next stupid question :) > > > These fields all derive from forms, not models. > &g

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 = models.CharField(max_

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 lov

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 l

Re: Problem with named paths

2008-09-17 Thread Brandon Taylor
PROTECTED]> 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_

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 arr

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 the

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

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 avoid

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 o

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

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', e

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 workflow a

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, w

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

2008-10-07 Thread Brandon Taylor
nce it hits this function, 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(), >    

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 =

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' : self.pub_date.s

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

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

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: ManyToManyField with extra content and Django admin

2008-10-15 Thread Brandon Taylor
It truly 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 n

Re: ManyToManyField with extra content and Django admin

2008-10-16 Thread Brandon Taylor
t;[EMAIL PROTECTED]> 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)

Store python modules in a DB model

2009-01-17 Thread Greg Taylor
This is more of an experiment than anything, but I've got a model as such to store python modules: class StoredModule(models.Model): name = models.CharField() text = models.TextField() I want to be able to pull one of these and get access to the 'text' field as if it were a module. I can't

Auth section not showing in admin interface

2009-01-21 Thread Greg Taylor
Does anyone have any idea why the "Auth" section wouldn't show up in the admin display? Here's my APPS: INSTALLED_APPS = ( 'django.contrib.sites', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sess

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 colu

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

2009-01-22 Thread Brandon Taylor
...and do 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 wrote: > On Wed, 2009-01-21 at 21:40 -0800, Brandon Taylor wrote: > > Hi everyone, > > > I need to do some

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

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 abou

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. Re

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 va

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 run

  1   2   3   4   5   6   >