How do I echo template variables?

2007-07-29 Thread [EMAIL PROTECTED]
I'm coming from CakePHP and I would typically set a variable for use in my view with a call to findAll. Since there is a lot of data in the array, I typically do something like: This way, I can find out what data is available in the view and figure out how much I can scale back the

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Greg
Russ, Here is what I get with I use 'python manage.py shell' >>> b = Orders.objects.get(pk=1) >>> b.s_name u'Bob Smith'' >>> b.timestamp u'2007-07-29' >>> No errors when I access the timestamp property from within the python shell. On Jul 30, 12:00 am, Greg <[EMAIL PROTECTED]> wrote: > Russ, >

Re: Using LimitRequestBody to Limit File Uploads

2007-07-29 Thread Nimrod A. Abing
On 7/30/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > The documentation says: > > """Similarly, an 'apache' subdirectory should have been created within > the package and the script file stored there under the name > 'django.wsgi'.""" > > Rather than trying to launch straight into setting up

Re: DbMigration 0.04 released

2007-07-29 Thread Itai Tavor
Any management.py.patch version around that applies cleanly to django svn (5776)? > patching file core/management.py > Hunk #1 FAILED at 481. > Hunk #2 succeeded at 541 (offset 20 lines). TIA, Itai --~--~-~--~~~---~--~~ You received this message because you are

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Greg
Russ, Here is my view: def success(request): f = processpay(request) if f == 'True': pr = theamount(request) o = Orders() o.timestamp = datetime.now() o.s_name = 'Bob Smith' o.s_address = '18sdf est

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Greg
Russ, Here is my Orders Class: class Orders(models.Model): timestamp = models.DateField() b_name = models.CharField("Billing Name", maxlength=100) b_address = models.CharField("Billing Address", maxlength=100) b_city = models.CharField("Billing City", maxlength=100) b_state =

Re: caching and "hello username" on each page

