Re: Social Networking basics? -Raj

2011-06-21 Thread Piotr Zalewa
Do we have a group FAQ? On 06/20/11 22:44, Cal Leeming [Simplicity Media Ltd] wrote: On Mon, Jun 20, 2011 at 10:32 PM, Shawn Milochik mailto:sh...@milochik.com>> wrote: Is it just me or are we having a sudden spurt of e-mail that goes like this: Q: How do I A: You do X

Re: Avoiding Repetition

2011-06-21 Thread Derek
On Jun 18, 4:33 am, Nikhil Somaru wrote: > Hi, > > Is there a way to reduce the repetition in the following form classes: > > class ItemsStep2(ModelForm): #approval >     class Meta: >         model = OrderItem >         fields = ('item', 'quantity_requested', 'quantity_approved') >         widget

Re: Many user profiles

2011-06-21 Thread gontran
Thank you very much Francesco, Works like a charm... On 20 juin, 15:33, francescortiz wrote: > Try doing this in your models.py: > > def get_profile(self): >     ...your code to get the profile for a the user... > > User.get_profile = get_profile > > On Jun 20, 9:54 am,gontran wrote: > > > Hello

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Daniel Roseman
On Tuesday, 21 June 2011 01:53:23 UTC+1, Jeff Blaine wrote: > > I can't seem to figure out what is causing this: According to the > following 2 models > and the 'python manage.py shell' session shown after them, I am getting 2L > as a > return value from a certain call when I would expect u'redh

Caught DatabaseError while rendering: no such function: IF

2011-06-21 Thread yomguy
Hi ! MySQL and SQLite3 seem to have different behaviour here : when I have {% if collections %} in a template, where collections is a queryset, using SQlite3 gives this exception : "Caught DatabaseError while rendering: no such function: IF"... No pb with MySQL... Any idea please ? Thanks ;

Re: Caught DatabaseError while rendering: no such function: IF

2011-06-21 Thread Daniel Roseman
On Tuesday, 21 June 2011 10:17:35 UTC+1, yomguy wrote: > > Hi ! > > MySQL and SQLite3 seem to have different behaviour here : > > when I have {% if collections %} in a template, where collections is a > queryset, > using SQlite3 gives this exception : > > "Caught DatabaseError while rendering: no

Re : Re: Caught DatabaseError while rendering: no such function: IF

2011-06-21 Thread yomguy
collections is a queryset coming from urls.py: all_collections = { 'queryset': MediaCollection.objects.enriched(), } and passed to the template like this: url(r'^collections/$', 'django.views.generic.list_detail.object_list', dict(all_collections, paginate_by=20, template_name="telemeta

Re: Re : Re: Caught DatabaseError while rendering: no such function: IF

2011-06-21 Thread Daniel Roseman
On Tuesday, 21 June 2011 11:13:35 UTC+1, yomguy wrote: > > collections is a queryset coming from urls.py: > > all_collections = { 'queryset': MediaCollection.objects.enriched(), } > But what is 'enriched()'? Honestly, if you're using custom code to get objects, and are having trouble in a view th

RE: Django caching not working with SSL(https)

2011-06-21 Thread Anoop Thomas Mathew
Hi all, A site which was caching through django caching backend db cache) it was working well. When we changed it to https instead of http, the system suddenly stopped caching. Is there any thought's regarding this? Anyone got the same issue? regards, Anoop atm ___ Life is short, Live it hard.

Re: Form with manytomany field

2011-06-21 Thread Rd
Guys i also have a problem. Its like I have a many to many field. My Models are : class Catogary(models.Model): catogary = models.CharField(max_length=50 , unique=True, primary_key=True) def __unicode__(self): return self.catogary class Preferences(models.Model): user= mod

Weird django caching problem

2011-06-21 Thread philippw
hi. i have weird caching problems with the 1.3 version of django. I probably have something configured wrong, but am not sure what. A good example is django-avatar, which uses caching and many people use it. Even if I dont have a cache backend defined the avatar seems to be cached, which by itsel

Caught DatabaseError while rendering: no such function: IF

2011-06-21 Thread Parisson
Hi ! MySQL and SQLite3 seem to have different behaviour here : when I have {% if collections %} in a template, where collections is a queryset, using SQlite3 gives this exception : "Caught DatabaseError while rendering: no such function: IF"... No pb with MySQL... Any idea please ? Thanks ;)

