Re: Stupid noob question - admin link

2008-09-09 Thread Peter Bailey
my root where I came from, so the user can navigate there after completing whatever they were doing in admin. On Sep 9, 3:42 pm, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Sep 9, 7:16 pm, Peter Bailey <[EMAIL PROTECTED]> wrote: > > > Hi all, starting to think there is so

Re: Stupid noob question - admin link

2008-09-10 Thread Peter Bailey
Thanks everyone for your answers. Lots to learn here, but sure is fun! On Sep 10, 1:03 pm, AmanKow <[EMAIL PROTECTED]> wrote: > > Summary : You could simply copy the file base_site.html from admin > > templates to a directory called "admin" in your own template directory > > and add a link to yo

Abstract Superclass and Foreign Keys

2008-09-15 Thread Peter Bailey
an object perspective, maybe not for the ORM? My join table was working fine until I changed to the abstract supercalss (to solve another problem :-), and there are quite a few different item types. Any thoughts most appreciated. I am using django 1.0 Thanks for listening, Peter --~--~-~

Re: Abstract Superclass and Foreign Keys

2008-09-16 Thread Peter Bailey
Thanks for the responses. There are a number of subclasses and I won't know the specifics initially. I'll check out the GenericForeighnKey. Sounds like it is what I want. Thanks again, Peter On Sep 16, 8:34 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2008-0

Re: Abstract Superclass and Foreign Keys

2008-09-22 Thread Peter Bailey
hinking if the Admin can work properly with this, there must be a way that I can too. Very frustrating. Thoughts anyone (maybe I am losing it :-) . Thanks again, Peter On Sep 16, 9:37 am, Peter Bailey <[EMAIL PROTECTED]> wrote: > Thanks for the responses. There are a number of sub

Re: Abstract Superclass and Foreign Keys

2008-09-22 Thread Peter Bailey
am not sure that the Admin is creating my supertype class properly when I create a subtype. Can anyone tell me if it should, or whether I need to hook the code and do something manually when I am creating these through the Admin. Sorry to keep bothering everyone. Peter On Sep 22, 12:34 pm

Re: actual django stack

2008-09-26 Thread Peter Bengtsson
On Sep 25, 8:41 pm, "Frédéric Sidler" <[EMAIL PROTECTED]> wrote: > What it the best Django stack today. > > In django doc, it says that apache with mod_python is the best > solution in production. But in the same time I see that everyblock use > nginx (probably in mode fastcgi). > > Did you some

Ordering object collection by computed field?

2008-10-12 Thread Peter Krantz
plement a custom order_by that allows ordering of computed model fields? Or have I missed some feature for this in Django? Regards, Peter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: static html

