Re: Displaying Profile model in a form

2010-10-28 Thread Venkatraman S
Also. check this : http://streamhacker.com/2010/03/01/django-model-formsets/ -V- http://twitter.com/venkasub -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from

Re: Import csv file in admin

2010-10-28 Thread Daniel Roseman
On Oct 28, 5:08 am, Jorge wrote: > Shame on me! > I forgot to make some changes inside the for loop. > So now it is: > >  def save(self, commit=True, *args, **kwargs): >          form_input = super(DataInput, self).save(commit=False, *args, >  **kwargs) >          form_input.place = self.cleaned_d

DatabaseError: (1146, "Table 'test_XXX.django_content_type' doesn't exist")

2010-10-28 Thread girish shabadimath
Hi all, im re-sending this mail, am i missing any thing here? im using django 1.2 there are two databases involved in my project (default and XYZ (used only for migration)) i use a consistant MySQL storage type for all apps, all models (including m2m). This is done by registering a post-syncdb

Data error

2010-10-28 Thread Hussain Deikna
Hi, I am newbe in django and I have got this Error ' coercing to Unicode: need string or buffer, Product found ' what's that mean? thank you for your attention -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

ATTRIBUTE ERROR

2010-10-28 Thread sami nathan
My occured Error is Exception Value: 'str' object has no attribute 'resolve' Exception Location: C:\Python25\Lib\site-packages\django\core\urlresolvers.py in resolve, line 217

'str' object has no attribute 'resolve' Exception Location: C:\Python25\Lib\site-packages\django\core\urlresolvers.py in resolve,

2010-10-28 Thread sami nathan
-- Forwarded message -- From: sami nathan Date: Thu, Oct 28, 2010 at 3:41 PM Subject: ATTRIBUTE ERROR To: django-users@googlegroups.com My occured Error is Exception Value: 'str' object has no attribute 'resolve' Exception Location:        C:\Python25\Lib\site-packages\django\

form.htm division

2010-10-28 Thread tariq
HI I want to divide form.html of satchmo into separate parts. I mean I want to separate Billing information and shipping information on two separate templates in satchmo. Is there anyone which can help me. is it possible or not?? -- You received this message because you are subscribed to the Goo

Re: DatabaseError: (1146, "Table 'test_XXX.django_content_type' doesn't exist")

2010-10-28 Thread Suraj Jacob
I took a look at http://code.djangoproject.com/wiki/AlterModelOnSyncDB here's the code in it: for model in created_models: db_table=model._meta.db_table if db_table not in skip: skip.add(db_table) engine = storage.get(model._meta.db_table,default_stora

How will you query?

2010-10-28 Thread MintX
Hi, all. I want to increase some integer value until limit. And.. all instance would have different increasing value and different limit. I modeled like this: class Foo( models.Model ): value = models.IntegerField(default=0) delta = models.IntegerField(default=1) limit = models.Inte

Famous 'ascii' codec can't decode byte 0xc3 error

2010-10-28 Thread Duong Dang
Hi, I am having the following unicode error with django 1.2: ./standalone.py print the string out just fine. But in in my app, when ever mymodel.update() is called I get this famous error: 'ascii' codec can't decode byte 0xc3 Thanks standalone.py: # -*- coding: utf-8 - *- def unicodestring():

Re: Data error

2010-10-28 Thread Suraj Jacob
means your object cannot be converted into string. You have to either provide a __unicode__ or __str__ for your model, or pick a particular field that you are trying to coerce with the rest of the string On Thu, Oct 28, 2010 at 15:15, Hussain Deikna wrote: > Hi, I am newbe in django and I have g

Re: 'str' object has no attribute 'resolve' Exception Location: C:\Python25\Lib\site-packages\django\core\urlresolvers.py in resolve,