Re: Weird django caching problem

2011-06-21 Thread Tom Evans
On Tue, Jun 21, 2011 at 9:20 AM, philippw wrote: > hi. > > i have weird caching problems with the 1.3 version of django. I > probably have something configured wrong, but am not sure what. > You don't mention how you have configured caching, which is relevant. By default, if you do not configure

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Malcolm Box
On 21 Jun 2011, at 01:53, Jeff Blaine wrote: > >>> from hostdb.models import Device, Interface > >>> hostname = 'beijing.mitre.org' > >>> dev = Interface.objects.get(fqdn=hostname).device > >>> dev.status > > >>> f = dev._meta.get_field('status') > >>> f.value_from_object(dev) > u'Online' > >>> #

csrf token driving me crazy

2011-06-21 Thread Divkis
Hi all, I am facing some really weird issue with csrf token handling in django 1.3. Until now I was using 1.2 and my views were working fine with ajax post requests by setting the X-CSRFToken. I upgraded to django1.3 and cleared all the cookies in my browser and I see that no csrktoken co

Re: syncdb doesn't create UserProfile table

2011-06-21 Thread Tom Evans
On Sat, Jun 18, 2011 at 8:27 AM, Kenneth Gonsalves wrote: > On Thu, 2011-06-16 at 12:13 +0100, Tom Evans wrote: >> On Thu, Jun 16, 2011 at 11:55 AM, Kenneth Gonsalves >> wrote: >> > those entries are old. The point is that the built in >> User.get_profile() >> > only works with onetoone. The diff

Re : Re: Re : Re: Caught DatabaseError while rendering: no such function: IF

2011-06-21 Thread yomguy
Sorry Daniel, you're right ! I thought the exception pointed out the "if" statement in the template, but it is in fact the "IF" command in my MediaCollectionQuerySet. Here is a part of the MediaCollectionManager with its "enriched" method: class MediaCollectionManager(CoreManager): "Manage

Re : Caught DatabaseError while rendering: no such function: IF

2011-06-21 Thread yomguy
Sorry for the flood ! yomguy -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/_taQC4J9xTMJ. To post to this group, send email to django-users@googlegroups.co

Re: problems using django-registration

2011-06-21 Thread Tom Evans
On Mon, Jun 20, 2011 at 10:15 PM, Kevin Miller wrote: > Hi all, > > I am in the process of finishing up an app. However, I just cannot > integrate django-registration and sessions properly. I can allow a > user to register and also log in. But > I am a bit confused in getting in to work with sessi

Re: csrf token driving me crazy

2011-06-21 Thread Daniel Roseman
On Tuesday, 21 June 2011 12:17:26 UTC+1, Divkis wrote: > > Hi all, > I am facing some really weird issue with csrf token handling > in django 1.3. Until now I was using 1.2 and my views were working > fine with ajax post requests by setting the X-CSRFToken. I upgraded to > django1.3

Re: Possible bug in form validation

2011-06-21 Thread Shawn Milochik
On 06/21/2011 12:17 AM, Ian Clelland wrote: On Mon, Jun 20, 2011 at 1:49 PM, Shawn Milochik > wrote: I know that, whenever someone finds a "bug" in Django they're usually doing something incorrectly. Hopefully someone will point out what I need to do to mak

Re: How do I create dynamic django models ?

2011-06-21 Thread Andre Terra
+1 on that link needing some review. Questions about dynamic models pop up often enough to warrant a canonical explanation. Sincerely, Andre Terra / airstrike On 6/21/11, Satyajit Sarangi wrote: > I went through this link , but couldn't really understand where to put > where . A little more help

Re: syncdb doesn't create UserProfile table

2011-06-21 Thread Kenneth Gonsalves
On Tue, 2011-06-21 at 12:49 +0100, Tom Evans wrote: > >> It will still work perfectly with ForeignKey(unique=True), > > > > the docs say one2one > > > > That doesn't negate my statement. > > You said that User.get_profile() will only work with OneToOneField, > which is incorrect, it will also wor