2008-10-13 Thread Peter Herndon
, have you investigated flatpages (http://docs.djangoproject.com/en/dev/ref/contrib/flatpages/#ref-contrib-flatpages)? ---Peter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Created Form - now code works to edit object but add gets NoneType' object is not callable

2009-01-15 Thread Peter Bailey
#x27;size':'50'})) footer_title1 = forms.CharField(max_length=50 ,widget=forms.TextInput (attrs={'size':'50'})) footer_title2 = forms.CharField(max_length=50 ,widget=forms.TextInput (attrs={'size':'50'})) status = form

Re: Created Form - now code works to edit object but add gets NoneType' object is not callable

2009-01-15 Thread Peter Bailey
s/peterbailey/pywork/generator/../generator/surveys/ views.py" in surveyadd 137. form = SurveyForm() File "/Library/Python/2.5/site-packages/django/forms/models.py" in __init__ 212. self.instance = opts.model() Exception Type: TypeError at /surveyadd/ Exception Va

Re: Created Form - now code works to edit object but add gets NoneType' object is not callable

2009-01-15 Thread Peter Bailey
Thanks Andy On Jan 15, 1:50 pm, Andy Mckay wrote: > I don't think you are defining the ModelForm correctly, the whole   > point is that Django creates the fields for you. If you look at: > > http://docs.djangoproject.com/en/dev/topics/forms/modelforms > > This is the key difference between a Mo

Re: Created Form - now code works to edit object but add gets NoneType' object is not callable

2009-01-15 Thread Peter Bailey
he ones above that I want to change the defaults on? Much DRYer - ah Thank You On Jan 15, 1:38 pm, Peter Bailey wrote: > Thanks for the tips Dan, I thought the DRY thing could not be right. > Not sure I understand tho - I originally made the form with just the > inner Meta class definit

Deployment of apps with 3rd party code

2009-01-19 Thread Peter Manis
ication or project that will contain 3rd party libraries. e.g. from myapp.lib.boto.s3 import Connection This would have the benefit of maintaining a specific version of the library across servers and decrease requirements during deployment, but I not aware of what downsides there might be. Thanks,

Re: trying unsuccessfully to access django admin

2009-01-22 Thread Peter Herndon
, you need to find out what the underlying error is, so set DEBUG=True and try /admin/ again. Here's the docs on the 500.html page: http://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views ---Peter On Thu, Jan 22, 2009 at 9:44 AM, bconnors wrote: > >

Re: Some questions on using Django

2009-02-11 Thread Peter Herndon
little need for programmers to use design patterns, as the language has been designed to address the flaws that make design patterns necessary. Iterators are part of the language, a singleton is a module of functions, etc. As Thomas said, "Welcome to python and django". ---Peter --~--~

Re: Charts for Admin Interface

2009-02-15 Thread Peter Herndon
I don't have the URL handy, but the admin docs contain pointers on how to add extra URLs to your admin site. Create a view, make a template, add the URL, profit!! So if you want charts in your admin, such a task is well within the capabilities of Django for you to add. On 2/13/09, Robert wrote

Re: Mutli-Assignable Models

2009-02-15 Thread Peter Herndon
od on Show, you could just use std methods. ---Peter On 2/12/09, Justin Lilly wrote: > > Hi all. > > I have a project where I need to assign multiple models to each > other via some many to many relationship. > > There are a few main players in my prototype: Articles,

Re: Mutli-Assignable Models

2009-02-17 Thread Peter Herndon
On Mon, Feb 16, 2009 at 1:20 PM, Justin Lilly wrote: > > Hi Peter, > > While your proposed solution would work for the prototyping example > I've given, I have 3 more arching themes like Show and probably > another 4-5 content types like photo and articles. The main idea

Query over related models

2009-02-20 Thread Peter Müller
hment.name (which is related to one post) contains "Some Text". Is there a way to do this with Django's ORM? Thank you very much. Peter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users&q

Searching a list of Q

2009-02-25 Thread Peter Bengtsson
This works: >>> from django.db.models import Q >>> qset = Q(author__iexact=u"Foo") | Q(author__iexact=u"Bar") >>> Books.objects.filter(qset) But what if the list of things I want to search against is a list. E.g. >>> possible_authors = [u"Foo", u"Bar"] ??? I have a solution but it's very

Re: Django Transaction Management

2009-02-26 Thread Peter Herndon
er refer to the id explicitly, just use the object reference. Then later, when you commit your transaction, your object *in its final form* is saved to the database, and an ID is assigned. Hope that helps, ---Peter --~--~-~--~~~---~--~~ You received this message bec

Admin Pages - want horizontal scroll ability

2009-03-02 Thread Peter Bailey
real nice on 1900x1200 and my Macbook Pro :-) I have looked around and not seen an easy solution for this (which if course I am hoping for, since I thought I was wrapping up). Does anyone know any easy way to do this or can you shout me any good pointers. ' Help most appreciated, thanks,

Re: Admin Pages - want horizontal scroll ability

2009-03-02 Thread Peter Bailey
Yeah, I have big objects in tables. Sigh, was hoping to avoid writing more css, but thought it might come down to that. Thanks Alex. On Mar 2, 3:09 pm, Alex Gaynor wrote: > On Mon, Mar 2, 2009 at 3:06 PM, Peter Bailey wrote: > > > Hello, I am building a small app that just re

Re: Django Certifications

2009-03-06 Thread Peter Herndon
In short, no.If you are looking to create one, feel free, there's no competition. There's also been no discernible demand, from what I've seen. On 3/6/09, Praveen wrote: > > Is there any Django certification as others like SCJP, MCSE, CCNA and > more on? > > > --~--~-~--~~-