2010-10-28 Thread Suraj Jacob
change it from (r"wap/di/sub",current_datetime) to (r'^wap/di/sub','current_datetime') On Thu, Oct 28, 2010 at 15:52, sami nathan wrote: > (r"^wap/di/sub",current_datetime) > -- You received this message because you are subscribed to the Google Groups "Django users" group. To po

Re: ATTRIBUTE ERROR

2010-10-28 Thread yu xue
Hi, I feel there are some places which need to modify: 1. urlpatterns should be (r"^wap/di/sub/$", current_datetime), 2. It seems that the view function is endless loop... 2010/10/28 sami nathan > My occured Error is > > Exception Value: > > 'str' object has no attribute 'resolve' > > Exceptio

Re: Data error

2010-10-28 Thread Karen Tracey
On Thu, Oct 28, 2010 at 5:45 AM, Hussain Deikna wrote: > Hi, I am newbe in django and I have got this Error > > ' > > coercing to Unicode: need string or buffer, Product found ' > > what's that mean? thank you for your attention > > It means the __unicode__ method for some model is returning a Pr

Re: Famous 'ascii' codec can't decode byte 0xc3 error

2010-10-28 Thread Tom Evans
On Thu, Oct 28, 2010 at 11:41 AM, Duong Dang wrote: > Hi, > > I am having the following unicode error with django 1.2: > > ./standalone.py print the string out just fine. But in in my app, when > ever mymodel.update() is called I get this famous error: 'ascii' codec > can't decode byte 0xc3 > > Th

How to aggregate values by month

2010-10-28 Thread Rogério Carrasqueira
Hello! I'm having an issue to make complex queries in django. My problem is, I have a model where I have the sales and I need to make a report showing the sales amount per month, by the way I made this query: init_date = datetime.date(datetime.now()-timedelta(days=365)) ends_date = datetime.date(

Re: How to aggregate values by month

2010-10-28 Thread Franklin Einspruch
It may not be a complete answer, but you should know about {% regroup %} just in case: http://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#regroup - Franklin -- Art, writing, journal: http://einspruch.com Comics: http://themoonfellonme.com 2010/10/28 Rogério Carrasquei

Re: How to aggregate values by month

2010-10-28 Thread Rogério Carrasqueira
Hi Franklin! Thanks for you answer. Unfortunatelly I need to output my results on a JSON file. Do you have any other approach? Cheers, Rogério Carrasqueira --- e-mail: rogerio.carrasque...@gmail.com skype: rgcarrasqueira MSN: rcarrasque...@hotmail.com ICQ: 50525616 Tel.: (11) 7805-0074 2010/

Re: How to aggregate values by month

2010-10-28 Thread Rogério Carrasqueira
Hello Everybody! I tried this way also: sales = Sale.objects.extra(select={' month': 'month(date_created)'}).filter(date_created__range=(init_date,ends_date)).values('month').aggregate(total_sales=Sum('total_value')) but returned {} Any ideias? Cheers, Rogério Carrasqueira --- e-mail: rogeri

Re: How to aggregate values by month

