Re: ABC/MTI and Generic Date Based Views

2009-02-09 Thread Malcolm Tredinnick
On Sat, 2009-02-07 at 12:40 -0800, seanbrant wrote: > Im have troubling figuring about a good solution for blog posts. I > have created a ABC called Entry which Post, Link, Photo, Quote > inherit. It would help others to define a few terms here before leaping into the acronyms: ABC = "abstract ba

Re: Can Django only store the ASCII value for cookie?

2009-02-09 Thread Malcolm Tredinnick
On Fri, 2009-02-06 at 04:16 -0800, TualatriX wrote: > Hi all: > > In my web application, I need to store some value of user's input, I > use cookie. > But sometime the User's input is not the character of ASCII, so DJango > throw out the exception: > > UnicodeEncodeError > 'ascii' codec can't en

Re: request.GET Problem

2009-02-05 Thread Malcolm Tredinnick
On Thu, 2009-02-05 at 17:22 -0800, min wrote: [...] > If use request.GET['selectM'].strip() in the following example, we can > only get the the 'value' of selected item. > > > > > > >bbb >ccc >ddd > >

Re: MultipleChoiceField issue

2009-02-04 Thread Malcolm Tredinnick
On Wed, 2009-02-04 at 18:59 -0800, Bobby Roberts wrote: [...] > Can you provide me an example of how I should be using getlist? I > don't see anything in the docs related to forms and getlist. That's because getlist() has nothing to do with forms. It's a method on the object that is request.POST

Re: Basic Queryset issue

2009-02-04 Thread Malcolm Tredinnick
On Wed, 2009-02-04 at 18:02 -0800, CALdan wrote: > Hi, > > I'm in the process of learning django by creating a simple application > for use at work, I'm using the djangobook's tutorials as guidlines for > my own app. As far as I can tell, everything below is correct however > when django loads t

Re: form validation in XMLHttp submission

2009-02-04 Thread Malcolm Tredinnick
On Wed, 2009-02-04 at 11:23 -0800, adrian wrote: > > I'm using the standard pattern for handling a POST request form > submission, even though the form is submitted by JavaScript as an > XMLHttpRequest, and the date validation is not working. I added some > logging statements to find the prob

Re: getting database definition in line

2009-02-03 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 19:47 -0800, Eric Abrahamsen wrote: > > > On Feb 4, 11:25 am, Malcolm Tredinnick > wrote: > > On Tue, 2009-02-03 at 19:10 -0800, Eric Abrahamsen wrote: > > > Hi there, > > > > > I'm unable to do any testing -- my fixtures

Re: Best practices: database connection over SSL?

2009-02-03 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 21:30 -0600, James Bennett wrote: > On Tue, Feb 3, 2009 at 9:22 PM, Jeff Hammerbacher wrote: > > I could modify the call to Database.connect() in > > django/db/backends/mysql/base.py, but that's not the most elegant > > implementation. Does anyone have ideas on how to procee

Re: getting database definition in line

2009-02-03 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 19:10 -0800, Eric Abrahamsen wrote: > Hi there, > > I'm unable to do any testing -- my fixtures fail with a "Duplicate > Entry" error when loading. From what I've googled, this might have > something to do with a mismatch between my model definitions and the > sql table defi

Re: queryset iteration

2009-02-03 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 15:06 -0800, Casey Deccio wrote: > Hi, > > I'm using django 1.0.2. I have an model with a large number of > records. I was hoping that the built-in iteration on queryset objects > would reduce the memory requirement, but it is using up all my memory > (and swap), and I'm

Re: Session variables

2009-02-03 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 13:52 -0800, Vladimir Shulyak wrote: > Any progress on this problem? > I've got exactly the same problem with sessions on ubuntu/database- > backend sessions. But the most interesting thing that variables like > instances of large classes are deleted while simple instances li

Re: Sessions Unexpectedly Causing Logout

2009-02-03 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 11:43 -0800, SnappyDjangoUser wrote: > I am having a weird issue in which users are randomly logged out of > the site and redirected to the login page. They must re-enter > credentials before being able to continue browsing the site. The > weird thing is I only see this on

