Re: Support for multiple django annotations?

2012-01-11 Thread girish shabadimath
Try django-cubes regards, gms On Thu, Jan 12, 2012 at 12:05 PM, pradyumna wrote: > I am trying to use Django aggregation for an existing application that > uses the following sql query: > > select sum(count) as sum_country_count, count(country_abbr) as >

Admin GenericTabularInline problem

2012-01-11 Thread MeME
I have such models: https://bitbucket.org/Memke/webmachinist/src/ae3c2ae9547d/webmachinist/apps/webmachinist/media/models.py And my adminy.py looks like: https://bitbucket.org/Memke/webmachinist/src/ae3c2ae9547d/webmachinist/apps/webmachinist/media/admin.py As you can see I attach Image and

Support for multiple django annotations?

2012-01-11 Thread pradyumna
I am trying to use Django aggregation for an existing application that uses the following sql query: select sum(count) as sum_country_count, count(country_abbr) as country_cnt,country_abbr from (select log_datetime, count(country_abbr) as count,country_abbr from firewall where

Completely decoupled development

2012-01-11 Thread Alec Taylor
What are your thoughts on completely decoupled development? I have gotten a colleague of mine to work on one whole facet of the system, whilst I work on the other. In essence, these are two completely separate systems, on two separate domains. The plan is to link the two in a signup wizard and

Re: Does anyone know any blogs that write about how to quickly install and deploy a django application on Amazon EC2?

2012-01-11 Thread Alec Taylor
http://pragmaticstartup.wordpress.com/2011/04/02/non-techie-guide-to-setting-up-django-apache-mysql-on-amazon-ec2/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To

Re: Help me with django Form

2012-01-11 Thread kenneth gonsalves
On Wed, 2012-01-11 at 17:49 -0800, coded kid wrote: > Please where I’ve I done something wrong? Help me out! you need to use ModelForm, not create your form in the template. Check the docs on ModelForm. -- regards Kenneth Gonsalves -- You received this message because you are subscribed to the

Does anyone know any blogs that write about how to quickly install and deploy a django application on Amazon EC2?

2012-01-11 Thread Chen Xu
Hi, everyone: Does anyone know any blogs that write about how to quickly install and deploy a django application on Amazon EC2? Thanks very much Best regards -- ⚡ Chen Xu ⚡ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Help me with django Form

2012-01-11 Thread Mario Gudelj
Can you provide your register model? Is it possible that you've extended the user model and that your username, password etc is getting stored inside auth_user table? On 12 January 2012 12:49, coded kid wrote: > Hi guys, I’ve been trying to signup using the django form

Help me with django Form

2012-01-11 Thread coded kid
Hi guys, I’ve been trying to signup using the django form I created. Whenever I signup, the form is always saving the id no and not other fields like names, username.pasword,email etc. Below are the codes; In views.py: from django.shortcuts import render_to_response from django.http import

not sure how to unpack a list within a tuple within another list inside the template

2012-01-11 Thread Mario Gudelj
Hi Djangoers, I have a default dict variable final_d = defaultdict(list) that looks like this: [(order1, [customer2, customer1]), (order2, [customer3, customer5, customer6]) ] I've tried everything possible inside the template and I can't unpack this thing. I'm passing final_d to the template

Re: A demo of django-inlinetrans and django-inplaceedit

2012-01-11 Thread Juergen Schackmann
Hi, this looks really great. I have 3 questions for which I would highly appreciate the answers: 1. What is the best way to include some form magic, i.e. sending the changes not directly to the model but to a form that does some verification and also return the form error messages? 2. If I do

Re: Class-Based Generic Views (CreateView) - field exclusions and defaults

2012-01-11 Thread Juergen Schackmann
if is use this code, as proposed by russ: def form_valid(self, form): self.object.user = ... (something meaningful.. e.g., self.request.user) return super(CreateCampaignView, self).form_valid(form) i get the error 'NoneType' object has no attribute 'user'. and actually, by

Re: How to avoid "no such column" error when I add a new property to a model?

2012-01-11 Thread Andre Terra
Or use a GUI tool like PgAdmin[0] for PostgreSQL, which is packaged into most psql distributions. Cheers, AT [0] http://www.pgadmin.org/ On Wed, Jan 11, 2012 at 6:30 PM, Python_Junkie < software.buy.des...@gmail.com> wrote: > For those who do not want to use another abstraction module, just

Re: How to avoid "no such column" error when I add a new property to a model?

2012-01-11 Thread Python_Junkie
For those who do not want to use another abstraction module, just use sql on the database to add the column. Look up the alter table command for the database that you are using. On Jan 11, 5:26 am, callum wrote: > I created an "Article" model with a few simple

Re: Need to examine and act on old vs. new at .save() time

2012-01-11 Thread Jeff
I've just found that the problem is related to my desired field being M2M. Anyone know what is going on here? :( My approach (and Matt's) works fine on a simple CharField field. class Device(models.Model): # ... floor = models.CharField('Floor', max_length=10, blank=True) # ...