Re: HIPAA, Django and User Authentication/Security

2009-03-12 Thread Peter Herndon
is still disclosure, and subject to penalties. And since security policy enforcement is usually less on a test system ("Oh, sure, I'll show you how it works on test, no problem!"), the chances of disclosure are higher. ---Peter Herndon http://spookypony.com --~--~-~--~

Re: HIPAA, Django and User Authentication/Security

2009-03-12 Thread Peter Herndon
interoperability is a requirement. My experience with HIPAA pretty much predates interoperability, and was focused on the privacy and security regulations. ---Peter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Savepoint error with fastcgi

2009-03-23 Thread Peter Sheats
for middleware_method in self._response_middleware: response = middleware_method(request, response) response = self.apply_response_fixes(request, response) # finally: # signals.request_finished.send(sender=self.__class__) I am on trunk and

Using pluralize with floats?

2009-06-23 Thread Peter Schroeder
Hello, Has anyone tried to use pluralize template tag with a float value? I am thinking of submitting a patch to support this functionality. For instance, using the value 1.5 returns a singular suffix from pluralize. I am implementing a real estate web application where a house could have 1.5 ba

How to rerun tests on file changes

2009-07-12 Thread Peter Bengtsson
I write a lot of tests and with using DATABASE_NAME = ':memory:' the tests can run very fast. Usually I save the file I'm working on (e.g. models.py, test_views.py etc.); Alt+Tab, arrow up, Enter. Common, right? Is there a good script or command (linux) for automatically rerunning the tests? I k

Model inheritance problem, inherited instances

2009-07-20 Thread Peter Cicman
Hi, i didn't found noting about it in docs, so i'll try to ask, first explanation, i have: class A(models.Model): name = models.CharFiled(, required=True) . class B(A): I have an existing instance of A, say `a` and i "want to make" instance of b out of it. i'm lookin

Re: Model inheritance problem, inherited instances

2009-07-22 Thread Peter Cicman
e). The first one is the > instance of A associated with b, and the second the id of that > instance of A. So, I imagine that: > b = B() > b.a_ptr = a > b.save() > > or > > b = B() > b.a_ptr_id = a_id > b.save() > > should do what you want. > > Rodrigu

Re: Permissions independent of models

2009-07-27 Thread Peter Sagerson
The way I solved this was to write a custom auth backend that could evaluate a collection of non-model permissions. By convention, I had one permission per view. Some of these permissions were aliased to corresponding model permissions and some of them were based on other criteria. Essenti

Re: Admin: raw-id: Link to edit page

2009-08-03 Thread Peter Bengtsson
On 3 Aug, 10:12, Thomas Guettler wrote: > Hi, > > How can I display a link to the edit page of a foreign key? > > Example: > > class Place: >     city=models.ForeignKey(City) > > In the admin page of the place I want a link to the city admin page. > class PlaceAdmin(admin.ModelAdmin): list

Re: how to modified filefiled after created it

2009-08-03 Thread Peter Bengtsson
Not sure I understand what you want to achive but you talked about changing one class attribute when you change another. Look at this for example/inspiration:: class Foo(object): status = '' def __init__(self): self.name = '' def __setattr__(self, k, v): if k == 'sta

Re: newbie tutorial part 1 startproject doesn't create folder and appropriate files

2009-08-03 Thread Peter Bengtsson
Look at if perhaps the project "mysite" was created somewhere else, like for example where the django-admin.py file is located. If so, there could be a fundamental problem with your setup or a bug in the windows implementation for django-admin.py At worst, search your whole hard drive for it. On

Re: Image handling - Custom image field?

2009-08-03 Thread Peter Bengtsson
I would write a management command and let a cron job fire off to run it. See this for how to write management commands: http://docs.djangoproject.com/en/dev/howto/custom-management-commands/ Then your cron job can look something like this: */5 * * * * python /path/to/manage.py copyfromftp >> /de

Re: how to, complex filters in admin