Re: increasing upload speed

2009-02-03 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 19:27 +0100, felix wrote: > > hi- > > I'm using swfupload (flash upload widget) with the speed plugin. > It looks like I'm getting 600k/s average upload speed to my slicehost > server. > > it took me 28 mins for 140M So you mean a bit over 600 kb/s. You left off the unit

Re: Can't create a record with a Foreign Key: IntegrityError: (1048, "Column 'user_id' cannot be null")

2009-02-03 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 08:08 -0800, Theme Park Photo, LLC wrote: > > Ok! NOW I get it! You need to do a get to do a select by primary key > > > u=User.objects.get(username="swirsky") > > > For some reason I thought that you could get by primary key by just > creating the object with the key s

Re: can't clear form data in runserver (works in shell)

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 23:05 -0800, Mark Jones wrote: > I have a form that is working well. However I want to allow them to > reuse the form multiple times. Each time they submit the form, I will > send up to 6 emails. Then, if an email is sent successfully, Right there you have your first pro

Re: object_detail 404 (queryset outdated?)

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 22:32 -0800, Simon Westphahl wrote: > On 3 Feb., 03:54, Malcolm Tredinnick wrote: > > Have you verified that an object exists for whatever the slug value is > > that you're passing in? Using Django's debug page, you should be able to > > see t

Re: Can't create a record with a Foreign Key: IntegrityError: (1048, "Column 'user_id' cannot be null")

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 22:22 -0800, Theme Park Photo, LLC wrote: > I can't get anything with Foreign keys to work. I trimmed everything > down to the simplest example: > > from django.db import models > from django.contrib.auth.models import User > > class Ranking(models.Model): > user = mo

Re: Django session

2009-02-02 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 13:26 +0700, Harryanto Ie wrote: > thx, but i didn't get what i need for, how to create > session using request.session[] with multi value. You got most of what you needed, though. I attempt to answer the broader problem people ask, particularly when there's confusion o

Re: Django session

2009-02-02 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 12:55 +0700, Harryanto Ie wrote: > i.e def login is called with the login template, The code you have posted only passes "request" to the login() function. If you passed anything else, it would fail, since your login() function only expects one parameter. > example > the

Re: Difficulty with filtering a queryset using the "in" method

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 21:51 -0800, Brandon Taylor wrote: > Hi everyone, > > I need to return a queryset using the "in" statement. My IDs are in an > array of int values. > > vehicle_ids = [1, 2, 3] > > If I do: vehicles = VehiclePhoto.objects.filter(vehicle__id__in= > [vehicle_ids]) You're pas

Re: Displaying Data from Multiple Tables

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 21:37 -0800, Alexiski wrote: > > > On Mon, 2009-02-02 at 21:21 -0800, Alexiski wrote: > > > Hi Malcolm, > > > > > Thanks for your response, but I'm not quite sure how to iterate using > > > obj.query.all to get all the instances I'm after. > > > > > Could you please provide

Re: newbie: printing a date in a template

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 10:08 -0800, KJ wrote: > On Feb 2, 7:11 pm, Christian Joergensen wrote: > > > > Is `todaysdate` listed in your context? > > > > This is my return line for the view, the locals() part should add all > the local variables to the template context right? > > return render_to_r

Re: Displaying Data from Multiple Tables

2009-02-02 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 16:28 +1100, Malcolm Tredinnick wrote: > On Mon, 2009-02-02 at 21:21 -0800, Alexiski wrote: > > Hi Malcolm, > > > > Thanks for your response, but I'm not quite sure how to iterate using > > obj.query.all to get all the instances I'm aft

Re: Displaying Data from Multiple Tables

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 21:21 -0800, Alexiski wrote: > Hi Malcolm, > > Thanks for your response, but I'm not quite sure how to iterate using > obj.query.all to get all the instances I'm after. > > Could you please provide a code snippet or direct me to a relevant > page? Iteration in templates is

Re: Django session

2009-02-02 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 12:17 +0700, Harryanto Ie wrote: > hmm... i have createed the server, and i have 2 client > site. each client has different module to access and there > are separated when login section. > > i'm doing now is : > i.e : > > def login(request) : >login = > User.objects.

