Re: export .csv file from database

2013-07-19 Thread Peter of the Norse
Two things: First, Ms Excel sucks. From that attached screenshot it's obvious that it thought it was a space separated file. When actually using MS Office, I recommend that you add `quoting=csv.QUOTE_ALL` to all csv writers. Second, the HttpResponse object is file-like. You don't need to jump

Re: Allow users to have a online store on the site

2013-07-19 Thread Mike Dewhirst
On 20/07/2013 8:36am, Karl Arunachal wrote: Hello, There's one plugin for wordpress called Marketpress E commerce, it has many features, but what i am interested is that, with that plugin users can create online store in your site and sell their products. So, is there any plugin or package like

Search from database

2013-07-19 Thread Kamal Kaur
Can we have a search module in django that can suggest resembling spellings from mysql database? -- Kamaljeet Kaur Blog:http://kamalkaur188.wordpress.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: label_tag() escapes output twice

2013-07-19 Thread sephii
On Friday, 19 July 2013 11:31:27 UTC+2, Tom Evans wrote: > > On Thu, Jul 18, 2013 at 10:31 PM, sephii > wrote: > > Hello, > > > > I'm trying to output a simple form but the label_tag() method tries to > > escape the field label twice. Here's what I have: > > > > #

How to Create an Auto Incrementing Integer Field

2013-07-19 Thread Cody Scott
I have a list of articles and you can control the order of the articles by changing the order field in the model order = models.IntegerField(default=1) I would like it to default to one more than the last article or one more than the largest order (since you can set the order) I can't

Re: Django admin automatically adding slash to a URL field after update

2013-07-19 Thread ecasbas
Vicherot, thanks a lot for the response. The Django version which I am experimenting this issue is: >>> django.VERSION (1, 4, 2, 'final', 0) Regards Emilio El jueves, 4 de julio de 2013 13:24:27 UTC+2, vicherot escribió: > > I never have that issue, i use default setting of append_slash and

Allow users to have a online store on the site

2013-07-19 Thread Karl Arunachal
Hello, There's one plugin for wordpress called Marketpress E commerce, it has many features, but what i am interested is that, with that plugin users can create online store in your site and sell their products. So, is there any plugin or package like Marketpress for django, which have this

Re: Best practice - using Django model's in-built id field?

2013-07-19 Thread Victor Hooi
Hi, Funny you guys should mention that =), after Mike's post, I ended up just using David Cramer's django-uuidfield (https://github.com/dcramer/django-uuidfield) package. (There's also django-shortuuidfield - https://github.com/nebstrebor/django-shortuuidfield). For Postgres, this uses the

Re: Design for storing likes/dislikes?

2013-07-19 Thread Victor Hooi
Hi, Hmm, I'm thinking I might need to go for an enum/choices rather than a NullBooleanField. There are actually four states (so far) that can exist in the relationship between a user and a widget. 1. Like 2. Unlike 3. No vote (i.e. abstain). 4. Not asked yet I suppose I could

Re: label_tag() escapes output twice

2013-07-19 Thread Ramiro Morales
On Fri, Jul 19, 2013 at 4:09 PM, sephii wrote: > Anyway it looks like a bug so I'll just report it. Can you test things easily with the in-development 1.6 and trunk? There have been a few changes to that code lately and the issue could have been fixed. It's the kind

Re: Is Celery the best option?

2013-07-19 Thread Andre Terra
I had never heard about Rq before, seems interesting indeed! Thanks for the recommendation. Cheers, AT On Fri, Jul 19, 2013 at 4:04 PM, Doug Ballance wrote: > Celery is a good option, and probably the most used. There are a couple > of other options that may be worth

Re: Is Celery the best option?

2013-07-19 Thread Doug Ballance
Celery is a good option, and probably the most used. There are a couple of other options that may be worth looking into: Huey https://github.com/coleifer/huey Rq http://python-rq.org/ Personally I've never gotten on well with celery. It's just not at all intuitive to me (it's heavy use of

Re: iregex and word boundaries

2013-07-19 Thread Bill Freeman
I think that you either need to use raw strings (r'stuff') or backslash the backslashes. On Fri, Jul 19, 2013 at 1:34 PM, Michael Soulier wrote: > Hi, > > I'm trying to match a number using word boundaries like so > > record =

iregex and word boundaries

2013-07-19 Thread Michael Soulier
Hi, I'm trying to match a number using word boundaries like so record = SipClient.objects.get( dnlist__iregex='\b%s\b' % dn ) but this is failing to find simple dnlist matches like 1234, while this does

Re: Aggregating annotations

2013-07-19 Thread Debanshu Kundu
Also interestingly, if I do: Book.objects.values('rating').aggregate(Max('rating')) It returns an empty dict without performing any DB query!! On Friday, July 19, 2013 11:49:52 AM UTC+5:30, Debanshu Kundu wrote: > > If I have a model *Book* defined as: > > class Book(models.Model): >name =

Re: is Django useful for a basic site as well?

2013-07-19 Thread Alex Hall
thanks for the tip about this, it looks really useful. I was also pleased to find that, at least in looking at one of the template files, it seems to work well with my screen reader. Too often web developers don't bother with accessibility, but this looks promising. On Jul 18, 2013, at 6:31 PM,

Re: Design for storing likes/dislikes?

2013-07-19 Thread Steven Smith
I've used NullBooleanField for this before, as well. A lot quicker to query on than a ManyToMany, also. On Tuesday, July 16, 2013 9:24:54 PM UTC-4, donarb wrote: > > On Tuesday, July 16, 2013 5:29:47 PM UTC-7, Victor Hooi wrote: >> >> Hi, >> >> We have a list of users, who are going to

Re: Aggregating annotations

2013-07-19 Thread Debanshu Kundu
EDIT: the query should be: Book.objects.values('rating').annotate(books_per_rating=Count('id')).aggregate(Max('books_per_rating')) *books_per_rating* should be quoted in *Max* call. On Friday, July 19, 2013 11:49:52 AM UTC+5:30, Debanshu Kundu wrote: > > If I have a model *Book* defined as: >

Re: field-null or not-null filter?

2013-07-19 Thread Martin Becker
*You can define your own NullListFilter. I did it this way:* class NullListFilter(FieldListFilter): def __init__(self, field, request, params, model, model_admin, field_path): self.lookup_kwarg = '%s__isnull' % field_path self.lookup_val = request.GET.get(self.lookup_kwarg,

Re: Best practice - using Django model's in-built id field?

2013-07-19 Thread Javier Guerra Giraldez
On Fri, Jul 19, 2013 at 4:26 AM, Tom Evans wrote: > Because of this, I usually add a uuid field as a unique key, but leave > id as the primary key. same here. but only for those tables whose records would be seen by the public. kinda like 'slugs for non-textual

Re: Groups Model Randomly Disappears In the Admin View

2013-07-19 Thread 刘是
Thanks for your quick reply:-) I just restarted my Apache server, and so far it seems the quirk has gone. On 19 July 2013 20:04, 刘是 wrote: > Thanks for your quick reply:-) I just restarted my Apache server, and so > far it seems the quirk has gone. > > > On 19 July 2013