2009-08-03 Thread Peter Bengtsson
Untested but should work (in admin.py): class ThingAdmin(admin.ModelAdmin): def queryset(self, request): qs = super(ThingAdmin, self).queryset(request) qs = qs.filter(some_integer_field__gt=10) return qs admin.site.register(Thing, ThingAdmin) On 3 Aug, 10:52, selcuk

Re: Admin: raw-id: Link to edit page

2009-08-03 Thread Peter Bengtsson
, extra_context={}): place = Place.objects.get(pk=object_id) if place.city: extra_context['city'] = place.city result = super(PlaceAdmin, self).change_view(request, object_id, extra_context) On 3 Aug, 13:22, Thomas Guettler wrote: > Thank you Pete

Have I found a bug? Deletion and rolled back transactions

2009-08-05 Thread Peter Bengtsson
Here's the models: # models.py class Article(models.Model): title = models.CharField(max_length=100) # urls.py urlpatterns = patterns('', (r'^delete-rolledback/$', delete_rolledback), ) # views.py def delete_rolledback(request): transaction.enter_transaction_management() transac

Re: Have I found a bug? Deletion and rolled back transactions

2009-08-05 Thread Peter Bengtsson
I have found that when running this as a normal server, the rollback DOES work. It's just in tests it doesn't work. On 5 Aug, 17:27, Peter Bengtsson wrote: > Here's the models: > > # models.py > class Article(models.Model): >     title = models.CharField

Re: Have I found a bug? Deletion and rolled back transactions

2009-08-05 Thread Peter Bengtsson
2009/8/5 Alex Gaynor : > > On Wed, Aug 5, 2009 at 11:31 AM, Peter Bengtsson wrote: >> >> I have found that when running this as a normal server, the rollback >> DOES work. It's just in tests it doesn't work. >> >> On 5 Aug, 17:27, Peter Bengtsson wro

Re: Memory error

2009-08-05 Thread Peter Herndon
On 08/05/2009 12:26 PM, drakkan wrote: > No I'm not serving static file I have a very large json file > dinamycally generated (based on a db query) > Please post the relevant view and model code, so we can see what's happening. Also, if your db query is actually a really large number of db

Re: Memory error

2009-08-05 Thread Peter Herndon
;:o1.field2}, {'field1':o2.field1, 'field2':o2.field1}, ...] but it's a lazy iterator rather than an in-memory list. Another thing that comes to mind is using Django's built-in serializers, which will take your filtered

Re: adapt admin interface

2009-08-05 Thread Peter Herndon
the response. Overriding the admin templates documentation is here: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates Hope that helps, ---Peter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the G

Announce: django-ldap-groups

2009-08-05 Thread Peter Herndon
osoft Active Directory and Novell eDirectory. Other LDAP servers will probably work using the eDirectory backend, but none have been tested at the time of writing. Please let me know if you have any questions or comments. Regards, ---Peter He

Re: python md5

2009-08-06 Thread Peter Herndon
On 08/06/2009 01:55 PM, Asinox wrote: > Hi guys, please i need to know why md5 return this: > > > > > the way that im using: > > def encriptar(): > toEncode = pickle.dumps(datetime.now) > encoded = md5.new(toEncode) > > return encoded > Because encoded is an md5 hash *object*.

Re: how to deploy Django on the web server?

2009-08-07 Thread Peter Herndon
and where it's failing. Maybe then we can help you solve the problem. Hmm, looking at the 000webhost.com site, their free offering does not include Python. And I can't get heliohost.com to resolve. Perhaps your problem starts there. ---Peter --~--~-~--~~~

Re: apps that relate to each other

2009-08-07 Thread Peter Herndon
r virtualenv similar to easy_install. The downside, of course, is that you have to learn a few more tools, and use them with discipline. Happily, they aren't hard to learn and are reasonably well documented. Hope that helps, ---Peter --~--~-~--~~~---~--~

Re: Strange problem with LDAP authentication backend

2009-08-12 Thread Peter Herndon
ry to the list of supported servers. It is very new (about a week old or so), and has boogs, but I'd love to see if it helps your problem. (Of course, the fun part about LDAP is that my diagnosis may be entirely wrong, too... ;) Regards, ---Peter Herndon --~--~-~--~~-