Re: How to send the class name from one template to another template both in different apps in django ?

2011-06-21 Thread Andre Terra
It seems you have an issue and you are asking for help on making your solution work, when you should be telling us what it is that you want to do. Only then will we be able to advise you. Sincerely, Andre Terra On 6/20/11, Satyajit Sarangi wrote: > Lets say I work on a class in one template by a

Re: [Forms] Avoiding Repetition

2011-06-21 Thread Nikhil Somaru
Thanks derek. On Sat, Jun 18, 2011 at 8:03 AM, Nikhil Somaru wrote: > Hi, > > Is there a way to reduce the repetition in the following form classes: > > class ItemsStep2(ModelForm): #approval > class Meta: > model = OrderItem > fields = ('item', 'quantity_requested', 'quantit

Re: [Forms] Avoiding Repetition

2011-06-21 Thread Andre Terra
I'm reading this on my phone, so I apologize in advice if I missed something crucial, but what's stopping you from subclassing and overriding just the relevant parts? Sincerely, Andre Terra On 6/17/11, Nikhil Somaru wrote: > Hi, > > Is there a way to reduce the repetition in the following form c

Re: How to send the class name from one template to another template both in different apps in django ?

2011-06-21 Thread Satyajit Sarangi
Lets say one template helps me in uploading a file . When I go to an app called permissions , directly from that template . I want to carry that file name with me , so that I can assign permissions to it . On Tue, Jun 21, 2011 at 5:39 PM, Andre Terra wrote: > It seems you have an issue and you a

Re: csrf token driving me crazy

2011-06-21 Thread Divkis
On Jun 21, 4:54 pm, Daniel Roseman wrote: > On Tuesday, 21 June 2011 12:17:26 UTC+1, Divkis wrote: > > > Hi all, > >           I am facing some really weird issue with csrf token handling > > in django 1.3. Until now I was using 1.2 and my views were working > > fine with ajax post requests by s

Re: How to send the class name from one template to another template both in different apps in django ?

2011-06-21 Thread Daniel Roseman
On Tuesday, 21 June 2011 13:16:47 UTC+1, Satyajit Sarangi wrote: > > Lets say one template helps me in uploading a file . When I go to an app > called permissions , directly from that template . I want to carry that file > name with me , so that I can assign permissions to it . > > You really do

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Jeff Blaine
Yes, seems that way, Malcom, but *why* class Device(models.Model): # ... status = models.ForeignKey(Status, blank=True, null=True, verbose_name="Status",

Re: problems using django-registration

2011-06-21 Thread Kevin Miller
Oh silly me. I was not returning user in the HttpResponse. I don't why I assumed that it would be automatically available. Thanks all. On Mon, Jun 20, 2011 at 9:13 PM, Kenneth Gonsalves wrote: > On Mon, 2011-06-20 at 16:15 -0500, Kevin Miller wrote: >> Can anyone please tell me how to integrate s

Re: problems using django-registration

2011-06-21 Thread Kevin Miller
Oh silly me. I was not returning user in the HttpResponse. I don't why I assumed that it would be automatically available. Thanks all. 2011/6/20 没必要吧 : > Do you remember return user in HttpResponse? > > -- > You received this message because you are subscribed to the Google Groups > "Django user

How to use django-profile with django registration ?

2011-06-21 Thread Satyajit Sarangi
https://bitbucket.org/ubernostrum/django-registration This is what I am using for user registration . Once , I log in the user is not able to get into the userprofile page . Thus I installed this https://bitbucket.org/ubernostrum/django-profiles/ for user profile . Now , this produces a conflict

Re: How to use django-profile with django registration ?

2011-06-21 Thread Piotr Zalewa
On 06/21/11 14:15, Satyajit Sarangi wrote: https://bitbucket.org/ubernostrum/django-registration This is what I am using for user registration . Once , I log in the user is not able to get into the userprofile page . Thus I installed this https://bitbucket.org/ubernostrum/django-profiles/ for us

Re: How to use django-profile with django registration ?