Re: Integrating raw SQL and model objects

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 23:56 -0500, Jack Orenstein wrote: > Hello, I am new to Django, and trying to figure out how best to use > it. My immediate problem is that I'm trying to figure out how to use > raw SQL in combination with the model layer. Here are the issues I've > run into: > > 1) Ho

Re: Displaying Data from Multiple Tables

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 20:52 -0800, Alexiski wrote: > Hi all, > This is a difficulty related to me being new to Django/Python I > assume, so I hope you can forgive my ignorance and help me out :) > > I have 4 tables - User(overriding the user object), Copy, Query, > QueryClassification. The main t

Re: django sqlite autoincrement bug

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 23:16 -0500, alexander lind wrote: > > On Feb 2, 2009, at 10:05 PM, Malcolm Tredinnick wrote: > > > I always make my auto-inc fields primary as well, so no argument > > > there. > > > I tried using the AutoField when I noticed django did

Re: select_related and OneToOneField

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 14:40 -0500, Michael Hrivnak wrote: > Does select_related work for OneToOneField relationships? Yes. This wasn't something you could have just tried out and seen for yourself? > If so, does it work > in both directions? No. Probably will in 1.1, but not yet. Regards,

Re: Can I control contents of SELECT in queryset?

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 09:50 -0800, phoebebright wrote: > After replicating you test and it still failing and various other > experiments I downloaded the latest django trunk and it works fine! > Always check the version first Phoebe! > > Sorry for the run around. > > For the record here are the

Re: django sqlite autoincrement bug

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 09:42 -0500, alexander lind wrote: > >>> Shows how infrequently AutoField's are really used in practice. > >>> They're > >>> generally just not that useful to specify. > >> > >> > >> What else do people use for specifying autoinc fields? > > > > Auto-increment fields generall

Re: EmptyResultSet exception

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 03:23 -0800, omat wrote: > Hi, > > I am receiving an EmptyResultSet exception in 'in' lookups, if the > lookup is against an empty ValuesListQuerySet. > > Here is the case: > > >>> ids = Tag.objects.filter(id__in=[]).values_list(id, flat=True) > > Now the ids is an empty

Re: problem with admin in a .90 site

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 14:36 +0530, Kenneth Gonsalves wrote: > hi, > I have an old site running on revision 2486 - had not touched it for years > and > since it wasnt broken nor needed new features, I did not upgrade it. A new > model was required, so I added it, but it was not appearing in sqla

Re: object_detail 404 (queryset outdated?)

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 00:16 -0800, Simon Westphahl wrote: > Hi, > > I'm getting the following 404 when accessing an objects detail page. > > ### > Page not found (404) > Request Method: GET > Request URL: http://127.0.0.1:8000/offers/service/testservice/ > > No found > matching the query Hmm

Re: Seeking design advice on Django implementation

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 00:17 -0800, Julien Phalip wrote: > Hi, > > I'm a bit stuck with the design of a system and so I was wondering if > someone could give some advice. > > The system works as follows. Users can create documents, which are > stored in a Django model. To ensure there's no confli

Re: Using hashing for password checking in auth module

2009-02-01 Thread Malcolm Tredinnick
On Sun, 2009-02-01 at 01:07 -0800, Guy Rutenberg wrote: > Hi Kless, > > > On Jan 31, 7:05 pm, Kless wrote: > > > > Your method has a point of failure. Whatever can see your code JS > > (client-code), so he will know what are you making with the password > > that is sent from a form. > > > > The

Re: django sqlite autoincrement bug

2009-02-01 Thread Malcolm Tredinnick
On Sat, 2009-01-31 at 16:56 -0500, alexander lind wrote: > > > > > > > class User(models.Model): > > > user_id = models.AutoField(primary_key=True) > > > > > > This produces a table in sqlite that will NOT take NULL for a > > > value > > > when inserting records. You get an error back. > >

Re: Meta-information for model and form fields

