Re: Heisenbug to do with self.client losing its sessionstore

2015-06-05 Thread Peter Bengtsson
22:27:32 UTC+2, Peter Bengtsson wrote: >> >> I have this code that looks something like this (django 1.6.11): >> >> def test_something(self): >> url = someobject.get_url() >> User.objects.create_user('a', 'a...@example.com', 'secret') >> assert se

Heisenbug to do with self.client losing its sessionstore

2015-03-31 Thread Peter Bengtsson
I have this code that looks something like this (django 1.6.11): def test_something(self): url = someobject.get_url() User.objects.create_user('a', 'a...@example.com', 'secret') assert self.client.login(username='a', password='secret') r = self.client.get(url) assert

Re: Installing south and using sqlite3's :memory: ruins total test suite time

2015-01-20 Thread Peter Bengtsson
It seems, for some reason settings.COMPRESS_ENABLED gets set to False when south is installed. On Tuesday, January 20, 2015 at 12:37:44 PM UTC-8, Peter Bengtsson wrote: > > I have a django project on django 1.6. It's using django-nose and it's > using sqlite3's :memory: trick: >

Re: Installing south and using sqlite3's :memory: ruins total test suite time

2015-01-20 Thread Peter Bengtsson
in runtime because I have `COMPRESS_OFFLINE = True` on and I run compress before running tests. On Tuesday, January 20, 2015 at 12:37:44 PM UTC-8, Peter Bengtsson wrote: > > I have a django project on django 1.6. It's using django-nose and it's > using sqlite3's :memory: trick: >

Installing south and using sqlite3's :memory: ruins total test suite time

2015-01-20 Thread Peter Bengtsson
I have a django project on django 1.6. It's using django-nose and it's using sqlite3's :memory: trick: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } Before I added `south` to INSTALLED_APPS it would take about ~5 seconds to

Re: Why doesn't a forms.fields.DateField always return a datetime.date instance?

2014-03-04 Thread Peter Bengtsson
On Tuesday, March 4, 2014 5:19:17 PM UTC-8, Tom Evans wrote: > > On Tue, Mar 4, 2014 at 10:45 PM, Peter Bengtsson > <pet...@gmail.com> > wrote: > > The link was to django master. So it's in all versions. > > > > Well, that doesn't necessarily follow do

Re: Why doesn't a forms.fields.DateField always return a datetime.date instance?

2014-03-04 Thread Peter Bengtsson
On Tuesday, March 4, 2014 12:47:03 PM UTC-8, Tom Evans wrote: > > On Tue, Mar 4, 2014 at 8:27 PM, Peter Bengtsson > <pet...@gmail.com> > wrote: > > I've been googling for an explanation but nothing's come up. > > > > See > > https://github.

Why doesn't a forms.fields.DateField always return a datetime.date instance?

2014-03-04 Thread Peter Bengtsson
I've been googling for an explanation but nothing's come up. See https://github.com/django/django/blob/master/django/forms/fields.py#L447 If you use a `DateField` in your form, don't you expect it to produce a `datetime.date` instance? E.g. class MyForm: start = forms.DateField() def

Very strange KeyError on 'PORT' in db/backends/mysql/base.py

2011-11-23 Thread Peter Bengtsson
(django version 1.3.1) To explain my set up would be very hard as it's not just plain Django but there's a bunch of other third parties involved but we'll have to try. I'm getting this traceback when running tests:: Traceback (most recent call last): File

Can I run tests without installing indexes?

2010-09-23 Thread Peter Bengtsson
When not using SQLite for running my tests it takes a aweful long time to install all the indexes. Considering that indexes are there for speeding up selects when the number of rows is very high I realise I don't need them during a test run. Is there a way to disable index creation during the

Re: Image Upload question

2010-09-23 Thread Peter Bengtsson
By being bound it means that you will have run the .is_valid() method of the form instance once you've instanciated it with your POST and FILES data. E.g. form = BrewImageFrom(data=request.POST, files=request.FILES) if form.is_valid(): brewimage = form.save() On Sep 23, 3:00 pm, Joel Klabo

Re: How to implement this model

2010-06-16 Thread Peter Bengtsson
Without caring or even attempting to understand your business I sounds like you just need to stop using a BooleanField() and instead use a ForeignKey(null=True) and then judge if it's "on_premise" by a method rather than a field something like this: class MyModel(Model): related_premise =

Why does django's default test suite runner set settings.DEBUG = False?

2010-06-16 Thread Peter Bengtsson
This is a new feature of Django 1.2. I'm curious, why does it want to do this? I want to control this for my settings so that I can things like disabled verify_exists on my URLFields when I run tests. # django/test/simple.py class DjangoTestSuiteRunner(object): def __init__(self,

Re: Django list_filter