Re: Need to examine and act on old vs. new at .save() time

2012-01-11 Thread hanks...@gmail.com
> But is costly when the field in question is foreign, no?  Mine's a M2M. Sure. There's probably no way around that, though, except for judicious use of select_related. https://docs.djangoproject.com/en/dev/ref/models/querysets/#select-related -- You received this message because you are

Re: Need to examine and act on old vs. new at .save() time

2012-01-11 Thread Tom Evans
On Wed, Jan 11, 2012 at 5:22 PM, Jeff wrote: > When Device.netgroups (a M2M field) changes, we need to perform > some python-ldap operations. Have you considered simply going back to the database to check what the values currently are? It would be inefficient, but clean and

Re: Need to examine and act on old vs. new at .save() time

2012-01-11 Thread Jeff
On Jan 11, 11:59 am, Andre Terra wrote: > The important question here is, what are you trying to achieve, outside of > the functionality itself? Are you trying to log changes to provide an audit > trail? If so, there are tools for that. I wish that's all I was doing. Then

Re: Need to examine and act on old vs. new at .save() time

2012-01-11 Thread Andre Terra
The important question here is, what are you trying to achieve, outside of the functionality itself? Are you trying to log changes to provide an audit trail? If so, there are tools for that. Cheers, AT On Wed, Jan 11, 2012 at 2:53 PM, Jeff wrote: > Matt, > > On Jan 10, 5:57

Re: Need to examine and act on old vs. new at .save() time

2012-01-11 Thread Jeff
On Jan 11, 10:03 am, "hanks...@gmail.com" wrote: > I go about this a different way, which is to monkeypatch the object > with the relevant initial values at __init__: > > https://gist.github.com/1595055 > > Saves you a database call. But is costly when the field in question

Re: Need to examine and act on old vs. new at .save() time

2012-01-11 Thread Jeff
Matt, On Jan 10, 5:57 pm, Matt Schinckel wrote: > The way I generally do this type of thing > is:https://gist.github.com/1591723 Thanks for the reply! This looked awfully similar to my logic (although yours is 10x more clean), but I was excited to implement it this morning.

Re: Need to examine and act on old vs. new at .save() time

2012-01-11 Thread hanks...@gmail.com
I go about this a different way, which is to monkeypatch the object with the relevant initial values at __init__: https://gist.github.com/1595055 Saves you a database call. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Please help me with django form 2.

2012-01-11 Thread J. Cliff Dyer
On Tue, 2012-01-10 at 23:49 -0800, coded kid wrote: > Hi guys, whenever I signup for my django form, my database is only > saving the id no and not names, username, email etc. | #sorry for > posting it like this. I'm on mobile. Okay. In my views.py, this ( | ) > means next line.

Re: Please help me with django form 2.

2012-01-11 Thread 软刀
as I unflod your code I think may be you should create a Form-class like this: class RegisterForm(ModelForm): class Meta: model = Register and in your view should be: @csrf_exempt def welcome(request): if request.method=='POST': form=RegisterForm(request.POST)

change min_length in form __init__?

2012-01-11 Thread galgal
Is there any way, to change the field's *min_length* argument inside form constructor? That doesn't work: def __init__(self, *args, **kwargs): > super(CreateTeamForm, self).__init__(*args, **kwargs) > self.fields['primary_color'].min_length = 4 -- You received this message because you

Re: How to avoid "no such column" error when I add a new property to a model?

2012-01-11 Thread Daniel Roseman
On Wednesday, 11 January 2012 10:26:32 UTC, callum wrote: > > I created an "Article" model with a few simple properties. I ran > syncdb, and set up the Django admin site, and added > "admin.site.register(Article)" in admin.py. Using the Django admin > site, I created an article by filling in

How to avoid "no such column" error when I add a new property to a model?

2012-01-11 Thread callum
I created an "Article" model with a few simple properties. I ran syncdb, and set up the Django admin site, and added "admin.site.register(Article)" in admin.py. Using the Django admin site, I created an article by filling in the form. I then went into models.py and added another property. I ran

Re: Please help me with django form 2.

2012-01-11 Thread kenneth gonsalves
On Tue, 2012-01-10 at 23:49 -0800, coded kid wrote: > names=models.CharField(max_length=50) etc. I hope you get my point? > Please help. I would suggest that you get to a computer and post the full code. Please help us to help you. -- regards Kenneth Gonsalves -- You received this message