2009-02-01 Thread Malcolm Tredinnick
On Sat, 2009-01-31 at 13:13 -0800, Vinay Sajip wrote: > > > On Jan 30, 1:36 am, Malcolm Tredinnick > wrote: > > On Wed, 2009-01-28 at 23:21 -0800, Vinay Sajip wrote: > > > > [...] > > > > > I was hoping there was another way. Of course subclassing&

Re: django sqlite autoincrement bug

2009-01-30 Thread Malcolm Tredinnick
On Fri, 2009-01-30 at 22:37 -0500, alexander lind wrote: > I am using the svn trunk version of Django. > > I was just starting a new django project using sqlite for the db > backend. Excerpt from models.py: > > class User(models.Model): > user_id =

Re: Can I control contents of SELECT in queryset?

2009-01-30 Thread Malcolm Tredinnick
On Fri, 2009-01-30 at 07:46 -0800, phoebebright wrote: > Using your suggestion returns no values: Then there is something else going on in your code that is important and you haven't mentioned yet. If I use exactly the models you give: > class Category(models.Model): > name = models.CharFi

Re: Missing REFERENCES... in SQL of models.ForeignKey('LaterDefinedModel')

2009-01-30 Thread Malcolm Tredinnick
On Sat, 2009-01-31 at 12:20 +1100, Malcolm Tredinnick wrote: > On Fri, 2009-01-30 at 09:49 -0800, mucisland wrote: > > Hi all. > > > > If I specify the ForeignKey target model as a string because it is not > > yet defined, the (SQLite3) SQL table entry misses t

Re: Inherit/Override custom Form class methods in a custom ModelForm class

2009-01-30 Thread Malcolm Tredinnick
On Fri, 2009-01-30 at 12:19 -0800, Daniel Roseman wrote: [...] > This is an ideal case for mixins. A mixin is a basic class which is > 'mixed in' to other classes, which inherit both the attributes of > their base class and the mixin class. So, for example, you could do: > > class MyMixin(object)

Re: Missing REFERENCES... in SQL of models.ForeignKey('LaterDefinedModel')

2009-01-30 Thread Malcolm Tredinnick
On Fri, 2009-01-30 at 09:49 -0800, mucisland wrote: > Hi all. > > If I specify the ForeignKey target model as a string because it is not > yet defined, the (SQLite3) SQL table entry misses the REFERENCES > specifier. Example: SQLite doesn't support "references" constraints. So we don't bother wr

Re: DateField comparison with date.today()

2009-01-30 Thread Malcolm Tredinnick
On Fri, 2009-01-30 at 15:41 +, Tim Sawyer wrote: > On Wednesday 28 January 2009 04:34:50 Malcolm Tredinnick wrote: > > On Tue, 2009-01-27 at 22:03 +, Tim Sawyer wrote: > > > Hi, > > > > > > I have a model that includes: > > > > &

Re: Django Error mails

2009-01-30 Thread Malcolm Tredinnick
On Fri, 2009-01-30 at 05:56 -0800, madhav wrote: > As we all know when any 500 error shows up, django sends an exception > email to all the admins of the site. I was thinking DJango will be > using the smtp library to create mail objects and will be using any > local MTA(sendmail in my case) to se

Re: "setup_environ" can't help to run a standalone script

2009-01-30 Thread Malcolm Tredinnick
On Fri, 2009-01-30 at 04:58 -0800, Orcun Avsar wrote: > im trying to run a seperate script that is on my project directory. > setup_environ seems called correctly but progmram cant import models > properly That likely has nothing at all to do with setup_environ() -- which is only used to set up t

Re: error when using delete generic views