2010-05-20 Thread Peter Bengtsson
There are much more efficient tree implementation made available for Django. https://tabo.pe/projects/django-treebeard/ A much better place to start. On 20 May, 07:06, Danfi wrote: > Hi, > In my models, I use "parent = models.ForeignKey('self', blank = True, > null = True) "

Re: django filters

2010-05-20 Thread Peter Bengtsson
The way you set up the ordering (e.g. 'change_date') just change that to '-change_date'. A minus in front of the ordering keyword reverses the sort order. On 20 May, 06:32, rahul jain wrote: > Hi, > > In my model, I have set up one filter which helps in filtering out the

Re: Grouped statements in debug_toolbar

2010-03-26 Thread Peter Bengtsson
On 26 March 2010 11:09, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Mar 25, 7:17 pm, Peter Bengtsson <pete...@gmail.com> wrote: >> The old django debug-toolbar used to make it possible to group >> statements that were the same so you can see if a particu

Re: About extending User model

2010-03-25 Thread Peter Bengtsson
Generally, try to build your application so that it doesn't blindly depend on the profile existing. The signal example Tom showed you is good as it means you won't have to check if the UserProfile instance exists for the user on every turn. However, don't depend on the data within. Keep it light

Re: Nested for loop: {% cycle ... %}

2010-03-25 Thread Peter Bengtsson
Is it possible to do {% cycle "odd" "even" as parent_cycle_thing %} ? If so there's your answer. On 25 Mar, 19:57, mhulse wrote: > Hi! > > Example code: > > == > > {% for pretty_date, days_events in date_days_events_tuple %} > ... > > ... > {% for details in

Re: auto authenticate

2010-03-25 Thread Peter Bengtsson
If what you want to achieve is to log in a user programmatically you don't do that by authenticating by username and password. Example: def login_by_id(request): user = FacebookUser.objects.get(...).user from django.contrib.auth import load_backend, login for

Grouped statements in debug_toolbar

2010-03-25 Thread Peter Bengtsson
The old django debug-toolbar used to make it possible to group statements that were the same so you can see if a particular statement was called repeatedly. This does not appear to be possible in the latest version; or am I wrong? -- You received this message because you are subscribed to the

Running multiple FCGI processes out of the same directory

2010-02-14 Thread Peter Bengtsson
I'm running Nginx in front of Django using FCGI. I start it something like this in my bash sysadmin scripts: python /foo/manage.py runfcgi host=127.0.0.1 port=9000 pidfile=/var/ foo.pid \ errlog=err.log outfile=out.log What I'm contemplating is running multiples of this

Re: Django Admin interface and filter by value

2010-01-24 Thread Peter Bengtsson
Sounds like something you'd have to do with javascript by extending the admin interface's templates. Any other default values are best done by settings up signals for your User class. On a more general, yet important note, I would strongly advice against making your own User model unless you

Re: Setting a user to have particular permission group when registering with django-registration?

2010-01-24 Thread Peter Bengtsson
Use signals. django-registration will create a new User so you can do something like this: from django.db.models.signals import post_save def give_permission(sender, user, created, **__): if created: user.groups.add(u"My group") post_save.connect(give_permission, sender=User) If you

Re: Best Practice for developing djangoapp in a repository

2010-01-24 Thread Peter Bengtsson
Just install django-tagging as normal so that it's on the system path and included in your settings.py INSTALLED_APPS. Then you can run its tests. Leave it like that. Then to make it work exactly like you want it to work, subclass it. Your other apps shouldn't pretend to depend on tagging but

Re: newline in GET data

2010-01-24 Thread Peter Bengtsson
It's not stripped by Django. You must just have forgotten to urlencode the parameters before it goes back into the app. On Jan 22, 12:00 am, Sumanth wrote: > Hi , > > I am having newlines in GET data , but when the data comes to server > newline chars are removed. Is that

Re: cache large files

2010-01-24 Thread Peter Bengtsson
Keep it simple. Use nginx or apache and in your Django app you simply write to the filesystem. "Invalidation" can be done by simply deleting the file which is easy. Something like nginx for serving static file is faster than anything else. I'm sure you already know how to deploy static files such

Re: "Unsupressing" errors when called from templates

2009-10-22 Thread Peter Bengtsson
2009/10/22 bruno desthuilliers <bruno.desthuilli...@gmail.com>: > > > > On 21 oct, 16:00, Peter Bengtsson <pete...@gmail.com> wrote: >> On 21 Oct, 14:29, bruno desthuilliers <bruno.desthuilli...@gmail.com> >> wrote:> On 21 oct, 15:

Re: admin actions bar in django 1.1

2009-10-21 Thread Peter Bengtsson
What customizations have your done in the templates/admin/ folder of the app that isn't working? On 21 Oct, 17:22, kkerbel wrote: > i upgraded django 1.0.2 to 1.1 stable and I cannot see the admin > actions bar in one of my apps...or any of them for that matter.  My > fresh