2010-10-28 Thread Scott Gould
Personally I hate writing raw SQL so I would probably try something like this (untested): sales = Sale.objects.filter(date_created__range=(init_date,ends_date)) .values(date_ created__month) .aggregate(total_sales=Sum('total_value')) sales_by_month = [(x.year, x.month, [y for y in sales i

Re: How to aggregate values by month

2010-10-28 Thread Casey S. Greene
Hi Rogério, You can output to json using templates if this is the only thing holding you back from a working solution using regroup. You can use render_to_string with a json template which you can then return with an HttpResponse. It doesn't take advantage of the serialization library but i

Cherokee for home developing

2010-10-28 Thread Karim Gorjux
Hi all! I'm trying to create my devbox for Django and I use a server in my lan with Ubuntu and Cherokee installed in. For every project I use virtualenv so I install django and flup and I create in cherokee panel the virtual server using the path of my virtualenv. All I do is explained in the Chero

Re: overriding save-method

2010-10-28 Thread Patrick
that's how i did it finally... i had to refresh my knowledge about the property statement first :) thanks again! class Setting(models.Model): name = models.CharField(max_length=100) _value_json = models.TextField() def _set_json_value(self, value): self._value_json = json.dumps

Re: help with model definition

2010-10-28 Thread pixelcowboy
Yes, it works! Thanks so much, that is the perfect solution! Inheritance in Django in my opinion should do much more, but in this case it actually does the job! On Oct 27, 2:31 pm, pixelcowboy wrote: > The second solution would be great, but is the relationship inherited? > I didnt think that was

Re: Factory Squirrel

2010-10-28 Thread Phlip
Tx! But! > http://github.com/dnerdy/factory_boy How does this do aggregation? > Also, there is a more general python > solution:http://farmdev.com/projects/fixture/ that supports django. That one's a little _too_ general. But it supports aggregation (association, etc.).. -- You received this

Re: How to aggregate values by month

2010-10-28 Thread Javier Guerra Giraldez
2010/10/28 Rogério Carrasqueira : > Thanks for you answer. Unfortunatelly I need to output my results on a JSON > file. Do you have any other approach? if the {% regroup %} is what you need, you should know that it's an application of itertools.groupby() -- Javier -- You received this message

Re: Cherokee for home developing

2010-10-28 Thread Karim Gorjux
On Thu, Oct 28, 2010 at 19:32, Karim Gorjux wrote: > Hi all! I'm trying to create my devbox for Django and I use a server I fixed the problem with the settings.py and now admin works. The problem now is to avoid the flup's "Unhandled Exception" and let django shows it debug -- K. Blog Personal

Re: Cherokee for home developing

2010-10-28 Thread Robbington
Glad to finally see some one using Cherokee with django. Dont just use it in development, its actually less memory intensive than apache as well as having an awesome admin interface. Anyway enough plugging. To avoid problems and for simplicty I would advise using Cherokee Uwsgi config to serve up

newbie having trouble with conversion to south

2010-10-28 Thread Sells, Fred
I’m using django 1.2.1, Python 2.4 and MySQL 5.0 and south 0.7.2 I’ve got an existing app, aptly named “app” which I’m am trying to convert to south so I can make some DB changes. It seemed to install OK and I get to here. At which point I’m lost. Could it be that Python 2.4 logging is not

Re: Cherokee for home developing

2010-10-28 Thread Karim Gorjux
On Thu, Oct 28, 2010 at 21:06, Robbington wrote: > Glad to finally see some one using Cherokee with django. Dont just use > it in development, its actually less memory intensive than apache as > well as having an awesome admin interface. Now I can just develop on Django with Cherokee I haven't an

Re: Cherokee for home developing

2010-10-28 Thread Max Countryman
Rob, I have been using Cherokee for Django deployment for almost a year now. I know several other devs who prefer it as well. Also there's always some activity on the Cherokee list itself related to Django. On Oct 28, 2010, at 14:06, Robbington wrote: > Glad to finally see some one using Ch

Re: Cherokee for home developing

2010-10-28 Thread Max Countryman
Oh I forgot to mention! Do not use the uwsgi wizard: it's currently broken. Expect a fix soon and refer to the various threads detailing the set up process without the wizard on Cherokee's mailing list. On Oct 28, 2010, at 14:06, Robbington wrote: > Glad to finally see some one using Cherokee

Re: newbie having trouble with conversion to south

2010-10-28 Thread Shawn Milochik
>From the traceback it seems that your hypothesis about the Python version may be correct. I don't know what versions of Python South tests with. However, I'm in the same situation you are (Cent OS), and I get along wonderfully with virtualenv. I'm using Python 2.7 and everything's grand. If you n

Re: Database error: Table 'test_XXX.django_content_type' doesn't exist

2010-10-28 Thread Frank Wiles
On Thu, Oct 28, 2010 at 1:27 AM, girish shabadimath wrote: > Hi all, > im using django 1.2 > there are two databases involved in my project (default and XYZ (used only > for migration)) > i use a consistant MySQL storage type for all apps, all models (including > m2m). > This is done by registerin

Re: Using localflavor with admin?

2010-10-28 Thread Frank Wiles
On Thu, Oct 28, 2010 at 12:23 AM, Victor Hooi wrote: > Hi, > > Is there any way to combine the localflavor module (http:// > docs.djangoproject.com/en/dev/ref/contrib/localflavor/) with Django's > in-built admin module? > > For example, I'd like to create a model with say, a Postcode and phone- >

Re: Cherokee for home developing

2010-10-28 Thread Robbington
Hi Max, I am not sure what you mean by ' Do not use the uwsgi wizard: it's currently broken'? Rob, Ps, should you wish to discuss this further, perhaps it is better you email me directly, as to avoid filling Karims post with unnecessary messages. -- You received this message because you are s

Re: Cherokee for home developing

2010-10-28 Thread Cal Leeming [Simplicity Media Ltd]
I use Django + UWSGI + Cherokee with all my sites , with around 200k page views a day. Various teething problems, but generally stable. On Thu, Oct 28, 2010 at 7:32 PM, Max Countryman wrote: > Oh I forgot to mention! Do not use the uwsgi wizard: it's currently broken. > Expect a fix soon and re

RE: newbie having trouble with conversion to south

2010-10-28 Thread Sells, Fred
I have played with VirtualEnv, but not really applied it. My biggest concern would be automating a Restart if the server reboots. Also since I'm "old school" and using Apache with mod_python for Django, I'm not if that's a problem. To be honest, I have not researched VirtualEnv much because my M

Re: Cherokee for home developing

2010-10-28 Thread Max Countryman
He mentioned uwsgi. He should know that the wizard is currently broken. That means that it produces a configuration that doesn't work properly. Please refer to the Cherokee mailing list of you're unaware of these issues. It should be fixed in v1.09 which is coming soon. Thanks! On Oct 28, 2010,

Re: newbie having trouble with conversion to south

2010-10-28 Thread Shawn Milochik
A short note about your primary concern: You can simply change the shebang line of your manage.py script to point to the 'python' in your virtualenv. The same goes for a .wsgi file. There's nothing particularly magical about "activating" a virtualenv in an interactive terminal session. Shawn --

Re: Unable to filter a query on >1 ManyToMany relationships

2010-10-28 Thread Jumpfroggy
Tom, Thanks for the link, I read through that and it makes sense. So if both conditions are in the same filter, they are both applied simultaneously. Since I wanted two separate conditions, I needed two separate filter() statements. In other words, my method, is "Find a node who's parent is bot

How do I filter/exclude custom queryset fields created by .extra()?

2010-10-28 Thread Jumpfroggy
I have something like this: class Node(Model): widgets = ForeignKey(Widget) And I want to retrieve all nodes that have >0 widgets. I have an .extra() query like this: nodes = Node.objects.all().extra( select={ 'num_widgets': 'SELECT COUNT(*) FROM appname_node

Re: Import csv file in admin

2010-10-28 Thread Jorge
> > Hang on, what you're doing here is repeatedly setting the data values > for each line to the *same* form_input model. Presumably what you > actually want to do is to create new Data instances for each line in > the CSV, with the place set to the value of the form. > > In this case, I'd recommen

Re: newbie having trouble with conversion to south

2010-10-28 Thread Łukasz Rekucki
On 28 October 2010 20:23, Sells, Fred wrote: > I’m using django 1.2.1, Python 2.4 and MySQL 5.0 and south 0.7.2 > > I’ve got an existing app, aptly named “app” which I’m am trying to convert > to south so I can make some DB changes.  It seemed to install OK and I get > to here.  At which point I’m

How to get ISO date format in admin interface

2010-10-28 Thread Svenn Are Bjerkem
Hi, I want to have ISO date format -MM-DD in the columns in the admin interface. Currently I have localized dates depending on the LANGUAGE_CODE setting. I have tried to set DATE_FORMAT = 'Y-m-d' in my settings.py and even tried it in the global_settings.py, but I have got the understanding tha

odd apache issues

2010-10-28 Thread kicker
I'm having an odd issue when I start up my project using apache/wsgi. The project works fine when using the development server, but when I load it up in apache it states that mysql is "'django.db.backends.mysql' isn't an available database backend.". Here is my db config (edited to remove user/pas

limit_choice_to all objects of a particular model (using inheritance)

2010-10-28 Thread pixelcowboy
Example class Base(): pass class A(Base) parent=models.Foreignkey("self", limit_choices_to=(all members of the B class) class B(Base) parent=models.Foreignkey("self", limit_choices_to=(all members of the A class) What would be the query syntax for limit_choices_to, to get only the objects

Re: How to aggregate values by month

2010-10-28 Thread Mikhail Korobov
Hi Rogério, You can give http://bitbucket.org/kmike/django-qsstats-magic/src a try. It currently have efficient aggregate lookups (1 query for the whole time series) only for mysql but it'll be great if someone contribute efficient lookups for other databases :) On 28 окт, 19:31, Rogério Carrasqu

adding field to query set

2010-10-28 Thread owidjaya
If i have such models class Project(model.Model): project = model. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users

adding field to query set

2010-10-28 Thread owidjaya
If I have such models class Project(models.Model): project = models.CharField(max_length=200) user = models.ForeignKey(User) # user is from django.contrib.auth.models => user I would like to be able to display an an attribute that is made up of first_name and last_name concatenated when i ite

Re: Model Inheritance.

2010-10-28 Thread Carles Barrobés
Your "place" object will contain an attribute called "restaurant" to access the object as an instance of the subclass. If this place object is an instance of another place subclass, accessing the restaurant attribute will raise a DoesNotExist error. Carles. On 28 Oct, 01:39, Tom Eastman wrote:

Re: adding field to query set

2010-10-28 Thread Jumpfroggy
What's your motive? Are you worried about performance? If performance is not an issue, you can just do this: for project in Project.objects.all(): print project.user.first_name + ' ' + project.user.last_namea This might speed things up: projects = Project.objects.all().select_r

Re: adding field to query set

2010-10-28 Thread owidjaya
Ok the motive is for this reason. I have a table generator class that display an html table from the query set depending on the columns that you selected class TableGenerator(name,mapping,data): def __init__(self,name,mapping,data): self._mapping = mapping self._name = name self._

Re: Model Inheritance.

2010-10-28 Thread Tom Eastman
On 29/10/10 11:06, Carles Barrobés wrote: Your "place" object will contain an attribute called "restaurant" to access the object as an instance of the subclass. If this place object is an instance of another place subclass, accessing the restaurant attribute will raise a DoesNotExist error. Car

Re: Graphic and form in the same template

2010-10-28 Thread pjrhar...@gmail.com
It can't be done like that. Look at any website and you'll see that never is the picture somehow "embedded" in the page, it's linked by an img tag that points at the url of the image. What he was saying is that you need two separate views. In the first, return your page with an img tag pointing a

Forms in a Workflow for Related Models

2010-10-28 Thread ghachey
Hi, I think I have a particular case. I could not find an easy way to do this going carefully through all the documentation. I also couldn't find anything close enough in these archives to help me out with my limited experience so I am resorting to asking you. I have a Paper model which records

RE: newbie having trouble with conversion to south

2010-10-28 Thread Sells, Fred
I noticed that easy_install left south as an egg. Can I just unzip that or is there some ezsetup I have to use to expose the files so I can edit that line. I have not needed to "look under the hood" of easy_install's before, so this is probably a RTFM question, but... Sorry to be so "needy" b