2011-06-21 Thread Satyajit Sarangi
I am using 1.3 This is my settings.py http://dpaste.com/556954/ This is my urls.py http://dpaste.com/556955/ On Tue, Jun 21, 2011 at 7:14 PM, Piotr Zalewa wrote: > On 06/21/11 14:15, Satyajit Sarangi wrote: > >> https://bitbucket.org/**ubernostrum/django-**registration

Re: How to use django-profile with django registration ?

2011-06-21 Thread Piotr Zalewa
In urls.py you've got: url(r'^accounts/', include('registration.urls')), and later: (r'^accounts/', include('userprofile.urls')), /me is no expert, but that smells like asking for trouble. zalun On 06/21/11 14:48, Satyajit Sarangi wrote: I am using 1.3 This is my settings.py http://dp

Re: How to use django-profile with django registration ?

2011-06-21 Thread Satyajit Sarangi
Yes I know thats the problem . But , want to know whats the way out . On Tue, Jun 21, 2011 at 7:52 PM, Piotr Zalewa wrote: > In urls.py you've got: > url(r'^accounts/', include('registration.urls')), > > and later: >(r'^accounts/', include('userprofile.urls')), > > /me is no expert, but th

Re: Unit-Testing Dilemma

2011-06-21 Thread Nan
> Your view function may indeed be too complex to test properly, and it sounds > like it is too tightly coupled with with the API call -- there is no way to > call the view without having it call the actual 3rd-party API as imported at > the top of the file. I'd be a little confused as to how to

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Jeff Blaine
Okay, here's the problem. >>> f = dev._meta.get_field('distro') >>> f.value_from_object(dev) 2L value_from_object is defined as: def value_from_object(self, obj): "Returns the value of this field in the given model instance."

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Tom Evans
On Tue, Jun 21, 2011 at 3:47 PM, Jeff Blaine wrote: > Any ideas?  I really want (concept) > "myfield.unicode_representation_of_object(myobject)" > unicode(myobject.myfield) // unicode(getattr(myobject, 'myfield')) Am I being dense? Tom -- You received this message because you are subscribed t

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Malcolm Box
On 21 June 2011 15:47, Jeff Blaine wrote: > Okay, here's the problem. > > >>> f = dev._meta.get_field('distro') > >>> f.value_from_object(dev) > 2L > > >>> f.attname > 'distro_id' > >>> > > As others guessed, value_from_object() is returning the pk ID in this > case. > > Model "Distro" is the onl

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Daniel Roseman
On Tuesday, 21 June 2011 15:47:32 UTC+1, Jeff Blaine wrote: > > Okay, here's the problem. > > >>> f = dev._meta.get_field('distro') > >>> f.value_from_object(dev) > 2L > > value_from_object is defined as: > > > def value_from_object(self,

Re: Unit-Testing Dilemma

2011-06-21 Thread Ian Clelland
On Tue, Jun 21, 2011 at 7:30 AM, Nan wrote: > > > > Your view function may indeed be too complex to test properly, and it > sounds > > like it is too tightly coupled with with the API call -- there is no way > to > > call the view without having it call the actual 3rd-party API as imported > at >

QuerySet .annotate().extra() issues