Re: "Unsupressing" errors when called from templates

2009-10-21 Thread Peter Bengtsson
On 21 Oct, 14:29, bruno desthuilliers <bruno.desthuilli...@gmail.com> wrote: > On 21 oct, 15:05, Peter Bengtsson <pete...@gmail.com> wrote: > > > Suppose I've got this code: > > > # template.html > > Info: {{ article_instance.count_words }} words > >

Re: "Unsupressing" errors when called from templates

2009-10-21 Thread Peter Bengtsson
Found the ticket for it: http://code.djangoproject.com/ticket/11421 On 21 Oct, 14:17, Peter Bengtsson <pete...@gmail.com> wrote: > UPDATE! > If I raise some other error inside the python code (e.g. ValueError) > it's not suppressed. > Seems a design error in Django. Will carry

Re: "Unsupressing" errors when called from templates

2009-10-21 Thread Peter Bengtsson
UPDATE! If I raise some other error inside the python code (e.g. ValueError) it's not suppressed. Seems a design error in Django. Will carry on this discussion somewhere else. On 21 Oct, 14:05, Peter Bengtsson <pete...@gmail.com> wrote: > Suppose I've got this code: > > # templ

Re: efficiently deleting content based on how old it is

2009-10-21 Thread Peter Bengtsson
On 20 Oct, 15:48, Chris Withers wrote: > Shawn Milochik wrote: > > I know this doesn't answer the hard part of your question, but here's   > > a simple way I delete old stuff from a database via an external script   > > that's run by cron: > > >

"Unsupressing" errors when called from templates

2009-10-21 Thread Peter Bengtsson
Suppose I've got this code: # template.html Info: {{ article_instance.count_words }} words # models.py class Article(models.Model): text = models.TextField() def count_words(self): raise AttributeError('debugging') Then, when I render that page I get: Info: words When I want

Re: get current URL

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

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

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

Re: filter on entries from a certain user

2009-09-14 Thread Peter Bengtsson
entity? There must be something similar as auro_current_user_add you > would think? > There isn't. The current logged in user is available from the request which is something you only have in views. The models is just about mapping SQL to python classes. > On Sep 13, 4:55 pm, Peter Bengtsso

Re: html template usage

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

Re: filter on entries from a certain user

2009-09-13 Thread Peter Bengtsson
I dont know what db.UserProperty() is but my guess is that that's something related to the model. Your form doesn't understand that so it defaults to None. If you omit the field owner from the form, perhaps the form won't attempt to fiddle with this and then the model is allowed to do it's magic.

Re: Memory limits

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

Re: urls.py

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

Re: post_save signal to create the new user profile

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

Re: File Field max size and admin interface

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

Re: Dynaically fields to a formwizard form

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

Re: Many-to-many column

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

Re: json serialization error on arrays

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

Re: Test client and form processing

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

Re: Raw HTTP request processing?

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

Re: print PDF on windows

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

Re: Raw HTTP request processing?

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

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

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

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

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

Have I found a bug? Deletion and rolled back transactions

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

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

2009-08-03 Thread Peter Bengtsson
gt; Thank you Peter. > > But list_display does not get used on the edit page of an object. > > If you use raw_id the ID of the foreign key gets displayed right to the > input field. It would be nice to make it a hyperlink. > >   HTH, >     Thomas > > Peter Bengtsson schrieb:

Re: how to, complex filters in admin

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

Re: Image handling - Custom image field?

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

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

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

Re: how to modified filefiled after created it

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

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

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

How to rerun tests on file changes

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

Re: Admin list_filter and using a method instead

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

Re: Admin list_filter and using a method instead

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

Admin list_filter and using a method instead

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

Invalidate a cache_page view

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

Re: Manual transactions in command

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

Manual transactions in command

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

Searching a list of Q

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

locmem or memcache

2008-11-28 Thread Peter Bengtsson
What's faster, locmem or memcache? I know that the docs rave on about how fast memcache is but what about locmem? That sounds pretty fast to me since it doesn't need another TCP service and just uses the RAM. My particular site (for mobile phones without any media) is so tiny that I wouldn't

Re: Ordering bookeditions by their rating

2008-11-28 Thread Peter Bengtsson
The trick is to use .query.group_by. Here's an example that will work:: >>> from collection.models import Edition, User, Rating >>> Rating.objects.all().delete() >>> Edition.objects.all().delete() >>> >>> e1 = Edition.objects.create(title=u'Title1', binding=u'') >>> e2 =

Re: ImageField upload_to not workin

2008-11-14 Thread Peter Bengtsson
On Nov 14, 9:31 pm, Javier <[EMAIL PROTECTED]> wrote: > Hi, > > I've create a model: > > class ImagenesLugar(models.Model): >     archivo = models.ImageField(upload_to="imageneslugar/") >     texto = models.CharField(max_length=400) > > The thing is that when i create a new instance of this