Re: Theory: Models/Apps

2009-08-14 Thread Peter Herndon
. And when you start thinking that your models.py, or views.py, is getting too big, you should probably start asking yourself if you split a related set of functionality out into its own app. ---Peter Herndon --~--~-~--~~~---~--~~ You received this message b

Re: how much python do i need to know to learn/use Django?

2009-08-14 Thread Peter Herndon
leties of the language. Yes, Python is designed to be easy to learn and easy to read, but understanding the possibilities inherent in the language will help you grasp more of Django more easily than if you just dive into web programming. Listen to the instru

Re: Eric Evans Value Objects

2009-08-17 Thread Peter Herndon
ents a problem, you can always rethink later, and you will have the benefit of knowing what problems you need to work around. Hope that helps, ---Peter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django us

Re: custom authentication backend not being used...

2009-08-19 Thread Peter Herndon
On 08/19/2009 02:04 PM, Jay wrote: > Sorry, nevermind. I finally figured this out right after I posted > this. > > What was the solution? Both for posterity, and because I'm personally curious. Thanks, ---Peter --~--~-~--~~~---~--~~

Re: Raw HTTP request processing?

2009-08-25 Thread Peter Bengtsson
On Aug 25, 4:54 pm, John Baker wrote: > Some of my views need to process arbitrary incoming data that isn't a > normal web request i.e. process an incoming document and return an > altered document. > > How do I get a view to process raw incoming data rather than the usual > encoded parameters a

Re: print PDF on windows

2009-08-25 Thread Peter Bengtsson
Suppose you have a PDF (generated or downloaded from the internet), are you able to get it printed by scripting? On Aug 25, 4:38 pm, mettwoch wrote: > How do the Django people handle printing directly on Windows? I > remembered abouthttp://timgolden.me.uk/python/win32_how_do_i/print.html, > but

Re: Raw HTTP request processing?

2009-08-25 Thread Peter Bengtsson
Here's an example: http://www.djangosnippets.org/snippets/1322/ On Aug 25, 5:43 pm, John wrote: > > Isn't it just > > request.raw_post_data > > Thanks and I suspected it was that but hoped there might be a little > example somewhere as the docs don't say much only this: > > HttpRequest.raw_post_

Re: Test client and form processing

2009-08-25 Thread Peter Bengtsson
Do you mean when you write tests? If so, when you get the response you can extract all the variables that was created inside the view if you're using locals(). That way, you can probably get the form instance (created for example by form=MyForm(request.POST)) which you can then untangle to get all

Re: json serialization error on arrays

2009-08-25 Thread Peter Bengtsson
what's wrong with turning it into a list? If you gzip it it won't be that big. On Aug 25, 5:16 pm, John Baker wrote: > I need to json serialize some very large objects which include large > arrays. How can I do this in django? The arrays will be very big and > heavily processed before so need to

Re: Many-to-many column

2009-08-25 Thread Peter Bengtsson
I fear your only option is to write a recursive function which you feed with what you define to be "the end of the chain". You can collect all the entries in a mutable list. Some example, untested, code: def get_all_parents(list_, current): for entry in current.following_to.all(): lis

Re: Dynaically fields to a formwizard form

2009-08-25 Thread Peter Bengtsson
You can add and modify fields on a form in the form's __init__ function. class MyForm(forms.Form): country = forms.ChoiceField() def __init__(self, *args, **kwargs): super(MyForm, self).__init__(*args, **kwargs) self.fields['country'].choices = \ [(c.iso_code, c

Re: Ajax TreeList with Django

2009-08-26 Thread Peter Herndon
approach and steal code like crazy. :) Or, if I had just one kind of model, I'd just add enough Ajax views to power dynatree. ---Peter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djang

Re: Re-usable/pluggable app form question.

2009-09-03 Thread Peter Coles
plates? Maybe also look at django.contrib.comments. Peter On Sep 3, 10:07 am, Shawn Milochik wrote: > I'm working on an existing project that I'm splitting up into multiple   > apps. My question is about how to use those apps together. > > Say I have an app called "main.&

Re: Basic 404.html template issue

