Re: I18n when using standalone templates

2009-01-02 Thread Malcolm Tredinnick
On Mon, 2008-12-22 at 23:09 -0800, Iwan wrote: > Malcolm, > > On Dec 23, 2:00 am, Malcolm Tredinnick <malc...@pointy-stick.com> > wrote: > > You can do it this way: > > > > from django.utils import translation > > > > tr

Re: how do i change the requiredness of fields in modelform?

2009-01-02 Thread Malcolm Tredinnick
On Wed, 2008-12-24 at 09:42 -0800, JeeyoungKim wrote: > I have the following form: > > class UserInfoForm(forms.ModelForm): > password_field = forms.CharField(label='Password', > widget=forms.PasswordInput(render_value=False) > password_repeat_field =

Re: Putting external web service accesses into models.py?

2009-01-02 Thread Malcolm Tredinnick
On Wed, 2008-12-24 at 20:41 -0800, Jeff Hammerbacher wrote: > Hey, > > I'm building a web applications that pulls all of its data from an > external web service rather than from a managed database. The > documentation for the model layer in Django seems to assume you're > retrieving application

Re: Django form HTML is rendered as TEXT

2009-01-02 Thread Malcolm Tredinnick
On Sat, 2008-12-27 at 01:27 +0800, shreyas k wrote: > Hi Eric > Thanks a lot .i wraped the template in the autoescape tag, Now its working > fine That's a bad idea. You've gone out of your way to remove a very useful security mechanism. It's going to be much better to learn what autoescaping is

Re: Overrding queryset on a field in form generated with ModelForm

2009-01-02 Thread Malcolm Tredinnick
On Fri, 2008-12-26 at 23:13 -0800, Tony Chu wrote: > Thank you very much Malcolm. The methods I listed above has worked for > me so far - so your response is reassuring. > > I was just surprised that no one had encountered a similar need > already. The concept here is parallel to getting a list

Re: django + rest

2009-01-02 Thread Malcolm Tredinnick
On Mon, 2008-12-29 at 18:06 -0800, Ed Summers wrote: > (my apologies if you already saw this question on django-developers, > I'm reposting here because it's more a users question) > > I was wondering if anyone else on the list has layered a RESTful > service into their django applications. I'm

Re: Inheritance question

2009-01-02 Thread Malcolm Tredinnick
On Fri, 2009-01-02 at 16:29 -0800, carlopires wrote: > Hi, > > I'm trying Multi Table Inheritance with: > > class Person(models.Model): >name = CharField(max_length=30) > > class Student(Person): >course = CharField(max_length=30) > > on db shell: > > p = Person(name='Carlo') >

Re: Problems with send_mail and the string formatting operator

2009-01-03 Thread Malcolm Tredinnick
On Sat, 2009-01-03 at 17:48 -0800, OwenK wrote: > I have a simple function for sending activation emails to new users, > but it always raises a ValueError of "unsupported format character > '/' (0x2f) at index 51". You can see the function at http://dpaste.com/105078/ > . the newuser argument is

Re: I would like to report a bug but I can't log in

2009-01-03 Thread Malcolm Tredinnick
On Sat, 2009-01-03 at 22:03 -0800, Friendless wrote: > On Jan 4, 2:42 pm, "Karen Tracey" wrote: > > I'll admit your tone here is starting to make me lose interest in your > > problem report. > > Admit it, you weren't very interested in the first place. You've given > me all

Re: When to use each of these approaches ?

2009-01-04 Thread Malcolm Tredinnick
On Sun, 2009-01-04 at 01:01 -0800, HB wrote: > Hey, > What is the difference between: > query = request.GET.get('q', '') > and > (r'^time/plus/(\d{1,2})/$', hours_ahead) > And when to use each approach? > Thanks guys. > #I'm new to Django, forgive my simple questions :) GET parameters (the first

Re: Link on static HMTL not clickable

2009-01-04 Thread Malcolm Tredinnick
On Sun, 2009-01-04 at 01:39 -0800, SG_Muse wrote: > Anyone? Clearly not. I really hesitate to give a response to such an email, since if somebody had an answer, they would have posted it. Jumping up and down and saying "me, me, answer my question" is a bit inconsiderate of volunteers time,

Re: Middleware, exceptions and POST

2009-01-04 Thread Malcolm Tredinnick
On Sun, 2009-01-04 at 12:03 +0200, Roman Odaisky wrote: > Hi everyone, > > I have a (technical) problem with middleware, and also I’d be grateful to > hear > some suggestions about the general workflow. Doubtless all of you are > familiar with a topic as simple as POST handling, and maybe

Re: Sort by foreignkey values

2009-01-04 Thread Malcolm Tredinnick
On Sun, 2009-01-04 at 20:14 -0800, Daniel Roseman wrote: [...] > I don't know why you say filtering Equipamento based on the value in > Model 'seems to be not possible'. On the contrary, it is perfectly > possible - that's the whole point of a relational database system. You > want something

Re: FileSystemStorage content vs PIL Image

2009-01-04 Thread Malcolm Tredinnick
On Mon, 2009-01-05 at 09:48 +0200, Donn wrote: > On Monday, 05 January 2009 05:15:27 Eric Abrahamsen wrote: > > On second thought, you should probably be writing the img back into > > the original "content" variable (which points to a File object), as > > that object might already have

Re: Why Django doesn't force testing?

2009-01-05 Thread Malcolm Tredinnick
On Mon, 2009-01-05 at 03:27 -0800, HB wrote: > Hey, > One nice thing about JBoss Seam and Rails is they encourage unit > testing from the very beginning. > Django as an agile web framework, why doesn't follow the same > philosophy? Your assumption seems to be mistaken. Djang does encourage

Re: Run sql query as read only user

2009-01-05 Thread Malcolm Tredinnick
On Mon, 2009-01-05 at 11:18 +0100, Matias Surdi wrote: > Hi, > > For some reports, I need to allow the users to enter a sql query.It is > required for this query (a sql SELECT) to be run as a read only database > user. > > > Any idea how to implement this with django? Set the DATABASE_USER

Re: Distinct users ordered by remote field

2009-01-05 Thread Malcolm Tredinnick
On Mon, 2009-01-05 at 04:42 -0800, coan wrote: > I have a model that looks something like this: > > class Collection(models.Model): > user = models.ForeignKey(User) > item = models.ForeignKey(Items) > date = models.DateTimeField() > > I'm trying to retrieve a list of unique users ordered by

Re: django and database views

2009-01-05 Thread Malcolm Tredinnick
On Mon, 2009-01-05 at 06:31 -0800, drakkan wrote: > however if i delete an user with records associated in the view I have > this error: > > NotSupportedError: cannot delete from a view > HINT: You need an unconditional ON DELETE DO INSTEAD rule. > > django try to delete record from the view

Re: django discarding MySQL results for "in" operator

2009-01-05 Thread Malcolm Tredinnick
On Mon, 2009-01-05 at 12:37 -0800, JonUK wrote: [...] > I'm using django 1.0.2 and the tagging app to retrieve a tag via a > database "in" query, and something is causing the query results to be > discarded. > > In particular, this line of code from tagging.utils.get_tag_list() > executes: > >

Re: Does PhoneNumberField for models exist?

2009-01-05 Thread Malcolm Tredinnick
On Mon, 2009-01-05 at 14:33 -0800, DragonSlayre wrote: > http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ > > This lists PhoneNumberField as being a field type, but in the models > documentation, > http://docs.djangoproject.com/en/dev/ref/models/fields/#ref-models-fields > there is

Re: Does PhoneNumberField for models exist?

2009-01-05 Thread Malcolm Tredinnick
On Tue, 2009-01-06 at 10:45 +1100, Malcolm Tredinnick wrote: > On Mon, 2009-01-05 at 14:33 -0800, DragonSlayre wrote: > > http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ > > > > This lists PhoneNumberField as being a field type, but in the models > &g

Re: Shouldn't blank=True imply null=True?

2009-01-05 Thread Malcolm Tredinnick
On Tue, 2009-01-06 at 07:58 +0530, Kenneth Gonsalves wrote: > On Tuesday 06 Jan 2009 12:50:24 am Mike wrote: > > If the type is not a string, and blank=True is set, shouldn't > > null=True be implied? > > no - blank=True is enforced at django level whereas null=True is enforced at > DB level

Re: Shouldn't blank=True imply null=True?

2009-01-05 Thread Malcolm Tredinnick
On Mon, 2009-01-05 at 23:39 -0700, Jeff Anderson wrote: > Malcolm Tredinnick wrote: > > The way to think about this problem is whether there's a situation where > > blank=True, null=False makes sense or is even possible for non-text > > fields and Mike quite possibly has a v

Re: Shouldn't blank=True imply null=True?

2009-01-06 Thread Malcolm Tredinnick
On Tue, 2009-01-06 at 08:03 -0800, dchandek wrote: [...] > The only gotcha I've encountered here is that practically speaking > null=True requires blank=True. That isn't always valid and it's not the direction that's being proposed in this thread. One of the design goals of Django is to work

Re: Circular imports between managers and models

2009-01-06 Thread Malcolm Tredinnick
On Tue, 2009-01-06 at 04:42 -0800, Polat Tuzla wrote: > Hi, > Suppose I have two classes in "models.py", namely A and B. And there > is the manager for B as BManager in "managers.py". BManager makes use > of clas A. > > This situation leads to circular imports between "managers.py" and >

Re: Speeding up the tests, what am I missing?

2009-01-06 Thread Malcolm Tredinnick
On Tue, 2009-01-06 at 14:51 -0500, Todd O'Bryan wrote: [...] > So, what am I missing? I know this doesn't deal with doctests--the db > gets cleaned for all of those, but does anyone see when this is just > going to blow up in my face? For that to work reliably, you would need to deeply know the

Re: OperationalError at /swenglish/ , no such table: swenglish_entry

2009-01-06 Thread Malcolm Tredinnick
On Tue, 2009-01-06 at 11:59 -0800, rabbi wrote: [...] > I want to deploy my little test site though, so I've been trying to > get it running on Apache and I keep getting this error: > "OperationalError at /swenglish/ > no such table: swenglish_entry" > > The error seems to be happening on this

Re: OperationalError at /swenglish/ , no such table: swenglish_entry

2009-01-06 Thread Malcolm Tredinnick
On Tue, 2009-01-06 at 15:12 -0800, rabbi wrote: [...] > i've now got it running on apache/mod_python too, but i had to > hardcode the entire path to the db file in settings.py: >"DATABASE_NAME = 'C:/Documents and Settings/Rabbi/Desktop/Django > Code/mysite/vocab'" > > is this really

Re: OperationalError at /swenglish/ , no such table: swenglish_entry

2009-01-06 Thread Malcolm Tredinnick
On Tue, 2009-01-06 at 15:33 -0800, rabbi wrote: > thanks a lot malcom, that's great advice. > for the record, initially i had "DATABASE_NAME = 'vocab'" > > i have another question; after changing from runserver to apache the > django admin page now looks very ugly... it's lost all formatting etc

Re: OperationalError at /swenglish/ , no such table: swenglish_entry

2009-01-06 Thread Malcolm Tredinnick
On Tue, 2009-01-06 at 16:07 -0800, rabbi wrote: > i was actually already reading that page... but it's 1:00am and maybe > i glazed over it without registering :) > > i've now temporarily fixed my admin page problem by just copying all > files to the apache document root, but later i will need to

Re: Specified key was too long; max key length is 767 bytes

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 20:49 +0530, Rama wrote: > i have a model as below (please follow the red color lines) > > class NewsEntry(models.Model) : > url = models.URLField(max_length=1024,db_index=True) > title = models.CharField(max_length=1024) > > - > thereafter i

Re: subquery has too many columns

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 09:36 -0800, timc3 wrote: [...] > ProgrammingError: subquery has too many columns > > > It seems that this query is creating the problem: > > groupmembers = requestedgroup.group_members.exclude > (id__in=groupadmins) We'll need a bit more information here, since the

Re: Customizing form fields display

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 10:38 -0800, sagi s wrote: > Can anyone suggest a way to customize model field display? Use auxillary functions. Model fields carry no implicit "display" concept with them, since they represent the data object, separate from the presentation. > > For example if I have a

Re: "submit" and urls.py fail after moving site from runserver to Apache

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 11:12 -0800, rabbi wrote: [...] > I have a submit input on one of my pages and when I run the site on > runserver it still works fine (I just tried it now) > However, when I run the exact same site on Apache the url that is > returned by "submit" is different, and this

Re: Shouldn't blank=True imply null=True?

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 21:46 +, tofer...@gmail.com wrote: > On 07.01-13:40, Jeff Anderson wrote: > [ ... ] > > > please troll somewhere else. > > > > > I wasn't trolling, thank you. I was genuinely interested in how this > > would look. > > my apologies, i mis-read your terse questioning.

Re: could not import settings error, FastCGI

2009-01-07 Thread Malcolm Tredinnick
On Tue, 2009-01-06 at 19:40 -0800, Bradley wrote: > I'm having a strange problem in that I can make any change that I want > to the .fcgi file, short of deleting it and I get the same django > error about seymourherald.settings not found. I can delete the entire > contents of the file so all it

Re: Shouldn't get_profile() create the profile object?

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 22:50 -0200, Alvaro Mouriño wrote: > I find myself checking for the existence of the profile object for the > user everytime I call the get_profile function or making sure that it > gets created with every user. > > Is there a reason for this? Shouldn't the framework assure

Re: Module Title

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 20:34 -0800, Eric I.E. wrote: > I am trying to change the title of a module in the admin. I just need > to change the displayed name, easy enough for a field or a model but I > have not been able to figure out how to do it for an entire module. > Any pointers would be

Re: Setting Bound Fields Programmatically

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 21:28 -0800, Keyton Weissinger wrote: > I have a form with the following fields (all required): > - first_name > - last_name > - site_id > > I'd like to use a template to display only the FIRST two items to the > user for him to fill out: > > > {{ form.first_name }} > {{

Re: deploying a project

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 08:33 +, Alan wrote: > Dear List, > > > > > So, I developed a project with 2 apps and it's basic ready for > production test. Since I am quite newbie and don't know much about > apache I would like to know if it's possible to have 2 (two) different > django projects

Re: Shouldn't get_profile() create the profile object?

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 09:56 +0100, Thomas Guettler wrote: > Alvaro Mouriño schrieb: > > I find myself checking for the existence of the profile object for the > > user everytime I call the get_profile function or making sure that it > > gets created with every user. > > > > > Since a lot of

Re: Does using the IPython shell add "LIMIT" to Django ORM discussion (using SQLite)

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 10:58 +0100, Christopher Mutel wrote: > Hello all- > > I recently filed a bug about incorrect SQL generation, and Malcom > Tredinnick said that the example SQL I provided couldn't be correct, > because there was an extra LIMIT clause that shouldn't be there. After > poking

Re: Change the url

2009-01-08 Thread Malcolm Tredinnick
I'm going to trim your code to what looks like the relevant portion of the HTML template, since that's where the easiest solution lies. On Thu, 2009-01-08 at 02:02 -0800, Praveen wrote: [...] > > list_listing.html > > > Sight Seeings > > {%if listing_result %} > {% for n in

Re: Session variables

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 02:30 -0800, bradders wrote: > Can anyone recommend a session system that works more reliably than > the built-in Django session handling? I am finding that after calling > 2 or 3 different views the session variables that were stored at login > time get cleared. I am using

Re: ModelForm: exclude fields missing in request

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 07:08 -0800, Flo Ledermann wrote: > Hi all, > > I am trying to use a ModelForm in a "sparse" way to edit instances, > i.e. I only render one of its fields (plus a submit button) in the > template for editing the corresponding field in the model. I would > have expected that

Re: orm: delete performance and queries optimization

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 04:54 -0800, drakkan wrote: > In my database I have some tables full of records, when I delete an > object django use the cascade behaviour and this is good, however > seems it make a query for every related object and after this django > seems to issue a delete where id in

Re: Session variables

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 05:12 -0800, bradders wrote: > I will try to put something together. I have a fairly detailed trace > that I have put in the session code that shows my session variables > are set when it calls one of my views, but the trace shows that the > next session save only a new

Re: Passing a form a user before validation

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 17:09 -0800, DragonSlayre wrote: > I'm trying to generate a form with a user's details, so that they can > change the details they've submitted. > > One of my forms is a ModelForm, which is the profile of the User > object. I also want to show the first name, last name and

Re: defining form fieldsets in view (not in admin)

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 17:32 -0800, adrian wrote: > > Is there a way to display a form with fields grouped using fieldsets, > without entering all the html manually in the view? The Form I have > in mind is generated directly from a Model. I see that the admin has > this feature but it isn't

Re: defining form fieldsets in view (not in admin)

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 18:43 -0800, adrian wrote: > > What would be the best way to do it so when django updates > I don't have to rewrite my extension? So that it might be reusable > by others? Should I > checkout a version or can I use the 1.0.2 I have? You should be able to write your

Re: Extending Group for a GroupProfile

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 19:46 -0800, Cortland Klein wrote: > Hi. I'm planning on extending Group for a GroupProfile. I noticed that > the recommended way to extend User is to create a UserProfile with a > ForeignKey(User, unique=True) instead of a OneToOneField[a]. > > 1. Why is it recommended

Re: How to get the url for media_root?

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 22:58 -0800, itsnotvalid wrote: > Second question at the same time > > Anyways, I encountered a problem that when I want to get an item from > my media directory, which is set correctly in settings.py, however I > couldn't find a template tag to get the url of the

Re: orm: delete performance and queries optimization

2009-01-09 Thread Malcolm Tredinnick
On Fri, 2009-01-09 at 00:33 -0800, drakkan wrote: [...] > consider that other orm such sqlalchemy (with the right configuration) > can manage the mass delete without problems (tested on postgres), the > trick is to allow control on the database cascade behaivour, I > understand you are not

Re: ModelForm: exclude fields missing in request

2009-01-09 Thread Malcolm Tredinnick
nverted to a Python datetime or date object before being saved to the database. I'd prefer Django didn't do that for purity purposes, but it doesn't really get in the way in a practical sense. > On Jan 9, 2:18 am, Malcolm Tredinnick <malc...@pointy-stick.com> > wrote: > > On Thu, 200

Re: Newbie - Foreign Key Error

2009-01-09 Thread Malcolm Tredinnick
Hi Tony, On Fri, 2009-01-09 at 03:29 -0800, Tony wrote: > This is the reference: (not sure if I interpreted it right - sorry, > newb :) > > "If you use a multiple-table UPDATE statement involving InnoDB tables > for which there are foreign key constraints, the MySQL optimizer might > process

Re: How can I apply constraints on model relationships?

2009-01-09 Thread Malcolm Tredinnick
On Fri, 2009-01-09 at 03:33 -0800, rabbi wrote: > Is there a way to specify a constraint on a model ManyToMany > relationship? > > For example, if I wanted to define an Animal model that has a field > which specifies which other animals it eats and I wanted to limited > these animals_I_eat

Re: Urgent opening for Python Web Development/ programmers with Django/mumbai

2009-01-09 Thread Malcolm Tredinnick
Hi Rupali, On Fri, 2009-01-09 at 03:59 -0800, MapleSolutions.hr wrote: > We are having an Urgent opening for a leading MNC. > We are looking for Python Web Development/ Programmers with Django > experience. > LOCATION: Mumbai/ Andheri (E) You'll probably reach a good audience if you post this

Re: How can I apply constraints on model relationships?

2009-01-09 Thread Malcolm Tredinnick
On Fri, 2009-01-09 at 04:06 -0800, rabbi wrote: > Hi Malcolm, > Filtering out all the Animals that satisfy that constraint is easy... > even for a noob like me :) > > What I want is for that constraint to be enforced as/before the data > is inserted as I have a few complex (by my standards)

Re: Pluggable application template customization

2009-01-09 Thread Malcolm Tredinnick
On Fri, 2009-01-09 at 14:00 +0100, Olivier Guilyardi wrote: > Hi, > > We have developed Telemeta, a "pluggable" Django application (to be added to > INSTALLED_APPS). It works great. We now need to support per-project templates > customization as one can do for the admin. > > Telemeta provides a

Re: OneToOneField relation and bidirectional StackedInline behavior in contrib.admin context

2009-01-09 Thread Malcolm Tredinnick
On Fri, 2009-01-09 at 05:33 -0800, klein.steph...@gmail.com wrote: [...] > This error is understandable because actually ClassA haven't > ForeignKey but the relation > between ClassA and ClassB is OneToOneField then ClassA know how to > access to his classb object. > > This behavior is one

Re: deploying a project

2009-01-09 Thread Malcolm Tredinnick
On Fri, 2009-01-09 at 14:03 +, Alan wrote: [...] > --- > > DocumentRoot /home/blabla/myproj_1 > ServerName myproj1.acme.com > > Alias > ... > > ... > > WSGIScriptAlias / "/home/blabla/myproj_1/myproj_1.wsgi" >

Re: setting the checkboxes (MultipleChoiceField problem)

2009-01-09 Thread Malcolm Tredinnick
On Fri, 2009-01-09 at 08:51 -0800, over.nine.k wrote: > To simplyfy my question: > > How would you set the initial value of a form.MultipleChoiceField > being populated by a dictionary? > > > Django form doc says: > > >>> class CommentForm(forms.Form): > ... name =

Re: setting the checkboxes (MultipleChoiceField problem)

2009-01-09 Thread Malcolm Tredinnick
On Fri, 2009-01-09 at 20:29 -0600, Tolu wrote: > I tried this. The checkboxes displayed but none of them were checked: > > LOOKING_FOR = ( > ('Friendship', 'Friendship'), > ('Dating', 'Dating'), > ('A Relationship', 'A Relationship'), > ('Networking',

Re: pdb debugging problem

2009-01-09 Thread Malcolm Tredinnick
On Fri, 2009-01-09 at 15:50 -0800, Mat wrote: > I have 2 different behaviors using pdb > > In this view: > > from django.http import HttpResponse > import pdb; pdb.set_trace() > > def index(request): > import pdb; pdb.set_trace() > return HttpResponse("Hello!") > > > The first debug

Re: deploying a project

2009-01-10 Thread Malcolm Tredinnick
On Sat, 2009-01-10 at 08:03 +, Alan wrote: > Good you asked, I don't know because I couldn't try it yet. This a bit > complicated. We are spread across Europe and I don't have the access > as admin to the server, so what I am doing is the best I can because > then the admin will test it. She

Re: deploying a project

2009-01-10 Thread Malcolm Tredinnick
On Sat, 2009-01-10 at 10:37 +, Alan wrote: > Thanks Graham, indeed I was being stupid, I didn't realise that mac > leopard holds apache 2.2 now... > > > About docs, where can I find something about apache2 + mac osx + > mod_wsgi in http://docs.djangoproject.com or google? All I get is >

Re: Where are all the Django jobs?

2009-01-10 Thread Malcolm Tredinnick
On Sat, 2009-01-10 at 15:38 -0700, David Lindquist wrote: > First, I understand that the world economy is in a slump, and that > the job market as a whole has not fared well of late. But even before > the recent downturn, I noticed that there are precious few jobs in > Django development

Re: Form object has no attribute 'save' ( form.is_bound returns true )

2009-01-10 Thread Malcolm Tredinnick
On Sat, 2009-01-10 at 21:38 -0800, Dmitri13 wrote: > Hi Guys, > I am unable to save to table TEST_QST ,it returns error QstForm > object has no attribute 'save' > I have confirmed that > form.is_bound returns true > form.is_valid returns true > I have included my code in this post [...] > #

Re: Model Updates. use save() or signals

2009-01-10 Thread Malcolm Tredinnick
On Sat, 2009-01-10 at 22:26 -0800, juice wrote: > I am having trouble with setting up a pre_save signal. I want to be > able to set a location in a model instance, but only have 1 entry at > any time. I thought about just overriding the save, and adding an > update something like: > > def

Re: drawing diagrams in django?

2009-01-10 Thread Malcolm Tredinnick
On Sat, 2009-01-10 at 12:58 -0800, Jeff Hammerbacher wrote: > Hey Alistair, > > For static image generation, I've used pygraphviz > (http://networkx.lanl.gov/pygraphviz/), a Python interface to AT's > graphviz library. pydot is another Python library for working with Graphviz. Whichever one you

Re: Model Updates. use save() or signals

2009-01-11 Thread Malcolm Tredinnick
On Sun, 2009-01-11 at 00:11 -0800, juice wrote: > > > I then figured it may run into a loop of saving the same model, so i > > > was going to use signals but ran into the same issue that it would > > > still need to be in the save function. > > > > Are you talking about the infinite loop problem

Re: Model Updates. use save() or signals

2009-01-11 Thread Malcolm Tredinnick
On Sun, 2009-01-11 at 01:53 -0800, Matt Welch wrote: > I appreciate it. Thank you. > > I tried the examples you said and ran into one problem on the first > ( happened in the second, but fixed ). > > On Jan 11, 3:12 am, Malcolm Tredinnick <malc...@pointy-stick.com> >

Re: debug template tag gives me: "'ascii' codec can't encode character"

2009-01-11 Thread Malcolm Tredinnick
On Sun, 2009-01-11 at 03:41 -0800, Flo Ledermann wrote: > Hi all, > > I just bumped into a problem I can't resolve: after adding the {% > debug %} template tag to one of my templates (no other changes), I get > the following error message: > > TemplateSyntaxError at /art/ > > Caught an

Re: Decoupling between projects and app in 4-part tutorial.

2009-01-12 Thread Malcolm Tredinnick
On Sun, 2009-01-11 at 16:53 -0800, Greg Aumann wrote: [...] > I am wondering why the tutorial teaches this bad practice when there > is so much emphasis in Django on reusable apps. When you could instead be wondering if it really is truly bad practice or just alternative practice and a

Re: POST still occurs after HttpResponseRedirect

2009-01-12 Thread Malcolm Tredinnick
On Sun, 2009-01-11 at 19:27 -0800, stryderjzw wrote: > Hi, > > Here's part of my code: > > class NewAssignmentFormPreview(FormPreview): > > def done(self, request, form): > assignment = form.save(commit=False) > assignment.save() > > ... > > return

Re: dependency between forms

2009-01-12 Thread Malcolm Tredinnick
On Mon, 2009-01-12 at 02:48 -0800, uber.ubiwanken...@gmail.com wrote: > Hi all, > I have 3 models: model1, model2, model3. > > model2 depends on model1 and model3 depends on model2 (depend means > that have a foreignkey) > > In the admin interface I don't want to include model3 in the same page

Re: MultipleChoiceField initial data

2009-01-13 Thread Malcolm Tredinnick
On Tue, 2009-01-13 at 02:12 -0800, Thierry wrote: > This doesn't seem to work: > auto_open_choices = forms.MultipleChoiceField(choices=( ('google', > 'Google'), ('msn', 'MSN'), ('yahoo', 'Yahoo')), required=False, > initial=['google']) > > From what i read in the discussions here it should... >

Re: Decoupling between projects and app in 4-part tutorial.

2009-01-13 Thread Malcolm Tredinnick
On Tue, 2009-01-13 at 08:53 -0800, dahpgjgamgan wrote: [...] > > People experienced in Python realise that import statements are > > flexible, so what's written in the tutorial is only a guide. People > > needing to follow every line of code in the tutorial and just learning > > Python don't need

Re: Django-OAuth Issue

2009-01-13 Thread Malcolm Tredinnick
On Tue, 2009-01-13 at 18:54 -0800, Chris wrote: > Hello, > > I have been using django-oauth and am getting the below error using > this code http://dpaste.com/108808/ > > I get this when running the dpaste code in the python shell. > Traceback (most recent call last): > File "", line 1, in >

Re: 'No such file or directory' error, but not in shell or development server?

2009-01-13 Thread Malcolm Tredinnick
On Tue, 2009-01-13 at 19:51 -0800, OwenK wrote: > I've made a dictionary site that relies on a text file to look up > entries. The function that calls it works fine in the shell or in the > development server, but when I try to use it with mod_python/apache it > gives me an IOError errno 2, No

Re: Django / memcached / pickle / Unicode = confusion + UnicodeDecodeError

2009-01-14 Thread Malcolm Tredinnick
On Tue, 2009-01-13 at 19:30 +, Rachel Willmer wrote: > I've just upgraded some code to Django 1.0 and the caching stopped working. > > I have found a fix but I don't understand what's happening so if > anyone can explain, I'd be grateful. > > My code used to look somthing like this

Re: temporary user model

2009-01-14 Thread Malcolm Tredinnick
On Tue, 2009-01-13 at 22:39 +, Mengsong Chen wrote: > Just wonder if anyone have achieved such a temporary user model to > allow unregistered user to use some features, > but will clean up the data after the session completed if the user is > not going to register. You could use a user

Re: post_syncdb signal: Called several times

2009-01-14 Thread Malcolm Tredinnick
On Wed, 2009-01-14 at 10:42 +0100, Thomas Guettler wrote: > Hi, > > I read the docs for the sync_db signal: >http://docs.djangoproject.com/en/dev/ref/signals/#post-syncdb > > The signal gets fired several times. Since my app has several model classes. The "since" bit doesn't follow. The

Re: list all context variables?

2009-01-14 Thread Malcolm Tredinnick
On Wed, 2009-01-14 at 13:01 -0700, David Lindquist wrote: > Is there an easy way to see a list of all the context variables and > their values available in a given template? Have a look at the "debug" template tag. Regards, Malcolm --~--~-~--~~~---~--~~ You

Re: no objects found

2009-01-14 Thread Malcolm Tredinnick
On Wed, 2009-01-14 at 16:54 -0800, Brian wrote: > Django 1.0.2-1 > > If I do: > > >>> object=models.software.objects.get(id=267) > >>> print models.software_installation.objects.filter(software=object) > [] > >>> print models.software_installation.objects.filter(software=object).count() > 10 >

Re: Mod-Python = Headaches (cannot find my settings file)

2009-01-14 Thread Malcolm Tredinnick
On Wed, 2009-01-14 at 20:33 -0800, mclovin wrote: > I have my project settings file in: > > 'C:/projects/caliber/settings.py" > > I have mod_python activated (latest version as of today) along with > Apache (latest version as of today) > > Now this is at the bottom of my httpd.conf file: > >

Re: Model manager natural sort order

2009-01-14 Thread Malcolm Tredinnick
On Wed, 2009-01-14 at 21:14 -0800, Delta20 wrote: > Is there a way to make a model manager get_query_set function return > items sorted in natural alphanumeric order? order_by returns things in > rather than the ASCII order, which is not generally what users expect. Depends very much on which

Re: Mod-Python = Headaches (cannot find my settings file)

2009-01-14 Thread Malcolm Tredinnick
On Wed, 2009-01-14 at 20:44 -0800, mclovin wrote: > Here is my new revised: > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE caliber.settings > PythonDebug On > PythonPath "['C:/projects/'] + sys.path" > > > still

Re: Project Scope Thread

2009-01-15 Thread Malcolm Tredinnick
On Thu, 2009-01-15 at 01:12 -0800, Jurie-Jan Botha wrote: > I would like to run a thread for an entire Django project. I would > like to house the code that starts this thread up inside an > application. Your terminology choices here are going to lead to confusion. Django has "applications" (the

Re: Form Wizard, using reverse to pass data to extra_context

2009-01-15 Thread Malcolm Tredinnick
On Thu, 2009-01-15 at 04:13 -0800, coulix wrote: > Hi, > > I use a formWizard for a signup process: > > url(r'^signup/student/$', SignupStudentWizard([SignupForm, > StudentForm]), > {'extra_context':{"type":"student"}}, name='signup_student',), > > Now, used as it is it works fine.

Re: ManyToManyField in both models

2009-01-15 Thread Malcolm Tredinnick
On Thu, 2009-01-15 at 10:35 -0800, Evgeniy Ivanov (powerfox) wrote: > Hi list, > I want to have ManyToMany fields in both models to make django > generate forms with multiselect for both models. > Something like this: > > class User(models.Model): >groups = models.ManyToManyField('Group',

Re: How do I set no minimum number of entries for a formset?

2009-01-15 Thread Malcolm Tredinnick
On Thu, 2009-01-15 at 11:25 -0800, mw wrote: > Well I can set blank=True for the fields of the Deadline, but that > doesn't feel quite correct still as now someone could potentially half > fill out a deadline and have it validate. Really? Did you try that. Blank means blank, not half-completed.

RE: reverse() problems (NoReverseMatch)

2009-01-15 Thread Malcolm Tredinnick
On Fri, 2009-01-16 at 12:46 +1100, Ian Cullinan wrote: > Actually, it's not the url() function that makes it work, it's specifying the > view function by name. > > urlpatterns = patterns('', > (r'^FaceSearch/search/$', 'facesearch.views.start_search'), > ) > > works, > > from

RE: reverse() problems (NoReverseMatch)

2009-01-15 Thread Malcolm Tredinnick
On Fri, 2009-01-16 at 14:02 +1100, Ian Cullinan wrote: > Thanks for the explanation, but I still don't understand why it > doesn't work with function references. > > For one, > http://docs.djangoproject.com/en/dev/topics/http/urls/#reverse says > "viewname is either the function name (either a

Re: importing data into django model

2009-01-15 Thread Malcolm Tredinnick
On Thu, 2009-01-15 at 19:06 -0800, andrew_dunn wrote: > I realize this is probably a very simple question, but I've been > trying to figure it out for days and have had no success. > > I've got a data set with about 11,000 lines (CSV). I've written a > piece of Python code that parses it and

Re: Problem using cursor.executemany() in manage function

2009-01-15 Thread Malcolm Tredinnick
On Thu, 2009-01-15 at 20:32 -0800, Davepar wrote: > This is kind of a corner case, but I need to update many of the > records in a table on a regular basis. I decided to do this with a > manage command. (This is Django v1.0, btw.) I used something like the > following: > > cursor =

Re: database sqlite3

2009-01-16 Thread Malcolm Tredinnick
On Fri, 2008-12-12 at 10:51 -0800, ben852 wrote: > C:\Users\Benjamin\Desktop\mysite\sqlite3 > SQLite3 version 3.6.6.2 > Enter".help" for instructions... This suggests that the sqlite3 program is not on your normal system paths. So Django won't be able to execute it.

Re: How do i combine a list and a form in the same page using django?

2009-01-16 Thread Malcolm Tredinnick
On Fri, 2009-01-16 at 01:10 -0800, Gath wrote: > Am building a Q page, sort of stackoverflow.com kinda page! Am > having a bit of a problem trying to render the form. Am pasing 3 > objects to the template that renders the page i.e. Question object, > Answers related to the question and Answer

Re: ManyToManyField in both models

2009-01-16 Thread Malcolm Tredinnick
On Fri, 2009-01-16 at 01:33 -0800, Evgeniy Ivanov (powerfox) wrote: > > > On Jan 16, 5:16 am, Malcolm Tredinnick <malc...@pointy-stick.com> > wrote: [...] > > You need to go back and look at your original problem. You wanted forms > > with multiselect fiel

Re: session.save() after failed request

2009-01-16 Thread Malcolm Tredinnick
On Fri, 2009-01-16 at 11:19 +0100, Thomas Guettler wrote: > Hi, > > I think it is bad that request.session.save() is called, if > the DEBUG-View gets returned on an uncaught exception. > > I looked at the django source, but could not find a good patch for django > or my code. > > What is bad

  1   2   3   4   5   6   7   8   9   10   >