Turning key=value1=value2=value3 into a list

2008-11-12 Thread Peter Bengtsson
If I publish http://someurl/myview?foo=1=2=3 How do I turn this into foo = ['1','2','3']? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: www.djangosnippets.org is down now?

2008-10-22 Thread Peter Bengtsson
Not down but you get lots of errors. They're probably working on it. I hope. On Oct 22, 5:08 pm, Gmail <[EMAIL PROTECTED]> wrote: > i found lots of snippets to download,but the server always says it is   > down. --~--~-~--~~~---~--~~ You received this message

Re: Test client: how to tell if user is logged in?

2008-10-22 Thread Peter Bengtsson
It's definitely possible. Here's an example: from django.contrib.auth.models import User staff = User.objects.create_user(username='s', password='s', email='[EMAIL PROTECTED]') #staff.is_staff = True client = Client() assert client.login(username='s',

Re: Forms generated from models missing primary key

2008-10-22 Thread Peter Bengtsson
On Oct 22, 8:24 am, MrMuffin <[EMAIL PROTECTED]> wrote: > I'm generating html forms from models using ModelForm. When I do > something like : > > >>> article = Article.objects.get(pk=1) > >>> form = ArticleForm(instance=article) > Change it's widget to hidden I think should work >>> from

Re: Accessor for field 'user' clashes with related field 'User.*'

2008-10-22 Thread Peter Bengtsson
I don't see what splitting it up into "sub apps" has anything to do with it? What happens when you add the related_name attribute to your model fields? Here's some code from one of my apps: class M(models.Model): ... from_user = models.ForeignKey(User, null=True, related_name='from')

Re: second post:Please answer!How to compare from two models in the same function (view)?

2008-10-22 Thread Peter Bengtsson
On Oct 22, 1:23 pm, Net_Boy <[EMAIL PROTECTED]> wrote: > Hi, >    I am trying to make a view function to get the posted values and > make some comparison (if x.value >= y.value).. > where x is the model that I got it's values from the post > and   y is the other model . > > example: > > def

Re: ViewDoesNotExist: Even though it does

2008-10-22 Thread Peter Bengtsson
Have you written a unit test that executes the view? If so, and if it doesn't always happen, you can run the unit test over and over quickly to see if it has something strange to do with the order of how things are important or something crazy like that. By the way, writing tests can often help

Re: Django Suitability

2008-10-22 Thread Peter Bengtsson
On Oct 22, 3:56 pm, "Matthew Talbert" <[EMAIL PROTECTED]> wrote: > Hi all, > > I am being considered for a project that would involve re-writing an > application which is currently in MS Access/VBA. The application is an order > entry/shop management software for a small vertical market. I am

Re: www.djangosnippets.org is down now?

2008-10-22 Thread Peter Bengtsson
When I get an error on viewing a snippet I copy the URL into Google and click the Cached version. On Oct 22, 5:08 pm, Gmail <[EMAIL PROTECTED]> wrote: > i found lots of snippets to download,but the server always says it is   > down. --~--~-~--~~~---~--~~ You

Re: Split a form up in the template/view?

2008-10-22 Thread Peter Bengtsson
On Oct 22, 5:10 pm, Ardesco <[EMAIL PROTECTED]> wrote: > Taking an example from Chapter 7 of the Django Book: > > from forms import PublisherForm > > def add_publisher(request): >     if request.method == 'POST': >         form = PublisherForm(request.POST) >         if form.is_valid(): >      

Re: actual django stack

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

Discover tests in forms.py

2008-09-04 Thread Peter Bengtsson
>From http://www.djangoproject.com/documentation/testing/ "4. Looking for unit tests and doctests in the models.py and tests.py files in each installed application." Next to models.py I have forms.py which does exactly what the filename suggests: it defines forms. I've put some doctests in these

More advanced test runner available?

2008-08-25 Thread Peter Bengtsson
Is there an alternative to the test runner that comes by defauly with Django (svn version)? The one that you get doesn't have colour coding and it doesn't have the option to stop all other tests after the first failure. --~--~-~--~~~---~--~~ You received this

Trapping template errors

2008-06-16 Thread Peter Bengtsson
I have TEMPLATE_DEBUG on but if I write:: X{{ somethingthatdoesnotexits }}X The output is just XX and no error. How can I enable explicit rendering and raise errors on typos in the templates? --~--~-~--~~~---~--~~ You received this message because you are

Re: library import issue.

2008-06-16 Thread Peter Bengtsson
On Jun 16, 11:07 am, "James Matthews" <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to import a library that is in a non-standard location ~/opt/lib > (I am in a shared environment) and i added it to my "LD_LIBRARY_PATH" > however Django tells me it cannot find it and me a 500 error. > > In