2009-09-07 Thread Peter Coles
stem.load_template_source', or maybe you setup something weird for "handler404" in your urls.py file. Good luck! Peter On Sep 6, 3:33 pm, moreeon wrote: > Hi everyone, I'm struggling with an issue my girlfriend says is > "ironic". I can't get my custom 4

Re: Managers in admin

2009-09-08 Thread Peter Coles
Are you certain that the django admin interface is actually using LiveEntryManager? I just tested this out (using trunk): class BadManager(models.Manager): def all(self): return self.get_query_set().filter(slug='') def filter(self, *args, **kwargs): return super(BadManager, self).filter(

Re: Link for new page

2009-09-08 Thread Peter Coles
Make yourself familiar with the django documention page—if you know where to look for stuff there, you'll find it to be a very handy resource. http://docs.djangoproject.com/en/dev/ > 1: How can I go to next page when i submit the data in index page(log > in page) http://docs.djangoproject.com/en

Re: Having Trouble with Reverse method

2009-09-08 Thread Peter Coles
What you provided looks correct -- which means that something else is probably broken... Some things to investigate: 1. If you manually go that url: http:/in_development/ does anything get served? 2. Is your ROOT_URLCONF setup to properly point to this file in your settings file? 3. Is this anot

Re: Choices of foreign keys?

2009-09-09 Thread Peter Coles
.CharField(max_length=100) slug = models.SlugField(unique=True) class Admin: pass and then inside your photos model add a new column: categories = models.ManyToManyField(Category, blank=True) -Peter On Sep 9, 11:54 am, Léon Dignòn wrote: > Hello, > > let's assume we

Re: Custom url in django Django sitemap

2009-09-09 Thread Peter Coles
I'm talking about read this: http://docs.djangoproject.com/en/dev/intro/overview/#intro-overview ) -- if that's the case, you can use the direct_to_template generic view as described here: http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-simple-direct-to-template -Peter On Sep

Re: Choices of foreign keys?

2009-09-09 Thread Peter Coles
. Also his examples of choices are good, it will be a bit of a pain if you use choices and choose to rename or remove any of them. On Sep 9, 1:36 pm, Léon Dignòn wrote: > Hello Peter, > > sorry, I was talking about choices, not a choice > field:http://docs.djangoproject.com/en/dev/ref/

Re: Fulltext searching

2009-03-28 Thread Peter Herndon
In addition, full text indexing with Sphinx has been shown to be faster than the same using MySql'ls fulltext search. Django-NYC recently had some talks on search, and the gentleman who presented on David Cramer's django-sphinx module had run some rough timing tests. On 3/27/09, Antoni Aloy wro

Re: Mysterious "=32" for all strings extracted from list showing up via send_mail

2009-03-28 Thread Peter Herndon
The answer is here: http://www.faqs.org/rfcs/rfc2045.html Specifically, section 6.7, "Quoted-Printable Content-Transfer-Encoding". If you take a tour through Python's email module in the standard library, you'll find some bits for handling decoding. On Thu, Mar 26, 2009 at 4:11 PM, NoviceSortO

Re: Validate with PIL

2009-04-05 Thread Peter Douma
I can import from the shell. - Original Message - From: Alex Gaynor To: django-users@googlegroups.com Sent: Sunday, April 05, 2009 6:47 PM Subject: Re: Validate with PIL On Sun, Apr 5, 2009 at 6:37 PM, CrabbyPete wrote: I installed the PIL Imaging library and when

Manual transactions in command

2009-04-07 Thread Peter Bengtsson
Why doesn't this work? from django.core.management.base import BaseCommand from django.db import transaction class Command(BaseCommand): help = "bla bla" def handle(self, *app_labels, **options): from myapp.models import MyModel transaction.enter_transaction_management()

Re: Manual transactions in command

2009-04-07 Thread Peter Bengtsson
Crap! Just as I closed this message I found another group post and the answer was to do:: transaction.enter_transaction_management() transaction.managed(True) On Apr 7, 5:24 pm, Peter Bengtsson wrote: > Why doesn't this work? > > from django.core.manageme

Re: TreePanel in Django

2009-04-14 Thread Peter Herndon
th large quantities of objects. ---Peter On 4/13/09, Eduardo Aragón Montes wrote: > Hi everyone..I'm new in django and I'm developing and app that have virtual > storage for users...so i would like to do a treepanel for every user where > they can see what files they have upload

Invalidate a cache_page view

2009-05-11 Thread Peter Bengtsson
I have this @cache_page(MANY_HOURS) def foo(request): calculate_something_complex() ... @login_required def bar(request): change_complex_data() #here I want to invalid foo()'s cache ... But other actions elsewhere will need to invalidate the cache for this. I could do a '/

Question - sound files and Django.

2009-05-12 Thread Peter Murphy
y image files. I would also like to know if there are ready made  template tags for sound files. Has anyone tackled this? As someone said, I would rather not re-invent the wheel. (And if it hasn't been tackled, well, I better get cracking on it.) Cheers, Peter --~--~-~--~~---

Admin list_filter and using a method instead

2009-05-29 Thread Peter Bengtsson
When I register my model to the admin it doesn't allow me to use a method in list_filter :( This pseudo code should explain my situation: class MyModel: gender = models.CharField() age = models.IntegerField() @property def man(self): return self.gender == 'male' and

Re: Admin list_filter and using a method instead

2009-05-29 Thread Peter Bengtsson
Apparently, Adrian doesn't think it should work with anything but DB fields http://code.djangoproject.com/ticket/2334 Crap! On May 29, 1:49 pm, Peter Bengtsson wrote: > When I register my model to the admin it doesn't allow me to use a > method in list_filter :( > This

Re: Admin list_filter and using a method instead

2009-05-29 Thread Peter Bengtsson
"wraps" (not overrides) so it does not work. For now I've given up :( On May 29, 1:49 pm, Peter Bengtsson wrote: > When I register my model to the admin it doesn't allow me to use a > method in list_filter :( > This pseudo code should explain my situation:

Re: Newb with some questions ...

2009-06-16 Thread Peter Herndon
For REST in Django, there are a number of options, but django-piston is a front-runner. ---Peter On 6/14/09, Gunnar wrote: > > Good Day, > > I'm an 'ol VB6/SQL Server client-server programmer who has moved > into .NET, Silverlight and has done some websites with Jooml

Re: Beginners question: select box with very much options

2009-06-18 Thread Peter Herndon
ll via Ajax, add the js to your template, and you're in business. ---Peter On 6/18/09, Bruno Tikami wrote: > Hello Mathias, > > On Thu, Jun 18, 2009 at 12:37 PM, Mathias Waack > wrote: > >> >> Hello django experts, >> >> let me first note I'm a

Re: custom tag - render() isn't called

2009-09-11 Thread Peter Coles
jango? etc. Separately, if you're resolving arguments to a template_tag, I'd recommend using the template.Variable and .resolve(context) construct, this will resolve plain text that you put in quotes and also variables that are in the context: http://docs.djangoproject.com/en/dev/howto/cus

Re: Custom url in django Django sitemap

2009-09-11 Thread Peter Coles
on(self, obj): return obj and add it to your sitemaps dictionary that gets passed into your sitemap.xml in your urls.py file: sitemaps = { ... 'staticpages': StaticPagesSitemap, } Enjoy! -- Peter On Sep 9, 6:11 pm, eli wrote: > Hi, > > Thanks for replay, but I was talking a

Re: Having Trouble with Reverse method

2009-09-11 Thread Peter Coles
to see if you're just doing some step wrong? Good luck! -- Peter On Sep 9, 5:29 pm, Streamweaver wrote: > Yet more info here.  This might be a particular problem due to the > particular method being called in multiple URL patterns so I tried > making it and calling a named URL pattern b

Re: Link for new page

2009-09-11 Thread Peter Coles
oc for generating urls in templates. -- Peter On Sep 9, 10:52 am, Ajit jena wrote: > Hi , > > I have one question plz help me. > > I am create a page and it is showing , when I am redirect from view.py page. > > In *url.py* page I have written > > urlpatterns = patt

filter on entries from a certain user

2009-09-13 Thread Peter Newman
Guys - I have class Contact(db.Model): person = db.ReferenceProperty(Person) contact_date = db.DateTimeProperty(auto_now_add=True) remarks = db.TextProperty() owner = db.UserProperty(auto_current_user_add=True) and a simple form class ContactForm(forms.ModelForm): class Meta:

Re: File Field max size and admin interface

2009-09-13 Thread Peter Bengtsson
One way of doing it, and to be honest the only one I know, is to set a limit in the fronting web server. In Nginx for example you add: client_max_body_size 10M; Sadly this means that if a user tries to upload a 11Mb file you won't be able to confront them with a user-friendly "error" message.

Re: post_save signal to create the new user profile

2009-09-13 Thread Peter Bengtsson
Signals or no signals I think your profile model is wrong. By making it a subclass of User you're effectively getting all the fields of the User model. Write your profile model like this instead: class Employee(models.Model): user = models.ForeginKey(User) address = models.CharField(...)

Re: urls.py

2009-09-13 Thread Peter Bengtsson
On Sep 13, 1:35 pm, ramanathan wrote: > (r'^/(.+)/$','proj.register.views.activate') > Change to (r'^(.+)/$','proj.register.views.activate') (notice the removed forward slash in the beginning otherwise you have to expect the URL to be http://localhost:8000//90/ > (r'^(?P.*)$', 'django.views.st

Re: Memory limits

2009-09-13 Thread Peter Bengtsson
Hard to say as it depends on your app but can't you just run the app on your laptop and see how much memory it takes up when you run some basic stresstests. Django is quite close to pure python but when you extract large lists of model instance objects into lists it can push the memory consumption

Re: filter on entries from a certain user

2009-09-13 Thread Peter Bengtsson
o do it's magic. Something like this: class ContactForm(forms.ModelForm): class Meta: model = Contact exclude = ('owner',) On Sep 13, 9:06 am, Peter Newman wrote: > Guys - > > I have > class Contact(db.Model): >     person = db

Re: html template usage

2009-09-13 Thread Peter Bengtsson
Suppose you have a template called monster.html that looks like this: Company name Lorem ipsum Then, create a Django view and make it render a template called, say, home.html which you make to look like this: {% extends "monster.html" %} {% block title %}My Company!{% endbloc

Re: filter on entries from a certain user

2009-09-14 Thread Peter Newman
55 pm, Peter Bengtsson wrote: > I dont know what db.UserProperty() is but my guess is that that's > something related to the model. > Your form doesn't understand that so it defaults to None. > If you omit the field owner from the form, perhaps the form won't > attem

Re: filter on entries from a certain user

2009-09-14 Thread Peter Bengtsson
On 14 Sep, 09:24, Peter Newman wrote: > Ok i am a bit further. The above only works with Google's > authentication. However I want to use Django authentication. Is there > a way to add the current user to the model during creation of the > entity? There must be som

Re: django-admin.py the system cannot execute the specified program

2009-09-14 Thread Peter Bengtsson
about2flip You have to go through the python tutorial I'm afraid. Python files must be written in plain text so you have to use something like Notepad. On 14 Sep, 08:50, about2flip wrote: > Thanks for reply. No I get: > SyntaxError: unexpected character after line continuation character > > I am

Re: get current URL

2009-09-14 Thread Peter Bengtsson
Perhaps it's this you're looking for: current_url = request.build_absolute_uri() On 14 Sep, 01:12, Shuge Lee wrote: > How to get current URL ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Context object not completely rendering

2009-09-14 Thread Peter Coles
g but "{{ section }}" It's probably something like a typo somewhere, but you'll have to debug this yourself. Good luck! -- Peter On Sep 14, 1:40 pm, Dan06 wrote: > Hi, > > Below is a function I created in my views.py file and its accompanying > template file. F

Re: QuerySet: clone vs deepcopy?

2009-09-23 Thread Peter Coles
called copy.deepcopy() on that list, the __deepcopy__ function for BaseQuery will get evaluated. I didn't write the code though, so this is my best interpretation of it. Here's the python doc on the copy module: http://docs.python.org/library/copy.html -- Peter On Sep 23, 9:52 am, J

<    1   2   3   4   5   6   7   8   9   10   >