2011-06-21 Thread Michał Sawicz
Hi all, I'm not sure it's actually supposed to work, but looks like a common enough approach that it should. Say you have an aggregate query: > Model.objects.values('field').annotate(Sum('count')) that results in an aggregate query that follows: > SELECT "models_model"."field", SUM("models_model"

csrf protection and testing with tsung

2011-06-21 Thread Ivan Uemlianin
Dear All I have a live(ish) django website which I'm testing with tsung. With tsung you record a site visit (called a session) --- log in, view various pages, do a few things, log out --- and tsung will then hit the site with lots of randomised versions of this session. Many of the views are csr

Re: Unit-Testing Dilemma

2011-06-21 Thread Nan
> That's what I was suggesting; that way the view becomes simple enough that > anyone looking at it can be assured of its correctness, without a host of > unit tests. Those tests can be applied to the functions that actually > construct the messages. Right, it's really those supporting functions

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Jeff Blaine
On Tuesday, June 21, 2011 11:00:37 AM UTC-4, Tom Evans wrote: > > On Tue, Jun 21, 2011 at 3:47 PM, Jeff Blaine wrote: > > Any ideas? I really want (concept) > > "myfield.unicode_representation_of_object(myobject)" > > > > unicode(myobject.myfield) // unicode(getattr(myobject, 'myfield')) > > Am I

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Jeff Blaine
> > But why do you need to get that value via the *field* object? The usual way > to do it is simply to access the attribute directly on the model instance: > > unicode(dev.distro) > > or, if you have the field name as a string as you imply originally, use > `getattr`: > > unicode(getatt

making instance of auth User results in: maximum recursion depth exceeded while calling a Python object

2011-06-21 Thread T'mas
Hi there, I am having problem with User model from django.contrib.auth.models. When making instance in view: user = User.objects.get(username='tmas') it results in error: maximum recursion depth exceeded while calling a Python object I am running Xubuntu 11.04, python 2.7.1+ and django 1.3. Run

Re: making instance of auth User results in: maximum recursion depth exceeded while calling a Python object

2011-06-21 Thread T'mas
sorry. Problem is not User object but login from django.contrib.auth. login(request,user) On Jun 21, 6:21 pm, "T'mas" wrote: > Hi there, > > I am having problem with User model from django.contrib.auth.models. > When making instance in view: > > user = User.objects.get(username='tmas') > > it re

Re: How to use django-profile with django registration ?

2011-06-21 Thread Cal Leeming [Simplicity Media Ltd]
You are kidding right? The job of a developer isn't just to write code, it's to solve problems. django-users is *not* your personal tutor. On Tue, Jun 21, 2011 at 3:27 PM, Satyajit Sarangi wrote: > Yes I know thats the problem . But , want to know whats the way out . > > > On Tue, Jun 21, 2011

Re: How to use django-profile with django registration ?

2011-06-21 Thread Piotr Zalewa
On 06/21/11 15:27, Satyajit Sarangi wrote: Yes I know thats the problem . But , want to know whats the way out . Theway out is to read documentation: https://docs.djangoproject.com/en/1.3/ especially https://docs.djangoproject.com/en/1.3/topics/http/urls/ zalun On Tue, Jun 21, 2011 at 7:52

Re: csrf protection and testing with tsung

2011-06-21 Thread Malcolm Box
On 21 June 2011 16:48, Ivan Uemlianin wrote: > With tsung you record a site visit (called a session) --- log in, view > various pages, do a few things, log out --- and tsung will then hit > the site with lots of randomised versions of this session. > > Many of the views are csrf protected, and th

Tests got ~10x slower after upgrading to Django 1.3

2011-06-21 Thread Cesar Canassa
I am working in a large Django project that is currently using the 1.2.3 version. The project test suite has around 500 test which take ~50 seconds to run in my machine. I recently did a upgrade to the Django 1.3 version, the upgrade was smooth so far, most problems came from the SQL Server driver

Re: QuerySet .annotate().extra() issues

2011-06-21 Thread Andre Terra
BIG FAT DISCLAIMER I'm not sure this has anything to do with your issue, but it's easy to miss when reading the docs. https://docs.djangoproject.com/en/dev/topics/db/aggregation/#interaction-with-default-ordering-or-order-by If your model has an 'ordering' attribute defined in Meta, make sure yo

saving related objects in overridden save method on model

2011-06-21 Thread lingrlongr
I have these models: class Widget(models.Model): name class Person(models.Model): requested = models.ForeignKey(Widget, related_name='requested') considered = models.ManyToManyField(Widget, related_name='considered') def save(self, *args, **kwargs): if not self.considered

Re: saving related objects in overridden save method on model

2011-06-21 Thread lingrlongr
Woops, I forgot to include the super's save method call in my example. Just want to make sure no one thinks that was the problem... def save(self, *args, **kwargs): if not self.considered.filter(id=self.requested.id): self.considered.add(self.requested) super(Person, self).save(*ar

Signals and model instances with deferred attributes

2011-06-21 Thread Christian Joergensen
Hello, I am experiencing an inconvenience in regards to working with signals on model instances with deferred attributes. Specifically I am trying to get a post_save signal to fire from a save() call on such a model instance. The problem is that the sender class (`origin` in django.db.models.base

WMD-editor: Where's wmd/urls.py?

2011-06-21 Thread Micky Hulse
Anyone here using django-wmd-editor? https://github.com/jpartogi/django-wmd-editor If so, could you tell me what its url.py file is supposed to look like? :D Maybe I am missing something obvious here, but wmd/urls.py does not exist... What am I missing? Thanks so much! Micky -- You received t

set language from user lang in DB?

2011-06-21 Thread galgal
What is the best way to set language that is in DB in UserProfile? I have option to select language for users and after selecting it, I update UserProfile table to set the language. While logging in, i need to get user language from his profile and set it. User changes are made by selecting o

Odp: Re: Change language on login

2011-06-21 Thread galgal
Which solution did You use? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/cTfGWDuX48UJ. To post to this group, send email to django-users@googlegroups.com

Detecting write to readonly DB slave

2011-06-21 Thread Marty
I'm trying to add functionality to my django project to catch anybody accidentally sending a write to a readonly replicated DB slave. Is there a "best practices" way to do this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gr

Re: csrf protection and testing with tsung

2011-06-21 Thread Ivan Uemlianin
Dear Malcolm Thanks, this is a good clue. I'll try it out tomorrow and report back. Best wishes Ivan On 21/06/11 17:54, Malcolm Box wrote: On 21 June 2011 16:48, Ivan Uemlianin wrote: With tsung you record a site visit (called a session) --- log in, view various pages, do a few things, lo

Re: QuerySet .annotate().extra() issues

2011-06-21 Thread Michał Sawicz
Dnia 2011-06-21, wto o godzinie 14:31 -0300, Andre Terra pisze: > I'm not sure this has anything to do with your issue, but it's easy to > miss when reading the docs. It's kind of related, but not directly. The similarity to the issue mentioned above is that the default ordering field is added to

ANN: django-kolibri - a concept for Asynchronous Processors/Workflow management for django.

2011-06-21 Thread Thomas Weholt
Proof of concept. Need comments. Released under a modified BSD-license. http://pypi.python.org/pypi/Kolibri/0.1.0a or better https://bitbucket.org/weholt/django-kolibri There's a blogpost with two screencasts at http://weholt.blogspot.com/ as well. NB! If anybody can tell me why my my pypi-ent

Re: ANN: django-kolibri - a concept for Asynchronous Processors/Workflow management for django.

2011-06-21 Thread Calvin Spealman
Interesting project. My first question was going to be "Why aren't you just using Celery?" until I got to the part of the description that says it is built on *top* of celery. The first question that comes up for me is how or if you track which processes have already been run, to keep them from be

Re: ANN: django-kolibri - a concept for Asynchronous Processors/Workflow management for django.

2011-06-21 Thread Thomas Weholt
On Tue, Jun 21, 2011 at 11:16 PM, Calvin Spealman wrote: > Interesting project. My first question was going to be "Why aren't you > just using Celery?" until I got to the part of the description that > says it is built on *top* of celery. Yes, it might be a good idea to put that in the beginning

Re : Re: Re : Re: Caught DatabaseError while rendering: no such function: IF

2011-06-21 Thread yomguy
OK, this "virtual" method calls a MySQL command that need to be translated in SQLite language if I need it. One solution is to check the engine used in settings. Y -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the w

Re: ANN: django-kolibri - a concept for Asynchronous Processors/Workflow management for django.

2011-06-21 Thread Andre Terra
I only got as far as reading the project overview, but it looks incredibly sweet. Will have to give it a try over the weekend. Keep up the good work! Sincerely, André Terra On Tue, Jun 21, 2011 at 6:29 PM, Thomas Weholt wrote: > On Tue, Jun 21, 2011 at 11:16 PM, Calvin Spealman > wrote: > > I

Using multiple forms to manage a model under admin

2011-06-21 Thread Eiji Kobayashi
Hello, I have a question for all you django wizards. I want to use different forms for managing a model in Django's admin. I thought it's common problem, but I cannot find a good solution even after reading through google, stackoverflow and django's source code. (My apologies if this is a often as

Re: Unit-Testing Dilemma

2011-06-21 Thread Andy McKay
On 2011-06-20, at 12:52 PM, Nan wrote: > I'm not testing the third-party service. I need to test *what I send > to them*. Use Mock and assert_called_with: http://www.voidspace.org.uk/python/mock/mock.html#mock.Mock.assert_called_with In this case you'd set theAPI.call as your mock and check

how to display form data with original values after validation failure?

2011-06-21 Thread snfctech
In the case of editing a form, I want to display the original value of a field prior to validation failure, as well as the validation errors. This doesn't seem to work: if fs.is_valid(): fs.save() else: # return original data - not default c

Re: how to display form data with original values after validation failure?

2011-06-21 Thread Shawn Milochik
One good way is to just use AJAX: If it's a 'get' request, return your rendered template as normal. If it's a 'post' request, return a JSON response that has a success/failure status and confirmation/error messages (form.errors.as_text()). I'm doing this using jquery-notify to tell the user th

Re: Tests got ~10x slower after upgrading to Django 1.3

2011-06-21 Thread Russell Keith-Magee
On Wed, Jun 22, 2011 at 1:31 AM, Cesar Canassa wrote: > I am working in a large Django project that is currently using the 1.2.3 > version. The project test suite has around 500 test which take ~50 seconds > to run in my machine. > I recently did a upgrade to the Django 1.3 version, the upgrade wa

Re: how to display form data with original values after validation failure?

2011-06-21 Thread snfctech
Thanks for your reply, Shawn. I'll think about that - but I think I would prefer to use more boiler- plate Django form behavior and just get a formset with errors returned to my template in the full-page response. On Jun 21, 5:44 pm, Shawn Milochik wrote: > One good way is to just use AJAX: If i

syncdb error

2011-06-21 Thread T4 Phage
Hello! When I run syncdb it returns an error ending in "_mysql_exceptions.OperationalError: (1050, "Table 'people_person' already exists")." I know that the table 'people_person' already exists because I used syncdb to make it earlier (and because I can see it in my database). Of course if I dum

Re: Unit-Testing Dilemma

2011-06-21 Thread Andrew Brookins
You don't need mocks or dependency injection in this case. Just separate the message construction code, so you can test it in isolation: # myapp.views from django.http import HttpResponse from myapp.models import CurrentState from myapp.exceptions import ApiFailureException from third_party.api i

Re: csrf token driving me crazy

2011-06-21 Thread Divkis
Is there no one who has had similar problem with django1.3? Could anyone please help me on this? I have almost hit a dead on this one. Thanks & Regards, Divkis01 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Upcoming Django conference in Asia Pacific

2011-06-21 Thread Dealshelve Team
Hey guys, Do we have any upcoming Django conference in Asia Pacific region or any Django conference at all here? Cheers, Dealshelve Team http://dealshelve.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Upcoming Django conference in Asia Pacific

2011-06-21 Thread Russell Keith-Magee
On Wed, Jun 22, 2011 at 1:59 PM, Dealshelve Team wrote: > Hey guys, > > Do we have any upcoming Django conference in Asia Pacific region or any > Django conference at all here? There is usually a Django presence (i.e., a core developer or two, a few talks, and many Django users) at PyCon.AU, PyCo

updating a user form?

2011-06-21 Thread raj
I'm trying to create an update_profile form. This form will be able to update extended user information that is not in the original form. So, I have a form that allows you to create an account. There a lot of other fields that aren't listed in this form. The rest of these fields will be found when

Re: updating a user form?

2011-06-21 Thread Herman Schistad
On Wed, Jun 22, 2011 at 08:28, raj wrote: > I'm trying to create an update_profile form. This form will be able to > update extended user information that is not in the original form. > > So, I have a form that allows you to create an account. There a lot of > other fields that aren't listed in th

MemoryError

2011-06-21 Thread Gagan (GPS)
Hi, I am building a website that can access data from my server, plot it and present it in a pdf format. I am experiencing the following error and am unable to understand what to do. Kindly help. Traceback (most recent call last): File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run

Re: Upcoming Django conference in Asia Pacific

2011-06-21 Thread Kenneth Gonsalves
On Wed, 2011-06-22 at 14:08 +0800, Russell Keith-Magee wrote: > > Do we have any upcoming Django conference in Asia Pacific region or > any > > Django conference at all here? > > There is usually a Django presence (i.e., a core developer or two, a > few talks, and many Django users) at PyCon.AU, P