Re: Using a dynamically created ImageField filename prior to save?

2009-07-02 Thread Andrew Turner
2009/7/1 Rajesh D : > Judging by the discussions on the above mentioned ticket, it may be a > while before this behaviour is reverted back (if it is reverted back > at all.) I'm not seeking to have the new behaviour reversed - if the powers that be say the new way is more robust, I'm happy to go

Learning curve toward build reasonable webpage for a newbie

2009-07-02 Thread Developer_for_food
You may have heard my question over and over again, which is a typical question for someone deciding whether to jump into the water. (My background for web development: I wrote HTML/PHP code once (which was a simple website), and those PHP codes were mainly Mysql access logic, so I have to say th

Using Django other-than as web framework.

2009-07-02 Thread Harsha Reddy
I using Django from past one week. On the Django web site, I read that it is a high-level python web framework. Inspite of knowing this I am trying to use a Django application both as a web application as well as a CLI client. To know if this works out, I created a Django project named "pyMyApp"

DB Design - One to Many

2009-07-02 Thread NC
I am trying to create a customer database app and the model is as follows.. # Create your models here. class Customer(models.Model): name = models.CharField(max_length=40) address = models.CharField(max_length=100) city = models.CharField(max_length=20) state = mo

Re: Learning curve toward build reasonable webpage for a newbie

2009-07-02 Thread patrickk
IMHO, you´re mixing things up here. django helps you with the structure of your app, the database access/ retrieval, the _logic_ of your application. this has nothing to do with UI design. django neither limits nor helps you with actually _designing_ your so-called frontend. that said, django ha

Re: Using Django other-than as web framework.

2009-07-02 Thread jon michaels
What do you get when you type 'python manage.py dbshell'? On Thu, Jul 2, 2009 at 10:25 AM, Harsha Reddy wrote: > > I using Django from past one week. > > On the Django web site, I read that it is a high-level python web > framework. Inspite of knowing this I am trying to use a Django > applicati

Re: Using Django other-than as web framework.

2009-07-02 Thread Daniel Roseman
On Jul 2, 8:25 am, Harsha Reddy wrote: > I using Django from past one week. > > On the Django web site, I read that it is a high-level python web > framework. Inspite of knowing this I am trying to use a Django > application both as a web application as well as a CLI client. > > To know if this w

Re: DB Design - One to Many

2009-07-02 Thread Daniel Roseman
On Jul 2, 8:26 am, NC wrote: > I am trying to create a customer database app and the model is as > follows.. > > # Create your models here. > > class Customer(models.Model): >         name = models.CharField(max_length=40) >         address = models.CharField(max_length=100) >         city = mode

Re: change field value before valid of admin

2009-07-02 Thread Rodrigue
If you're creating your objects through forms, the clean() method on your form may even be a better place for that: http://docs.djangoproject.com/en/dev/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other Rodrigue On Jul 1, 10:58 am, Kenneth Gonsalves wrote: > On We

how to make field in admin edit view sortable

2009-07-02 Thread Joru
I have following class class ProfileAdmin(UserAdmin): list_display = ('username', 'email', 'first_name', 'last_name', 'is_staff', 'last_login', 'date_joined', 'city') def city (self,val): return str(val.profile.city) I need city to be sortable How can I do that? --~--~-~-

How to build query

2009-07-02 Thread Thomas Bechtold
Hi, i use the django auth framework and have the following model: class Sensor(models.Model): """ auth_group = models.ForeignKey('auth.Group') identifier = models.CharField(help_text='identifier of the sensor', max_length=30, db_index=True) comment = models.TextField(help_text='

Re: django memcached errors

2009-07-02 Thread Tom Evans
On Wed, 2009-07-01 at 18:38 -0400, Aaron Lee wrote: > Lately I have been seeing the following errors from memcached > > > [fa...@1246486554.949771] mcm_get_line():1542: memcache(4) protocol > error: no \r before \n > [fa...@1246486554.949771] mcm_get_line():1542: memcache(4) protocol > error: no

best practice to have a list of mixed objects

2009-07-02 Thread Bastien
Hello, I am trying to have a list of various types of objects, for example a list mixed with users' profile, users' photo... to try to order all these elements together by the amount of votes they received. I use the list() function to store each query in a different variable and then I extend()

Re: Using Django other-than as web framework.

2009-07-02 Thread Emily Rodgers
On Jul 2, 8:25 am, Harsha Reddy wrote: > I using Django from past one week. > > On the Django web site, I read that it is a high-level python web > framework. Inspite of knowing this I am trying to use a Django > application both as a web application as well as a CLI client. > > To know if this w

Re: best practice to have a list of mixed objects

2009-07-02 Thread Jarek Zgoda
Wiadomość napisana w dniu 2009-07-02, o godz. 12:45, przez Bastien: > I am trying to have a list of various types of objects, for example a > list mixed with users' profile, users' photo... to try to order all > these elements together by the amount of votes they received. > > I use the list() fu

Re: best practice to have a list of mixed objects

2009-07-02 Thread Bastien
thanks I didn't know about that one, I'll give it a try! On Jul 2, 12:57 pm, Jarek Zgoda wrote: > Wiadomość napisana w dniu 2009-07-02, o godz. 12:45, przez Bastien: > > > I am trying to have a list of various types of objects, for example a > > list mixed with users' profile, users' photo... to

Re: Using a dynamically created ImageField filename prior to save?

2009-07-02 Thread Andrew Turner
2009/7/2 Andrew Turner : > Would it be possible to define the hashed filename in the save method, > and then pass it to the upload_to argument of the ImageField? In answer to my own question, this seems to work:- def get_path(instance, name): return instance._my_filename class Photo(models.M

Re: Using Django other-than as web framework.

2009-07-02 Thread geert
Without quite knowing the details of your particular project, I can assert that a django app will happily double as a cli app. In fact, I do this almost all the time. The only thing you are now missing is the proper way to import the settings. Try something like this from django.core.management

Re: Using a dynamically created ImageField filename prior to save?

2009-07-02 Thread Andrew Turner
2009/7/2 Andrew Turner : > 2009/7/2 Andrew Turner : >> Would it be possible to define the hashed filename in the save method, >> and then pass it to the upload_to argument of the ImageField? > > In answer to my own question, this seems to work:- > > def get_path(instance, name): >   return instanc

Re: Using a dynamically created ImageField filename prior to save?

2009-07-02 Thread Andrew Turner
On Jul 2, 12:29 pm, Andrew Turner wrote: > Talking to myself again, I've changed the save method slightly:- > >     def save(self): >         if not self.slug: >             name = hashlib.sha1(str(random.random())).hexdigest()[:16] >             self._my_filename = '%s.jpg' % (name) >          

Re: Using Django other-than as web framework.

2009-07-02 Thread Harsha Reddy
after setting the var: export DJANGO_SETTINGS_MODULE=pyMyApp.settings it works!! Thanks a lot! On Jul 2, 1:25 pm, Daniel Roseman wrote: > On Jul 2, 8:25 am, Harsha Reddy wrote: > > > > > I using Django from past one week. > > > On the Django web site, I read that it is a high-level python web

Django and chat

2009-07-02 Thread Ivan Uemlianin
Dear All I am looking into using or developing a chat application for Django, for use in a social networking website based on the Pinax Django "distribution". I have searched for django-based chat applications and found very little. Below I list briefly what I've found. Please could anyone let

Re: file extensions for templates

2009-07-02 Thread David De La Harpe Golden
Rajesh D wrote: > Right. > > http://docs.djangoproject.com/en/dev/ref/templates/api/#the-template-dirs-setting > > Quote: They can have any extension you want, such as .html or .txt, or > they can have no extension at all. > Ah, thanks. (add-to-list 'auto-mode-alist '("\\.html\\.djt\\'" .

Re: Using Django other-than as web framework.

2009-07-02 Thread Harsha Reddy
Give Mysql prompt: python manage.py dbshell Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8255 to server version: 5.0.22 Type

Re: Display Data From Multiple Tables

2009-07-02 Thread Alex Robbins
You should take a look at select_related[1]. It will take the lot of queries TiNo was talking about and flatten it down to one big one. [1] http://docs.djangoproject.com/en/dev/ref/models/querysets/#id4 Hope that helps, Alex On Jul 1, 1:34 pm, TiNo wrote: > On Wed, Jul 1, 2009 at 16:59, The Da

Incomplete file save of models.FileField.save

2009-07-02 Thread masterclock
I'm using python2.6 and django 1.0.2 class MyModel(Model): file = models.FileField(...) ... mymodel = MyModel(...) mymodel.file.save(...) but the saved file is truncated. when I use admin, the uploaded file is also incomplete. could anyone give me a reason. --~--~-~--~~-

Freelancers in Bristol UK July/August 09

2009-07-02 Thread sleepyjames
Were looking for freelance developers preferably in the Bristol area (but not essential) for a number of projects over July/August 09. Requirements: Html/css Django 1.1 (svn) Happy with Subversion Please send examples/urls/rates to: j...@dropp.co.uk --~--~-~--~~~---

Re: How to write to the history

2009-07-02 Thread mettwoch
Thanks a lot! Marc On Jul 1, 9:46 pm, Rajesh D wrote: > On Jul 1, 12:10 pm, mettwoch wrote: > > > Hi group, > > > What would be a good way to log changes made to models from outside > > the admin interface? > > Look at the log_* methods in the Admin > implementation:http://code.djangoproject.

Admin page set up.

2009-07-02 Thread kamal sharma
Hi, I am trying to setup admin page. Django version: alpha version of 1.1 Python Version: Python 2.5.2 I have followed the following steps to set up admin page. http://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-admin 1. settings.py: # Add 'django.contrib.admin' to INSTALLED_

Re: Freelancers in Bristol UK July/August 09

2009-07-02 Thread Daniel Hilton
2009/7/2 sleepyjames > > Were looking for freelance developers preferably in the Bristol area > (but not essential) for a number of projects over July/August 09. > > Requirements: > Html/css > Django 1.1 (svn) > Happy with Subversion > > Please send examples/urls/rates to: > j...@dropp.co.uk Yo

Re: PyDev users: how do you manage tabs?

2009-07-02 Thread Chris Lawlor
Wayne I can't thank you enough!! As the author notes, the posted code is not cross-platform. I incorporated the fix recommended in the comments and posted here for anyone else that might want it: http://dpaste.com/hold/62468/ works fine on my windows machine, haven't tested on my Linux dev box y

Re: Display Data From Multiple Tables

2009-07-02 Thread Daniel Roseman
On Jul 2, 3:20 pm, The Danny Bos wrote: > Daniel, > > {% for author in review.item.author_set.all %} > Is what I've been using. > Aargh, copy and paste fail. Should have been {% for author in review.item.authors.all %} -- DR. --~--~-~--~~~---~--~~ You received this

Re: Display Data From Multiple Tables

2009-07-02 Thread The Danny Bos
DR. Bingo!! Thanks man, And thanks for the tip on "_set" being for ForeignKeys. d On Jul 3, 12:23 am, Daniel Roseman wrote: > On Jul 2, 3:20 pm, The Danny Bos wrote:> Daniel, > > > {% for author in review.item.author_set.all %} > > Is what I've been using. > > Aargh, copy and paste fail. S

Re: Display Data From Multiple Tables

2009-07-02 Thread The Danny Bos
Daniel, {% for author in review.item.author_set.all %} Is what I've been using. TINo, no errors at all, it just doesn't display. Agreed it is a ManyToMany type. Am thinking perhaps a ForeignKey type may work just fine. Any reason you guys can think of that an Author field should be a ManyToMany?

Drag and drop re-ordering in change_list causing 'too many files open' error.

2009-07-02 Thread Josh
I've used jQuery to set up drag and drop re-ordering on the change_list for a model. Basically I created a custom change_list template for the model to add a submit button to the object_tools list and to add some javascript includes. I also created my own modified version of the django.contrib.adm

Re: Admin page set up.

2009-07-02 Thread patrickk
you have defined it in urls.py ... with (r'^admin/(.*)', admin.site.root), your URL is http://server-name:1020/admin/ after adding 'django.contrib.admin' to your INSTALLED_APPS you have sync the database, of course: python mangage.py syncdb regards, patrick On 2 Jul., 15:13, kamal sharma wrot

Re: Display Data From Multiple Tables

2009-07-02 Thread TiNo
> > TINo, no errors at all, it just doesn't display. Wat doesn't display? The publisher name? The authors? > > Agreed it is a ManyToMany type. Am thinking perhaps a ForeignKey type > may work just fine. Any reason you guys can think of that an Author > field should be a ManyToMany? > Depends.

Re: Display Data From Multiple Tables

2009-07-02 Thread The Danny Bos
K, I think I have it. Just having trouble getting the Author loop from within my Review set. Here's what I have below, I figured this was pretty close but I'm wrong aren't I? {% for review in reviews_full %} {{ review.item.title }} {{ review.item.publisher

Re: Display Data From Multiple Tables

2009-07-02 Thread TiNo
On Thu, Jul 2, 2009 at 15:55, The Danny Bos wrote: > Just having trouble getting the Author loop from within my Review > set. > Here's what I have below, I figured this was pretty close but I'm > wrong aren't I? Does it give you any errors? >{% for review in reviews_full %} >

Re: Display Data From Multiple Tables

2009-07-02 Thread Daniel Roseman
On Jul 2, 2:55 pm, The Danny Bos wrote: > K, I think I have it. > > Just having trouble getting the Author loop from within my Review > set. > Here's what I have below, I figured this was pretty close but I'm > wrong aren't I? > >         {% for review in reviews_full %} >                 {{ revi

Re: Admin page set up.

2009-07-02 Thread kamal sharma
Hi Patrick, I am using apache web server. After doing following changes I tried to access this URL http://server-name:1020/admin/ and got following error. The requested URL /admin/ was not found on this server Thanks, Pankaj On Thu, Jul 2, 2009 at 8:00 PM, patrickk wrote: > > you have define

Django-rest-interface - querying data

2009-07-02 Thread Matt
Hi all, I've started to use the django-rest-interface to build an API for a service that I'm working on. Principally all that's required is for a client to be able to create and update objects remotely via POST and PUT, but as this is the first REST interface I've built I'm trying to explore all

Re: Admin page set up.

2009-07-02 Thread patrickk
sorry, but I can´t help with apache-stuff. your django-setup seems correct to me ... I´ve never seen port 1020 used for the dev-server, but I´m not doing server-setups at all, so it might be very common. you could try a simple direct_to_template in order to check whether (or not) apache is servin

Re: Admin page set up.

2009-07-02 Thread kamal sharma
Thanks Patrick for your quick response. Please let me know if this info helps you to understand. I am calling my project 'gweb' and my app 'web'? And my model code is in file in 'gweb/web/models.py'. So in that case my admin url should be http://server-name:1020/gweb/admin/ Please correct if I

Re: Admin page set up.

2009-07-02 Thread patrickk
your admin-url has NO relation whatsoever to the name of your project or app. IMHO, you should try to understand how the url-configuration works in the first place. you should also read the django-docs carefully ... I´m sorry that I can´t help more, but I think with reading (and understanding) t

Re: Admin page set up.

2009-07-02 Thread kamal sharma
Actually I was reading from this link and doing what it is mentioned here. http://www.djangobook.com/en/1.0/chapter06/ Do we have other better doc for admin page set up? On Thu, Jul 2, 2009 at 9:19 PM, patrickk wrote: > > your admin-url has NO relation whatsoever to the name of your project

Problems saving model objects

2009-07-02 Thread Michael Stevens
Hi. I've defined a model object (with a number of DecimalFields), and I can load it happily, but when I take a freshly loaded instance and call .save(), I get the error: TypeError: Cannot convert float to Decimal. First convert the float to a string I suspect this is because for some reason dj

Re: Problems saving model objects

2009-07-02 Thread Shawn Milochik
Would you post the model and the relevant parts of the form and/or view? In any case, you can easily fix it by following the error message's suggestion of str(your_float). But if you think there's a discrepancy between the way your fields are behaving, post some code and we'll see if we can

Re: Getting the name of a matched URL pattern

2009-07-02 Thread Shawn Milochik
On Jul 1, 2009, at 9:56 PM, Nick Fishman wrote: > > Hey everyone, > > I'm working with Django's named URL patterns, and was wondering how to > fetch the name of the URL pattern that triggered the view. For > example, with the following urlpatterns > > urlpatterns = patterns('', >url(r'^archi

Keep session data between user switches

2009-07-02 Thread mettwoch
Hi, I write a POS application and several users share the same terminal. They use a barcode scanner to point to their badge to login (works already). I'd like to keep the session data for every user so that when user A leaves the terminal and user B makes an invoice and user A comes back to the t

django admin - inline to FK (which has a M2M to something else) throws error

2009-07-02 Thread Xiong Chiamiov
Here are my three models: class Faculty(models.Model): [standard attributes] class WorkDay(models.Model): [standard attributes] class OfficeHour(models.Model): faculty = models.ForeignKey(Faculty) day_of_week = models.ManyToManyField(WorkDay) and in admin.py: class OfficeHourInl

Re: Django and chat

2009-07-02 Thread Xiong Chiamiov
On Jul 2, 3:53 am, Ivan Uemlianin wrote: > Dear All > > I am looking into using or developing a chat application for Django, > for use in a social networking website based on the Pinax Django > "distribution". > > I have searched for django-based chat applications and found very > little.  Below

Re: Problems saving model objects

2009-07-02 Thread Michael Stevens
I think I've worked it out now. I'd defined the field wrong (didn't match database type). It loaded fine, but when I tried to save the same data django rejected it. 2009/7/2 Shawn Milochik : > > Would you post the model and the relevant parts of the form and/or view? > > In any case, you can easi

Re: Tracking a bad import

2009-07-02 Thread Xiong Chiamiov
On Jul 1, 9:15 pm, Chhouk Voeun wrote: > i want to use map url (http:\\localhost:8080\main).oh i use window Did you read the tutorial? None of your url regexes look anything like /main/. And why did you hijack someone else's thread that was about a completely different topic? --~--~-~-

Re: Admin page set up.

2009-07-02 Thread patrickk
I´d recommend this (obviously): http://docs.djangoproject.com/en/dev/ref/contrib/admin/ regards, patrick On 2 Jul., 18:01, kamal sharma wrote: > Actually I was reading from this link and doing what it is mentioned here. > > http://www.djangobook.com/en/1.0/chapter06/ > > Do we have other bette

Reusable Contact Form include error?

2009-07-02 Thread 10000angrycats
Hi everyone, long time lurker, first time botherer. I hope someone here can help me out (& possibly a few other Django n00bs in the future too). I've dug around as best I can but can't find a - probably simple - solution to an issue I'm having. I've created a simple contact form as described her

Re: Keep session data between user switches

2009-07-02 Thread Xiong Chiamiov
On Jul 2, 9:18 am, mettwoch wrote: > Hi, > > I write a POS application and several users share the same terminal. > They use a barcode scanner to point to their badge to login (works > already). I'd like to keep the session data for every user so that > when user A leaves the terminal and user B

Re: Incomplete file save of models.FileField.save

2009-07-02 Thread Xiong Chiamiov
On Jul 2, 5:31 am, masterclock wrote: > I'm using python2.6 and django 1.0.2 > > class MyModel(Model): >     file = models.FileField(...) >     ... > > mymodel = MyModel(...) > > mymodel.file.save(...) > > but the saved file is truncated. > > when I use admin, the uploaded file is also incomplete

Re: Drag and drop re-ordering in change_list causing 'too many files open' error.

2009-07-02 Thread Josh
The gist has been updated to have all the involved files rather than just the jQuery code and the view. http://gist.github.com/139475 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to th

Re: Keep session data between user switches

2009-07-02 Thread Rajesh D
On Jul 2, 12:18 pm, mettwoch wrote: > Hi, > > I write a POS application and several users share the same terminal. > They use a barcode scanner to point to their badge to login (works > already). I'd like to keep the session data for every user so that > when user A leaves the terminal and user

Re: Reusable Contact Form include error?

2009-07-02 Thread Rajesh D
On Jul 2, 12:35 pm, 1angrycats wrote: > Hi everyone, long time lurker, first time botherer. > > I hope someone here can help me out (& possibly a few other Django > n00bs in the future too). > > I've dug around as best I can but can't find a - probably simple - > solution to an issue I'm ha

Re: Admin page set up.

2009-07-02 Thread Divesh Gidwani
Kamal, This is of the django project website. I was having similar difficulties when I typed it up, but if copy and paste from this, and then match it to your code, you will see minor flaws (from my experience.) Hope this helps best, Divesh On Jul 2, 12:45 pm, patrickk wrote: > I´d recommend

Re: Reusable Contact Form include error?

2009-07-02 Thread Reiner
That might be trivial, but you didn't show more views, so - do you add a form instance to the template context in every view? On Jul 2, 6:35 pm, 1angrycats wrote: > Hi everyone, long time lurker, first time botherer. > > I hope someone here can help me out (& possibly a few other Django > n0

Re: Django-rest-interface - querying data

2009-07-02 Thread Rajesh D
On Jul 2, 11:03 am, Matt wrote: > Hi all, > > I've started to use the django-rest-interface to build an API for a > service that I'm working on. Principally all that's required is for a > client to be able to create and update objects remotely via POST and > PUT, but as this is the first REST i

'MediaDefiningClass' object is not iterableRequest Method

2009-07-02 Thread jayvandal
Hi, I get this error but don't understand what it means TypeError at / 'MediaDefiningClass' object is not iterableRequest Method: GET Request URL: http://localhost:8000/ Exception Type: TypeError Exception Value: 'MediaDefiningClass' object is not iterable

Invoke Django admin list filter

2009-07-02 Thread jai_python
Hi Friends. Can any one help me to implement or invoke Django default admin list filter in our own application. Thanks in advance, Jayapal D --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To po

Re: 'MediaDefiningClass' object is not iterableRequest Method

2009-07-02 Thread Alex Gaynor
On Thu, Jul 2, 2009 at 12:43 PM, jayvandal wrote: > > Hi, > I get this error but don't understand what it means > > TypeError at / > 'MediaDefiningClass' object is not iterableRequest Method: GET > Request URL: http://localhost:8000/ > Exception Type: Type

Re: Invoke Django admin list filter

2009-07-02 Thread Alex Gaynor
On Thu, Jul 2, 2009 at 12:54 PM, jai_python wrote: > > Hi Friends. Can any one help me to implement or invoke Django default > admin list filter in our own application. > > Thanks in advance, > Jayapal D > > > I've written a reusable Django application that's designed for building iterfaces simil

FileField/ImageField and the sites framework

2009-07-02 Thread smcoll
i have a project running multiple sites. One of the apps in the project has a model with a FileField and an M2M to `Site`. Since each site has its own MEDIA_ROOT, a model instance saved from SiteA (publishing on both SiteA and SiteB) can only display the file from SiteA, because the file only e

Re: Django + user profile admin inlines = breakage

2009-07-02 Thread hagan
Ah, got this working It helps to put admin stuff in the admin.py file. I was doing to much in the models.py file and after spending a moment to separate admin/model/forms everything started to work magically... Possibly because I added "admin.autodiscover()" --~--~-~--~~--

Best way to handle HEAD method

2009-07-02 Thread Andrew Fong
How exactly should I handle a HEAD request in Django? So ... assuming my view looks like this... def handle_request(request): if request.method == 'POST': return do_post(request) elif request.method == 'GET': return do_get(request) elif request.method == 'HEAD': return do_head(reques

Re: Tracking a bad import

2009-07-02 Thread Andrew Fong
Ignoring thread hijacking there and responding to the OP. The next time you have an import error, try using the -v option, like this: python -v manage.py syncdb That'll print every module being imported as it's being imported -- it might help identify what's missing. Alternatively, use pdb (htt

Using the test client API for integration tests?

2009-07-02 Thread Yoz Grahame
At my company we're already successfully using the test client API for our unit tests. However, we'd like to use those same tests for integration tests in staging - i.e. making full HTTP calls over sockets through our full LB + Apache + mod_wsgi setup. Does anyone know of a client lib that expose

Translation question : some strings not translated

2009-07-02 Thread François Verbeek
Hi, I've been struggling with this for a while now... Calling for help.. I believe I'm doing something stupid : here is a view : def display_vak_teacher(request,**kwargs): ( skip skip skip) slogan=ugettext_lazy("Welcome to the page of the %(subj)s class of %(fn)s %(ln)s" % {

Re: Using the test client API for integration tests?

2009-07-02 Thread Alex Gaynor
On Thu, Jul 2, 2009 at 2:17 PM, Yoz Grahame wrote: > > At my company we're already successfully using the test client API for > our unit tests. However, we'd like to use those same tests for > integration tests in staging - i.e. making full HTTP calls over > sockets through our full LB + Apache +

Re: 'MediaDefiningClass' object is not iterableRequest Method

2009-07-02 Thread jayvandal
Is this what You mean?? TypeError at / 'MediaDefiningClass' object is not iterableRequest Method: GET Request URL: http://localhost:8000/ Exception Type: TypeError Exception Value: 'MediaDefiningClass' object is not iterable Exception Location: C:\Python26\lib\site-packages\django\contrib\admin

Re: FileField/ImageField and the sites framework

2009-07-02 Thread Andrew Fong
Need more data here. This ventures from strictly Django into deployment setups. Why exactly can't you just use a common MEDIA_ROOT? Are your sites on different boxes? -- Andrew On Jul 2, 2:19 pm, smcoll wrote: > i have a project running multiple sites.   One of the apps in the > project has a m

Re: Display Data From Multiple Tables

2009-07-02 Thread AmanKow
On Jul 2, 10:25 am, The Danny Bos wrote: > DR. > Bingo!! > > Thanks man, > And thanks for the tip on "_set" being for ForeignKeys. > > d > > On Jul 3, 12:23 am, Daniel Roseman wrote: > > > On Jul 2, 3:20 pm, The Danny Bos wrote:> Daniel, > > > > {% for author in review.item.author_set.all %} >

Re: Using the test client API for integration tests?

2009-07-02 Thread Yoz Grahame
On Jul 2, 12:22 pm, Alex Gaynor wrote: > On Thu, Jul 2, 2009 at 2:17 PM, Yoz Grahame wrote: > > Check out httplib2, it's the most popular library for making HTTP requests > in Python (there are like 3 seperate modules in the stdlib you can use for > it also, urllib, urllib2, and httplib, but I

Re: FileField/ImageField and the sites framework

2009-07-02 Thread shannon
Sites are on the same box. Really, i'm just trying to make a proof of concept: each site is just a settings file, media directory, and templates directory. They all share a database. i could use a common MEDIA_ROOT, but just didn't want to. Is there a way to have a secondary media location and

Re: Translation question : some strings not translated

2009-07-02 Thread François Verbeek
Mmm to make the problem easier to deal with I wrote a very very small app with just 1 view and a very basic template : from django.http import HttpResponse from django.utils.translation import ugettext as _ from django.shortcuts import render_to_response,get_object_or_404 def display_a_string_th

Re: Translation question : some strings not translated

2009-07-02 Thread Gabriel .
2009/7/2 François Verbeek : uest,**kwargs): >      data=kwargs.get("argument","nothing") >      string=_("Hi, there %(wee)s" % {'wee':data}) >      template="renderit.html" Use: _("Hi, there %(wee)s") % {'wee':data} -- Kind Regards --~--~-~--~~~---~--~~ You re

Re: Translation question : some strings not translated

2009-07-02 Thread Matthias Kestenholz
Hi, 2009/7/2 François Verbeek : > Mmm to make the problem easier to deal with I wrote a very very small > app with just 1 view and a very basic template : > from django.http import HttpResponse > from django.utils.translation import ugettext as _ > from django.shortcuts import render_to_response,

Re: Translation question : some strings not translated

2009-07-02 Thread François Verbeek
That's it! I guess I didn't wonder because I didn't get any error back, but it makes sense. Thank you ! François On 2 Jul 2009, at 21:39, Matthias Kestenholz wrote: > > Hi, > > 2009/7/2 François Verbeek : >> Mmm to make the problem easier to deal with I wrote a very very small >> app with jus

Inline Formset Validation

2009-07-02 Thread KRH
A question on forms; I had asked something similar on StackOverflow but found the solution didn't really work for me. Let's say I have an Article class and a Photo class, and I want to be able to attach Photos to Articles. I create an ArticlePhotoSet class, and make it an InlineForm in the Article

"django-notification" app installation

2009-07-02 Thread Anthony
Hi, I'm having trouble installing this application (got if from github: http://github.com/jtauber/django-notification/tree/master). I ran "python setup.py install", but I don't see a "notification" folder in the "site-packages" directory. I do see a ".egg" directory however. >From the shell,

Re: Best way to handle HEAD method

2009-07-02 Thread Daniel Roseman
On Jul 2, 7:55 pm, Andrew Fong wrote: > How exactly should I handle a HEAD request in Django? > > So ... assuming my view looks like this... > > def handle_request(request): >     if request.method == 'POST': return do_post(request) >     elif request.method == 'GET': return do_get(request) >    

How does admin generate HTML for adding objects?

2009-07-02 Thread Technicalbard
I'm curious how the admin creates the templates for any object in the database... I'm using the object_detail generic view, but would prefer having Django use the parameters of the object to generate the template, rather than me having to hardcode the parameter names into the template. The admin

Global custom tags

2009-07-02 Thread diogobaeder
Hi there, Is there a way to create a custom tag that can be used in different applications at the same time, so that I could make the call on the "base.html" template? The custom tag, here, is a blog subjects menu, which I want to use in all the pages (all the apps) of the website, in the fronten

URL Dispatcher with optional "parameters"

2009-07-02 Thread Agony
Hello, I am trying to create a view that has a lot of optional parameters, each of these should be able to left out of not according to the situation so for example: /article/(title) -- shows the abriged article /article/(title)/revision/(revision_id) -- shows the given revision of the article /

ChoiceField, TypedChoiceField, ModelChoiceField and empty_label

2009-07-02 Thread ristretto.rb
Hello, I have stepped through code, and cruised the django docs, forums, and internet in general looking for how to setup an empty label with TypedChoiceField (or ChoiceField.) I suspected it would be done similar to the way it is done with ModelChoiceField. With ModelChoiceField, we can specif

Managing settings.py from admin site

2009-07-02 Thread Julián C . Pérez
Hi everyone I have a doubt... Is it possible to edit or customize -not delete- variables created in settings.py from the admin site of my application?? I mean, in order to control the whole site from web interface instead of manually editing settings.py I hope I made myself clear... Any idea?? Tha

Re: Best way to handle HEAD method

2009-07-02 Thread Graham Dumpleton
On Jul 3, 4:55 am, Andrew Fong wrote: > How exactly should I handle a HEAD request in Django? > > So ... assuming my view looks like this... > > def handle_request(request): >     if request.method == 'POST': return do_post(request) >     elif request.method == 'GET': return do_get(request) >  

Re: Managing settings.py from admin site

2009-07-02 Thread Graham Dumpleton
On Jul 3, 9:11 am, Julián C. Pérez wrote: > Hi everyone > I have a doubt... > Is it possible to edit or customize -not delete- variables created in > settings.py from the admin site of my application?? > I mean, in order to control the whole site from web interface instead > of manually editing

Re: Incomplete file save of models.FileField.save

2009-07-02 Thread masterclock
All files are truncated regargless of its size or file type. and, each file is truncated to a certain size. this happens even I don't use a server. I tried saving a file in "manage.py shell" from local disk to local disk, but it is still incomplete. > > Are all files truncated?  Are they trunca

Re: Global custom tags

2009-07-02 Thread Jonathan Buchanan
On Thu, Jul 2, 2009 at 10:55 PM, diogobaeder wrote: > > Hi there, > > Is there a way to create a custom tag that can be used in different > applications at the same time, so that I could make the call on the > "base.html" template? The custom tag, here, is a blog subjects menu, > which I > want to

Re: Getting the name of a matched URL pattern

2009-07-02 Thread Nick Fishman
> > Hi, > > I came across a similar problem when trying to put together my app for > handling menus (since I wanted to be able to specify menu items by url > names).  Anyway the following was the method I finally came up with > which seems to work just fine for me - > http://code.google.com/p/grea

Re: Global custom tags

2009-07-02 Thread diogobaeder
But where do I put the custom template, than? If I load it from an app template, I must create it under /templatetags/, and what if I want to call it from the base template? /templatetags/? Thanks! Diogo On Jul 2, 9:23 pm, Jonathan Buchanan wrote: > On Thu, Jul 2, 2009 at 10:55 PM, diogobaed

Invalid syntax when place QuerySet to a new value

2009-07-02 Thread Xuqing Kuang
Hi, all. I want to generate a report of my job status in somedays, so I make a QuerySet like following: # Generate query set jobs = Job.list(request.REQUEST) #today_jobs = jobs.filter(started_time__gte = date.fromtimestamp (time.time())) 7days_jobs = jobs.fi

Re: Invalid syntax when place QuerySet to a new value

2009-07-02 Thread Alex Gaynor
On Thu, Jul 2, 2009 at 10:43 PM, Xuqing Kuang wrote: > > Hi, all. > > I want to generate a report of my job status in somedays, so I make a > QuerySet like following: > > > # Generate query set > jobs = Job.list(request.REQUEST) > > #today_jobs = jobs.filter(s

  1   2   >