Re: is Django useful for a basic site as well?

2013-07-19 Thread Arnold Krille
On Thu, 18 Jul 2013 17:45:32 -0400 Bill Freeman wrote: > Good programmers steal. Great programmers steal from the best. Find > a beautiful site and don't deviate much from his layout/CSS scheme. And some call their work a framework and make everyone use/steal it. @Alex:

Re: Groups Model Randomly Disappears In the Admin View

2013-07-19 Thread 刘是
Hi. Did you solve this problem? I'm facing the same problem now. 在 2011年8月30日星期二UTC+8下午10时44分46秒,Laurence写道: > > I have a very strange problem that I am having difficultly in > debugging. In my application I have registered two models, each of > which contains two classes. When I go to the

Aggregating annotations

2013-07-19 Thread Debanshu Kundu
If I have a model *Book* defined as: class Book(models.Model): name = models.CharField(max_length=300) pages = models.IntegerField() price = models.DecimalField(max_digits=10, decimal_places=2) rating = models.FloatField() pubdate = models.DateField() and I run the query:

request.user returning AnonymousUser

2013-07-19 Thread l33t
Hello, I have a custom authentication backend and a custom user model. The authentication() method in the custom authentication backend returns the custom user after successful authentication. Once authenticated, I use login from django.contrib.auth to set the sessionid for the custom user.

Re: Custom authentication backend

2013-07-19 Thread Rok Jaklič
Found an answer here: http://stackoverflow.com/questions/10874675/why-does-django-need-a-database-for-custom-authentication-backends On Thursday, July 18, 2013 1:12:04 PM UTC+2, Rok Jaklič wrote: > > Hi, > > if I write custom authentication backend, do I need to create user in > local database

Re: label_tag() escapes output twice

2013-07-19 Thread Tom Evans
On Thu, Jul 18, 2013 at 10:31 PM, sephii wrote: > Hello, > > I'm trying to output a simple form but the label_tag() method tries to > escape the field label twice. Here's what I have: > > # models.py > # _ is ugettext_lazy, if it matters > class MyModel(models.Model):

Re: Best practice - using Django model's in-built id field?

2013-07-19 Thread Tom Evans
On Fri, Jul 19, 2013 at 2:31 AM, Victor Hooi wrote: > Hi, > > I'm just wondering - is it considered good or bad practice to use a Django > model's in-built ID field? > > Say for example you wanted a unique identifier for each transactio - should > you be generating your own,

Re: is Django useful for a basic site as well?

2013-07-19 Thread Tom Evans
On Thu, Jul 18, 2013 at 10:45 PM, Bill Freeman wrote: > Good programmers steal. Great programmers steal from the best. Find a > beautiful site and don't deviate much from his layout/CSS scheme. There are plenty of free CSS layout reservoirs out there for people to use,

bug in multi-level multi-table inheritance?

2013-07-19 Thread Dow Street
All, I'm seeing some unexpected behavior when using multi-level multi-table inheritance. In the example below there are three levels in the class hierarchy. When accessing the name field (which is stored in the Level1 base class) from an object in Level3, the query does not seem to walk the