2007-07-29 Thread James Bennett
On 7/28/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > I would LOVE to use caching for both anonymous and logged in users, but > the problem is that every page on our site (http://www.splicemusic.com) > has the typical "hello username | log out | ..." at the top of each page. You might

Re: caching and "hello username" on each page

2007-07-29 Thread Doug B
You could also make your own render_to_response() function that renders and caches the generic part of the page, and then passes that in as a context for your base layout with the non-cacheable stuff like the username. Or make some of the generic stuff tags that cache themselves using the lower

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Russell Keith-Magee
On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > Russ, > I tried including the code that you recommended. However, I'm still > getting the same error: > > AttributeError at /admin/rugs/orders/1/ > 'unicode' object has no attribute 'strftime' Just to clarify - If you create, modify and save an

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Greg
Russ, I tried including the code that you recommended. However, I'm still getting the same error: AttributeError at /admin/rugs/orders/1/ 'unicode' object has no attribute 'strftime' /// I updated my view to include the following lines: from datetime import datetime ...

Re: error on models with foreign key on each other

2007-07-29 Thread Ben Ford
It looks like your problem is that you have a ForeignKey pointing both ways... This is unnecessary. You only need one ForeignKey, pointing from the pointing from the 'child' to the 'parent'... I would guess from your snippet, that one employee can have many contracts and assignments so you need to

Re: newforms: common constraints

2007-07-29 Thread james_027
hi, what will be the proper approach to do this? creating a custom fields or custom field validation? Thanks james On Jul 27, 10:53 pm, "Jacob Kaplan-Moss" <[EMAIL PROTECTED]> wrote: > On 7/27/07, james_027 <[EMAIL PROTECTED]> wrote: > > > but those min maxconstraintsare socommon? why not

Re: error on models with foreign key on each other

2007-07-29 Thread James Bennett
On 7/29/07, james_027 <[EMAIL PROTECTED]> wrote: > D:\private\james\documents\django\ksk>python manage.py validate > manning.employee: Reverse query name for field 'employee_contract' > clashes with field 'EmployeeContr > act.employee'. Add a related_name argument to the definition for >

error on models with foreign key on each other

2007-07-29 Thread james_027
Hi, I am trying to migrate an existing application to django. I am encountering the following problem with this models D:\private\james\documents\django\ksk>python manage.py validate manning.employee: Reverse query name for field 'employee_contract' clashes with field 'EmployeeContr

Re: a generic JSON serializer???

2007-07-29 Thread Empty
I have pulled together pieces to do this. I posted about it here: http://blog.michaeltrier.com/2007/7/30/json-generic-serializer I don't know if it's exactly what you're looking for, but check it out. Empty On 7/26/07, Eric St-Jean <[EMAIL PROTECTED]> wrote: > > Hi, > There does not seem to

Re: Match from list in URLconf

2007-07-29 Thread Matt the Destroyer
I missed a quote, it should be: (r'^(?P\w+)/$', 'project.views.user_page') On Jul 29, 10:16 pm, Matt the Destroyer <[EMAIL PROTECTED]> wrote: > Perhaps try adding a URL pattern like the following: > (r^(?P\w+)/$', 'project.views.user_page') > > Your view function (called "user_page")

Re: Match from list in URLconf

2007-07-29 Thread Matt the Destroyer
Perhaps try adding a URL pattern like the following: (r^(?P\w+)/$', 'project.views.user_page') Your view function (called "user_page") will now accept "user_name" as an argument in addition to the request object. I should warn you that using that regular expression could be dangerous, as

Re: Blog engine

2007-07-29 Thread Forest Bond
On Sun, Jul 29, 2007 at 05:49:54PM -, Henrik Lied wrote: > @Forest: I agree, it should be that simple. But let's say you've got a > comment reply plugin. How would we - through a middleware - manage to > intercept our usual comment system, and modify the HTML template > source to fit the

Re: friends table adding choices from the same database

2007-07-29 Thread [EMAIL PROTECTED]
THANK YOU! i just got home, will try this to see if this works... i'm new to django so thanks for the help, i'll look up what related_name works, but it looks good. Israel On Jul 29, 9:41 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > If the Friend is really a user...wouldn't something

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Russell Keith-Magee
On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > Ok, > I just added a Field in my Orders class. It looks like this: ... > Do I need to put something into my timestamp field when I create the > Orders instance? For example: Yes; your field is a required field, so you will need to provide

Re: db mock for unit testing

2007-07-29 Thread Russell Keith-Magee
On 7/29/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > So what advantages are there to the mocking approach over just replacing > the setting? Genuine mocking (as opposed to this proposal) has one really big advantage - it's lightning fast. All the db-calls get faked using a cache-like

Re: db mock for unit testing

2007-07-29 Thread Russell Keith-Magee
On 7/29/07, Andrey Khavryuchenko <[EMAIL PROTECTED]> wrote: > > I'm not using django's testing framework for several reasons: > - I'm using django from 0.91 days and wasn't following django-users all >this way > - I use nose and twill for testing and they have no ready-to-use plugs >

Re: Template tag and combining variables & text

2007-07-29 Thread Emanuele Pucciarelli
Il giorno 29/lug/07, alle ore 22:48, Tomas Kopecek ha scritto: > I know, it's syntactical nonsense. But does anybody know about some > way > how to combine variable content with string content? Is it possible? > > For example, very crude way could be something like > > {% img %}

Re: Using LimitRequestBody to Limit File Uploads

2007-07-29 Thread Graham Dumpleton
On Jul 30, 12:26 am, "Nimrod A. Abing" <[EMAIL PROTECTED]> wrote: > On 7/29/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > > > > I would love to try that on my development server but I can't seem to > > > find documentation on how to do it: > > >

Match from list in URLconf

2007-07-29 Thread Matt
Hello list, I was wondering if the following is possible with the URLconf: I'd like the URL regex to match part of a URL if it exists within a specific list of values. For example, if you wanted to direct users to their area of your site, you might have something like this: www.mysite.com/matt

Re: Django.contrib.markup problems

2007-07-29 Thread Steve
On Jul 27, 6:57 pm, "Robert Coup" <[EMAIL PROTECTED]> wrote: > > I suspect whatever is hosting your site (mod_python? fcgi?) is using a > different path or a different interpreter (like 2.4). Print the value > of sys.path from a view and see whether it includes the right folder. > > The other

Re: Confusion over CRUD generic views and newforms

2007-07-29 Thread Matt
Thanks Phil. Seems to do exactly what it promises. Regards, Matt. On Jul 29, 12:10 pm, "Phil Davis" <[EMAIL PROTECTED]> wrote: > On 26/07/07, Matt <[EMAIL PROTECTED]> wrote: > > > Can you confirm that the CRUDgenericviewsare compatible with > >newforms? I haven't seen any examples of how to do

Re: Is there any way to associate a view with a template?

2007-07-29 Thread Emanuele Pucciarelli <[EMAIL PROTECTED]>
Hi Dan, > make a view for the nav.html template (which is included in all the > page templates)? I imagine it could be done with SSI but I don't want > to go that route unless I have no other option. Carole's advice solves your problem just right; on the other hand, you might want to look at

Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Greg
Ok, I just added a Field in my Orders class. It looks like this: timestamp = models.DateField("Creation Date") // I create a new instance of the order class below: o = Orders() o.s_name = 'Greg Smith' o.s_address = '123 West Main'

Template tag and combining variables & text

2007-07-29 Thread Tomas Kopecek
Hello, imagine tag, that has one parameter. Typical usage will look like this: {% img img_url %} or {% img "http://x.y/z.gif; %} These two cases are simple to implement, the problem arises when parameter would be a combination of variable content and string - something like this: {% img

Validating custom primary key values in raw_id_admin fields

2007-07-29 Thread Brendan Arnold
ref: http://groups.google.com/group/django-users/browse_thread/thread/9c9b05de723877a2/41c26d973af029d5?lnk=gst=raw_id_admin=10#41c26d973af029d5 hi there, there still seems to be this problem. i just checked out the svn about a week ago. it appears to be a problem with validation. the

RE: noob problem with Unicode

2007-07-29 Thread Donald Spears
Yep that did it, gesh, I feel dumb :P Thanks, Paul -Original Message- From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Parnell Springmeyer Sent: Sunday, July 29, 2007 12:41 PM To: django-users@googlegroups.com Subject: Re: noob problem with Unicode Make sure

Re: noob problem with Unicode

2007-07-29 Thread Parnell Springmeyer
Make sure you are using the correct version, the documentation link defaults to the repository code; you have to follow the 0.96 version documentation link on the top. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

noob problem with Unicode

2007-07-29 Thread dpsthree
I was following the tutorial (http://www.djangoproject.com/documentation/tutorial01/) and can't get the __unicode__ function to return properly. I have the following in my models.py from django.db import models import datetime class Poll(models.Model): question =

Re: Blog engine

2007-07-29 Thread Henrik Lied
@Forest: I agree, it should be that simple. But let's say you've got a comment reply plugin. How would we - through a middleware - manage to intercept our usual comment system, and modify the HTML template source to fit the plugin? It's cases like these I see the potential pitfalls of our way of

Re: friends table adding choices from the same database

2007-07-29 Thread [EMAIL PROTECTED]
If the Friend is really a user...wouldn't something like this work: class Friends(models.Model): parent_user = models.ForeignKey(User, related_name="user") friend_user = models.ForeignKey(User,related_name="friends") Then for the parent_user's friends...you'd do something like:

Re: Using LimitRequestBody to Limit File Uploads

2007-07-29 Thread Nimrod A. Abing
On 7/29/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > > I would love to try that on my development server but I can't seem to > > find documentation on how to do it: > > > > http://code.djangoproject.com/wiki/ServerArrangements > > > > Can someone point me in the right direction? > >

Re: Blog engine

2007-07-29 Thread Forest Bond
On Sat, Jul 28, 2007 at 03:28:31PM -, Henrik Lied wrote: > > Ok, so I've been thinking some more. > > The model could be something like this: > class Plugin(models.Model): > """(Plugin description)""" > pointer = models.FilePathField() ## Could work, right? > name =

Re: ubuntu 6.06 deployment issues

2007-07-29 Thread [EMAIL PROTECTED]
Sorry to re-awaken this thread, but it seems that people are still having issues with this PYTHONPATH info. In an attempt to get this sorted out, I've attached a patch to #4296 that adds a bit more info. Can anyone add any more info to what I've got? Thanks, Simon G #4296 -

Re: Using LimitRequestBody to Limit File Uploads

2007-07-29 Thread Graham Dumpleton
On Jul 29, 8:35 pm, "Nimrod A. Abing" <[EMAIL PROTECTED]> wrote: > On 7/29/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > > If not bound to mod_python because of need to use it for custom > > authentication/authorisation handlers connected to Django, you might > > also try using mod_wsgi

Re: Filter to find closest match

2007-07-29 Thread Tim Chase
> In pure sql we can do : > "select min(abs(width-150)) from quote_pricelisttable where name_id = > 1 and width >= 240-150 and width <=240+150;" > > How to make it work properly from django ORM? Did you try playing with the extra() call I included in my previous email? It should do what you

Re: Confusion over CRUD generic views and newforms

2007-07-29 Thread Phil Davis
On 26/07/07, Matt <[EMAIL PROTECTED]> wrote: > Can you confirm that the CRUD generic views are compatible with > newforms? I haven't seen any examples of how to do it, but I'm having > a hard time believing that this core functionality hasn't been > implemented (or even patched) for newforms yet.

Re: Using LimitRequestBody to Limit File Uploads

2007-07-29 Thread Nimrod A. Abing
On 7/29/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > We hadn't been able to come up with a way of reproducing the problem > on demand so hadn't yet been able to investigate. Where people had > seen this exception it was very rare and very random. I think the following conditions trigger the

Re: Using LimitRequestBody to Limit File Uploads

2007-07-29 Thread Graham Dumpleton
On Jul 29, 8:00 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Jul 29, 11:20 am, "Nimrod A. Abing" <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > I have recently begun testing LimitRequestBody to limit file uploads. > > It works but there are some issues. Whenever the uploaded file hits

Re: Using LimitRequestBody to Limit File Uploads

2007-07-29 Thread Graham Dumpleton
On Jul 29, 11:20 am, "Nimrod A. Abing" <[EMAIL PROTECTED]> wrote: > Hello, > > I have recently begun testing LimitRequestBody to limit file uploads. > It works but there are some issues. Whenever the uploaded file hits > the limit, I get "Connection reset by peer". Ideally I would like to > be

Re: Model code generator

2007-07-29 Thread James Bennett
On 7/29/07, dsinang <[EMAIL PROTECTED]> wrote: > Is there a Django model code generator which can generate code based > on a MySQL database schema ? http://www.djangoproject.com/documentation/django-admin/#inspectdb -- "Bureaucrat Conrad, you are technically correct -- the best kind of

Model code generator

2007-07-29 Thread dsinang
Hello, Am a Django newbie. Is there a Django model code generator which can generate code based on a MySQL database schema ? Regards, Danny --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Organising django projects

2007-07-29 Thread Almad
> Has this been discussed before? What are the dev's feelings on this? I'd like to hear them too. > -justin Almad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: db mock for unit testing

2007-07-29 Thread Andrey Khavryuchenko
Malcolm, MT> That isn't an answer to the question Russell asked, though. You can get MT> exactly the same end-effect (using in-memory SQLite) if you specify MT> SQLite as the database engine in the settings file you use for testing. MT> Deriving your testing settings file from the main

Re: Filter to find closest match

2007-07-29 Thread Michael
On 7/29/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > > currently I using filter to find closest match: > > step=100 > > w=2000 # get it from forms. > > value=pricelist.pricelisttable_set.filter(width__gte=w-step,width__lte=w+step)[0] > > > > The problem is that "step" is different for different

Re: Looping through my POST data?

2007-07-29 Thread Alvin
That is what programming language? Note you can name what? Thanks ! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To

Wrong assertion in __init__ of ValidationError?

2007-07-29 Thread Gilbert Fine
This is from django r5773: class ValidationError(Exception): def __init__(self, message): "ValidationError can be passed a string or a list." if isinstance(message, list): self.messages = ErrorList([smart_unicode(msg) for msg in message]) else:

Re: Question about {% url %}

2007-07-29 Thread Malcolm Tredinnick
On Sun, 2007-07-29 at 06:55 +, ZhangshenPeng wrote: > when you use url pattern [a-z]+ and named it , then use in {% url > %} ,everything is all right . > when I change > [a-z]+ > into > (title|attachment|date) > django report error "unbalanced parenthesis". > how to fix my code to do the

Question about {% url %}

2007-07-29 Thread ZhangshenPeng
when you use url pattern [a-z]+ and named it , then use in {% url %} ,everything is all right . when I change [a-z]+ into (title|attachment|date) django report error "unbalanced parenthesis". how to fix my code to do the right thing ? think code as below