2009-01-29 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 21:31 -0800, vierda wrote: > Dear all, > Thanks for your reply I have modified my code as per below : > > views.py : [...] > def delete (request): >user = request.user >if user.is_superuser: > if request.method == 'POST': > form = DeleteForm(request.PO

Re: How to pass the variable which is defined in the views.py to the jQuery function

2009-01-29 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 21:11 -0800, min wrote: > Hi. > > First, the code in the forms.py: > > class TestForm(forms.Form): > name = forms.CharField( max_length=30 ) > > Then, the variable is defined in the views.py: > > def Test_page(request): > form = TestForm() > show_results = Fal

Re: Unique_together across classes

2009-01-29 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 19:54 -0800, CALdan wrote: > hi! > > I'm putting together a simple model in Django as an example for a > large project. I'm attempting to set up the models in an efficient > manner with as little redundancy as possible (none). > > What I'm attempting to do is use unique_to

Re: Django Forms in HTML 4.01 Strict

2009-01-29 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 15:18 +0100, Gertjan Klein wrote: > Malcolm Tredinnick wrote: > > >On Wed, 2009-01-28 at 14:33 +0100, Gertjan Klein wrote: > >> Malcolm Tredinnick wrote: > >> > >> I disagree. When I develop web pages (using Django or otherwise

Re: Any way to NOT escape a percent sign using 'contains'?

2009-01-29 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 18:47 +, Adam Stein wrote: > According to the docs, when using 'contains' in filter() a percent sign > or underscore is automatically escaped. However, in my case I want the > resulting SQL to use the percent sign. > > I know 'contains' will fill in the outside percent

Re: passing self?

2009-01-29 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 15:47 -0800, ajlozier wrote: > Hi Malcolm, > > I figured it out. This article is what pointed me in the right > direction: > > http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/ > > While you are right that there are a lot of examples in the code of > something simil

Re: Apps and static/media files

2009-01-29 Thread Malcolm Tredinnick
On Fri, 2009-01-30 at 00:57 +0200, Erik Allik wrote: > I'm having a situation in which two of my reusable apps both use > FCKeditor in their admin interface. Since both of them require > FCKeditor library files, I'm confused which one should provide them? > Both? How? What is the idiomatic/s

Re: reason for missing readline() in uploaded files?

2009-01-29 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 15:40 -0500, Todd O'Bryan wrote: > I'm trying to validate an uploaded csv file, so I want to read the > first line of text and if it's not the right format, send an error > message. Unfortunately, neither InMemoryUploadedFile nor > TemporaryUploadedFile have the readline() me

Re: Cron Job Question

2009-01-29 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 11:34 -0800, Chris wrote: > I have a python / django script that I have written which will be > used as a cron. Basically this script goes out to my database and gets > rows from a given table and performs a specific task then deletes the > row once finished. What I would li

Re: Can I control contents of SELECT in queryset?

2009-01-29 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 06:44 -0800, phoebebright wrote: > I want a distinct list of all the 'cat__names' that exist in > Subcategory and have at least one entry in Business (Business is a > subclass of model Directory which might be the problem) > > dir_query = Business.objects.all().select_relate

Re: Django Forms in HTML 4.01 Strict

2009-01-29 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 06:36 -0800, Andrew Ingram wrote: > On Jan 29, 2:18 pm, Gertjan Klein wrote: > > This payment thing comes up regularly here, and pollutes the discussion. > > I have been using Django for a while, and found it to have good things > > and downsides (both IMHO). I have not even

Re: form for two models - reuse fields generated by modelform

2009-01-29 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 03:56 -0800, Markus Bertheau wrote: > Hi, > > I need a registration form that allows the user to input several > models. Now just creating two ModelForms and letting a third class > inherit from them doesn't work, the fields of one model don't show. Is > there another way to

Re: Complex queries with datetime field

2009-01-29 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 09:48 +0100, Stefan Tunsch wrote: > Well, first of all I can't believe I've overlooked the __in field > lookup... I wasn't aware of it's existance. Sorry. > > Regarding the __year, __month and __day lookups I'm using in my code: > I do it because I want to filter all dateti

Re: error when using delete generic views

2009-01-29 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 23:47 -0800, Daniel Roseman wrote: [...] > No, you have provided four keyword arguments. The signature for the > delete_object function is as follows: > def delete_object(request, model, post_delete_redirect, > object_id=None, > slug=None, slug_field='slug', template_

Re: Meta-information for model and form fields

2009-01-29 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 23:21 -0800, Vinay Sajip wrote: [...] > I was hoping there was another way. Of course subclassing's not hard > to do, but it means doing it for every field class. I was looking at > moving an application over from SQLAlchemy, which offers this feature > both for models and fi

Re: QuerySet.create(**kw) and force_insert

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 21:26 -0800, Jason Geiger wrote: > Hello all. The docs say about QuerySet.create [1]: > """ > This is equivalent to (but much simpler than): > > >>> b = Blog.objects.get(id=1) > >>> e = Entry( > blog=b, > headline='Hello', > body_text='Hi', >

Re: passing self?

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 05:53 -0800, ajlozier wrote: > Thank you for responding. > > Yeah I was starting to figure out just what you're saying, that I > can't access the functions of a class within the class definition > itself. This is also true in PHP. In this case, if I were writing in > PHP I

Re: Django Forms in HTML 4.01 Strict

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 14:33 +0100, Gertjan Klein wrote: > Malcolm Tredinnick wrote: > > >In HTML, the requirement for errors of this form ( instead of > >), is that the parser *must* recover in a way that forces it to > >treat it as "" -- it has to ignore the in

Re: Debug output from template language?

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 18:06 -0800, Margie wrote: > Ah, right - of course. Thanks, Malcom. > > This is only slightly related, but perhaps you have a good answer. > Are most people using the standard template language? Not sure how we'd measure "most" people. But you could safely assume a few th

Re: absolute_import, app names, dots, and a bug

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 22:50 -0500, Karen Tracey wrote: > On Wed, Jan 28, 2009 at 9:51 PM, Todd O'Bryan > wrote: > > On Sun, Jan 25, 2009 at 7:13 PM, Karen Tracey > wrote: > > Sounds related to: > > > > http://code.djangoproject.com/ticket/8193 >

Re: 'FtrToolTags' is not a valid tag library: Could not load template library from django.templatetags.FtrToolTags, cannot import name Product

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 16:15 -0800, Thiago F. Crepaldi wrote: > in models.py all the code is ok. What other files are using the Product model? In particular, how do you import it into the module(s) that are using it in template tags. Something in your code is not importing Product or importing it

Re: can i use models like that??

2009-01-28 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 00:09 +0200, Mirat Can Bayrak wrote: > Can you look at these, can they work? > > i tried that one but not worked, is there way to make it working? (nope, > there was no error messages, only strings are not shown at admin panel) > > LANGUAGE_OPTIONS = (('en_GB', '(British)

Re: How to do Refbacks in Django?

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 11:49 -0800, Fluoborate wrote: > Hello, > > I would like some suggestions for how to do refbacks in Django. Every > time someone clicks a link that brings them to my site, I want to > record what site referred them. This is done using the HTTP referrer > header. Here are my

Re: Debug output from template language?

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 14:05 -0800, Margie wrote: > Is there a way to generate debug output from the template language? > Suppose I have something like this: > > {% for field in form %} > {{ field.label_tag }}{{ field }} tr> > {% if field.help_text %} > {{ fiel

Re: Custom authentication backend and User passwords

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 11:34 -0800, Delta20 wrote: > Is there a way to make it so that when you create a User in admin, the > password is set such that the user cannot login using ModelBackend? Have a look at this: http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.models.User.s

Re: Changing comments preview form

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 19:24 +0100, Florian Lindner wrote: > > Am 28.01.2009 um 05:19 schrieb Malcolm Tredinnick: > > > > > On Tue, 2009-01-27 at 20:11 +0100, Florian Lindner wrote: > >> Hello, > >> > >> I'm playing around with the contrib.

Re: Creating test databases. Nose framework

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 17:19 +0200, Oleg Oltar wrote: > Any idea? Generally, you'll want to wait more than 6 hours before asking again. A couple of days, at least, would be a reasonable period. > On Wed, Jan 28, 2009 at 11:41 AM, Oleg Oltar > wrote: > Can't find how to add predefined da

Re: Complex queries with datetime field

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 16:10 +0100, Stefan Tunsch wrote: > Hi! > > I have a calendar that permits multiple selections of dates. > > My view has to filter the data depending on the selected dates. > > I am unsure about how I can construct a query that filters correctly the > data. > > I constru

Re: admin sorting in ManyToMany fields

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 06:49 -0800, Aaron Lee wrote: > I tried doing that but it didn't work, the order of names within the > PersonAdmin still shows the Name according to pk order. Firstly, realise that your question doesn't have a "correct" answer. Ordering by multi-valued fields always have th

Re: Complex Form Widgets

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 11:48 +0200, Donn wrote: > On Wednesday, 28 January 2009 09:46:09 Paul Johnston wrote: > > Is it possible to use more complex form widgets > In my *very* limited experience, I would say yes. > > The widgets are really javascript and all your Django view needs to worry > a

Re: Meta-information for model and form fields

2009-01-28 Thread Malcolm Tredinnick
On Wed, 2009-01-28 at 04:27 -0800, Vinay Sajip wrote: > I'd like to attach some user-defined meta-information to individual > model fields and have it also be available in the corresponding form > fields. Ideally, I'd have liked to have a keyword arg on the fields... > > class MyModel(models.Mode

Re: Multithreaded development server

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 06:21 -0800, Almad wrote: > On Jan 26, 1:19 am, Russell Keith-Magee > wrote: > > On Sun, Jan 25, 2009 at 10:45 PM,Almad wrote: > > > I still feel kinda weird that I must hack around Django so much to > > > make basic testing things working :-]]] > > > > Let's be clear here -

Re: File as data backend for model

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 17:13 -0500, Matthias Julius wrote: > I am trying to write a model for which the data can be represented as > a simple array of a fixed number of one byte integers. To use a > SQL database for that would be very much overkill. I would simply use > a file where I can seek to

Re: Bound Inline Formset doesn't render FileField's current value, needs to be reentered.

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 14:48 -0800, Rodrigo C. wrote: > > This isn't a Django issue. It's a standard property of browsers: you > > can't set an initial value for file input fields. This is a security > > measure, to stop malicious pages uploading files from your hard drive > > without your explicit

Re: how to: munge words and numbers into a URL, then reverse it ?

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 16:48 +0100, felix wrote: > > there is some hashing function or combination of URL encoding that can > do this : > > > given some parameters : > > 'music' 'artist' 32L 2L 100 100 > ( artist id 32, 2nd picture, dimensions 100 x 100 ) > > I wish to generate a fake filenam

Re: DateField comparison with date.today()

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 22:03 +, Tim Sawyer wrote: > Hi, > > I have a model that includes: > > from datetime import date as pydate, datetime > > date = models.DateField() > > I've overridden delete to do: > > def delete(self): > ... > if self.date < pydate.today(): >

Re: Setup_environ before or after forking?

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 12:56 -0800, Andrew Fong wrote: [...] > Question: Does it make more sense to call setup_environ before or > after forking? I'd do it after forking. > > In particular, I don't know how Django sets up its database > connection. A connection is created the first time you acc

Re: Extending User model

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 21:44 +0100, Alex Rades wrote: [...] > my situation is: It's a site for students and companies, where > students can post their data and search for internships, and companies > post their data, internship opportunities, and search for students. > > So, students have to fill

Re: Common fields in an abstract class, with customized db_column values for concrete models

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 11:19 -0800, psj wrote: > Hi community -- > > All my models have some common fields, say "created_date" and > "last_modified_date". However, for various reasons not important here, > we have some naming conventions on column names: we like them to have > a prefix that pertai

Re: Changing comments preview form

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 20:11 +0100, Florian Lindner wrote: > Hello, > > I'm playing around with the contrib.comments framework. I want to > change the preview form. For that I've copied preview.html to xgm/Blog/ > templates/comments (xgm is my project, Blog is app). My template > loaders are:

Re: error when using Create, Update generic views

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 19:36 -0800, vierda wrote: > Dear all, > > Today I'm learning to use generic views for create and update objects. > It required form_class or model for the argument. My model is User > from django.contrib.auth.models.User and my form as per below : > > from django.contrib.a

Re: Adjusting these models for other functionality

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 09:57 -0800, Almost George wrote: > -- MODELS -- ( Other, unimportant fields/models have been removed ) > > class Band(models.Model): > name= models.CharField(max_length = 50, unique = True) > > class Venue(models.Model): > name

Re: Problem with encoding and using ifequal in Django templates

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 09:25 -0800, Ben Gerdemann wrote: > Hello, > > I'm having problems using {% ifequal s1 "some text" %} to compare > strings with extended characters in Django templates. When string s1 > contains ascii characters >127, I get exceptions in the template > rendering. I know you

Re: passing self?

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 08:32 -0800, ajlozier wrote: > I have made a little progress on the problem I posted about earlier > (http://groups.google.com/group/django-users/browse_thread/ > thread/100679d9c298dc52/ffa1564be0c4b276?hl=en&lnk=gst&q=tree > +admin#ffa1564be0c4b276">creating tree inputs in

Re: Splitting a NullBooleanField in a template

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 06:53 -0800, chewynougat wrote: > After having a closer look in django, it seems that the > RadioFieldRenderer that renders the radio buttons, renders the entire > set as a single string, therefore it is not possible to split these > fields in the template (using django) - if

Re: reverse foreignkey "add" method using multiple INSERTs

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 02:17 -0800, Andrew Ingram wrote: > Hi All, > > I'm using something along the following lines to bulk add a bunch of > objects to a model's reverse foreignkey relationship: > > foo.bar_set.add(*bars) > > where bars is a list of Bar objects. > > I've noticed that Django is

Re: template: writing "\u20ac 20.000" fails

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 00:37 -0800, SanPy wrote: > Thanks a lot, Malcolm, > > You got me on the right track, I just needed to escape the string, > like this: > > var prices=[{% for price in prices %}[{{ price.0 }}, '{{ price.1| > escape }}']{% if not forloop.last %},{% endif %}{% endfor %}]; > >

Re: urlresolvers.reverse() breaks when given exactly one arg of more than one character

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 18:07 -0800, Fluoborate wrote: > Hello All, > > I have a question. When I use the function > django.core.urlresolvers.reverse(), it works fine with args=(), and it > works fine with args=(string1, string2 [, ...more strings]), and it > even works fine with args=(anyOneCharac

Re: GROUP BY

2009-01-26 Thread Malcolm Tredinnick
On Mon, 2009-01-26 at 23:46 -0800, Glenn Maynard wrote: [...] > I don't care if it takes more than one line, though there is, in > fact :), a big difference between taking more than one line and having > to bypass the public API. Only semantically, when you're trying to access something like "gr

Re: Finding all Named URLs

2009-01-26 Thread Malcolm Tredinnick
On Mon, 2009-01-26 at 21:33 -0800, rtelep wrote: > > > > sufficiently useful to add to the maintenance load of core. Sadly, > > people asking about this type of thing frequently omit the use-case. > > > My bad. I was thinking of testing. Run through all the URLs with the > test client, look

Re: admin list display icons for callable?

2009-01-26 Thread Malcolm Tredinnick
On Mon, 2009-01-26 at 21:51 -0800, Paddy Joy wrote: > The admin interface shows nice green/red icons for BooleanFields. If I > have a callable that returns only true or false, is there a way I can > make these show in the admin with icons rather than the text > 'True'/'False' > > For example I wo

Re: Best way to unique upload file name

2009-01-26 Thread Malcolm Tredinnick
On Mon, 2009-01-26 at 21:06 -0800, chatchai wrote: > Thanks for your quick reply, > > I need to unique file upload name because the client say the file is > unique by name (date based) so that they won't upload the same file. > > I know that the file name cannot determine file uniqueness. > >

Re: Best way to unique upload file name

2009-01-26 Thread Malcolm Tredinnick
On Mon, 2009-01-26 at 20:52 -0800, chatchai wrote: [...] > I know that Django will append the underscore after the file name > until the file can be saved but what i mean is, > do not allow the file with the same name to be able to upload. That's kind of an odd requirement. The filename says noth

Re: Best way to unique upload file name

2009-01-26 Thread Malcolm Tredinnick
On Mon, 2009-01-26 at 20:39 -0800, chatchai wrote: > Hi, > > I want to unique upload file and there is not unique parameter > available for file field model. I think I can do this at the form > level but I just want to make sure if it is the best way to go. The simplest way is to let Django do i

<    3   4   5   6   7   8   9   10   11   12   >