Re: Multiple Primary Key

2009-04-07 Thread maeck

You can use the meta variable unique_together.
This will do something like this, however, does not work for existing
datamodels.



On Apr 7, 9:06 am, Alex Gaynor  wrote:
> On Tue, Apr 7, 2009 at 11:53 AM, sandravigo  wrote:
>
> > Hello, I want to know how I can to declarate multiple primary key in
> > my model
>
> Django doens't support multiple column primary keys.  This is the subject of
> ticket #373 in Django's trac.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Issue with saving existing model when using inlineformsets

2008-12-13 Thread maeck

Fixed it.

See the code here:

http://www.djangosnippets.org/snippets/1246/


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Issue with saving existing model when using inlineformsets

2008-12-12 Thread maeck

additional info:
The error happens in formset.save()
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Issue with saving existing model when using inlineformsets

2008-12-12 Thread maeck

All,

I have an issue with using InlineFormSets. Save of a new model goes
without any issue.
However, I have a problem with saving an existing model.
When I save I get a KeyError without much info.
Other than it happened in "/usr/lib/python2.5/site-packages/django/
forms/models.py in save_existing_objects".

I noticed an older ticket that talked about the form.id missing on the
template.
If I am correct managementform takes care of that.

I'd appreciate some pointers on this issue.


Maeck



### View code

class ClassPaymentProductForm(ModelForm):
class Meta:
model = ClassPaymentProduct


class ClassPaymentForm(ModelForm):
class Meta:
model   = ClassPayment


def edit_classpayment(request, classpayment_id=None):

# View parameters
Form= ClassPaymentForm
InlineForm  = ClassPaymentProductForm
Model   = ClassPayment
InlineModel = ClassPaymentProduct
template= 'test.html'
data_id = classpayment_id

if  data_id == None:
data = Model()
else:
data = Model.objects.get(id = data_id)

InlineFormSet   = inlineformset_factory(Model, InlineModel,
can_delete=True)

if request.method == "POST":
mainform= Form(request.POST, instance=data)
formset = InlineFormSet(request.POST, request.FILES,
instance=data)

if mainform.is_valid() and formset.is_valid():
mainform.save(request)
formset.save()

if '_save' in request.POST:
return HttpResponseRedirect('/test/')
if '_addanother' in request.POST:
return HttpResponseRedirect('../add/')

else:
mainform= Form(instance=data)
formset = InlineFormSet(instance=data)

return render_to_response(template, {
'mainform'  : mainform,
'formset'   : formset,
})




### Template

{% for f in formset.management_form %}
 {{ f }}
{% endfor %}

 
 {% for field in formset.forms.0 %}
  {% if not field.is_hidden %}
   {{ field.label }}
  {% endif %}
 {% endfor %}
 
 {% for f in formset.forms %}
  
  {% for field in f %}
   {% if not field.is_hidden %}
{{ field }}
 {% endfor %}


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: FormSet issue. Pre-populating from queryset

2008-12-11 Thread maeck

Malcolm,

Thanks for the comment.
I truly understand where this is coming from. This issue is completely
my issue of taking things for granted.
I have been coding around in Django for a while now (hooked on in the
0.95 days), and have been coding most of the form stuff (including
inlines) all by hand.
When I noticed the Formset class, I tried to make it work in the wrong
place.
Brian pointed me to the inlineformsets documentation and I have not
been happier.
It really is easy now to build forms with inlines.

This stuff has come a long way, and life will be much easier than it
was before.

Thanks for Django,

Maeck
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: FormSet issue. Pre-populating from queryset

2008-12-11 Thread maeck

Thanks Malcolm,

Just figured out the values transformation on querysets myself.
Nevertheless, in my experience there seems to be an issue with
foreignkeys when using queryset values in combination with formsets.
Values returns keys like 'parent_id', however formsets expect the
fieldname as 'parent'.
(I am using Django 1.0.2)

Now I can pass the fieldnames as values('parent') for now, It would be
easier if initial did not care if the _id is provided or not.
Or am I missing something else?

Maeck


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



FormSet issue. Pre-populating from queryset

2008-12-11 Thread maeck

The example below is a snippet from a view where I use a form to show
'Parent' and a formset to show its 'Children'.
If I get the children as a queryset and pass it on to the formsets
initial property, it errors out with: 'Parent' object is not iterable

InlineFormSet   = formset_factory(InlineForm)
data= Parent.objects.get(id = data_id)
form= ParentForm(instance=data)
inlinedata  = Child.objects.filter(parent_id  = data_id)
inlineform  = InlineChildFormSet(initial=inlinedata)



However, the following works (same data, just a list of dicts):

InlineFormSet   = formset_factory(InlineForm)
data= Parent.objects.get(id = data_id)
form= ParentForm(instance=data)
inlinedata  = [ {'a':10, 'b':20}
  {'a':11, 'b':21}
]
inlineform  = InlineChildFormSet(initial=inlinedata)


What am I missing in the first example?


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: templates database access

2008-12-08 Thread maeck

Your user will not have access to your database from the browser, so
you cannot do any kind of create, update and deletes from templates
directly.
It will always have to go through POST on your views. You could do
some AJAX to avoid web-page roundtrips, but then again, you will be
using views to do this. Never your template.

maeck

On Dec 8, 2:25 am, Vicky <[EMAIL PROTECTED]> wrote:
> Is there any way to insert, retrieve, delete and update tables in a
> database from templates itself?
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Reducing the number of my view's database queries

2008-12-08 Thread maeck

I think you are on something here.
Below is what concerns me most in the example:

data[o.name].append(o.model3_set.all().order_by('created')[0])

This will sort the entire model3 table just to get the min value.
And if the db is doing this 6000 times, that is a bit useless.

Have you tried using raw SQL in you model?
See: http://docs.djangoproject.com/en/dev/topics/db/sql/#topics-db-sql
You do not have to use the Django ORM for this.

Maeck


On Dec 8, 7:43 am, DavidA <[EMAIL PROTECTED]> wrote:
> If I undestand the problem correctly, in MySQL you could do this in
> one query as:
>
> select
>     m.*,
>     (select min(created) from model2 where id = m.model2_id) as
> first_created,
>     (select max(created) from model2 where id = m.model2_id) as
> last_created
> from model1 m
> ;
>
> I don't know how that translates to the Django ORM (or even if it
> does), though.
>
> -Dave
>
> On Dec 8, 12:27 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
> > On Sat, 2008-12-06 at 20:56 -0800, erikcw wrote:
> > > Hi all,
>
> > > I'm trying to write a model query that will return a queryset along
> > > with the latest (and earliest) data from 2 related models.
>
> > > Right now I'm doing something like this:
>
> > > objects = Model1.objects.filter(user=3).select_related() #about 6,000
> > > objects
>
> > > data = {}
> > > for o in objects:
> > >     data[o.name] = [o.field1, o.field2]
> > >     data[o.name].append(o.field3.model2_set.all().latest('created'))
> > > #get latest row from related model2
> > >     data[o.name].append(o.model3_set.all().order_by('created')[0])
> > > #get earliest row from related model3
>
> > > The problem is that this results in a TON of database queries.  This
> > > view is taking over a minute to process.  The select_related on the
> > > first line doesn't seem to be helping since I'm using latest()/
> > > order_by which generates a new query.
>
> > > How can I make this more efficient?  Denormalizing the isn't an option
> > > since model2 and model 3 are many-to-one.
>
> > By the way (since I still haven't worked out the complex SQL to make it
> > three queries yet), this last statement isn't correct. Denormalising
> > doesn't just mean flattening. You can store a computed dependent field
> > in model1 for the related information. So you could, for example, store
> > the relevant date and pk value of the related model2 row and update that
> > whenever a new model2 is inserted.
>
> > Malcolm
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: open source project management app that uses django?

2008-12-04 Thread maeck

You can use the standard css from the admin for your both the admin
pages as the custom reports.
Just load the admin css and follow the same html.

Works for me.

Maeck

On Dec 4, 12:04 am, Margie <[EMAIL PROTECTED]> wrote:
> Thanks - yes, that is pretty much the approach I am planning to take,
> but I just figured I'd see if there was anything interesting out there
> that would give me a spiffy look and feel for the reporting pages.
> One thing that I find confusing is how to come up with a color
> scheme.  I know that seems sort of low priority, but I swear the first
> thing people notice is if your colors are "ugly" or very basic looking
> (ie, black and white).
>
> Anyway, I will proceed with putting the models together as that is
> clearly the meat of the project at this poitn.  I just learned about
> CRUD tonight, and I can see how that is very nice.
>
> Thanks,
> Margie
>
> On Dec 3, 5:59 pm, maeck <[EMAIL PROTECTED]> wrote:
>
> > Margie,
>
> > If you can think up a decent model, you might be able to setup the
> > core of the project management application in the Django contrib.admin
> > module.
> > Development will go fast as long as you can stay with standard CRUD
> > pages.
> > The admin model will also give you the user security hooks necessary
> > for the manager and employees.
>
> > As soon as you nee a need for reporting pages or ways to do things a
> > little more complex than the admin can give you, you can build custom
> > pages for those. But I would think you could have 80% of your app
> > running only by setting up the database models and nice admin pages.
>
> > Maeck
>
> > On Dec 3, 3:41 pm, Margie <[EMAIL PROTECTED]> wrote:
>
> > > Hi everyone,
>
> > > I would like to create a django project managment web app to be used
> > > internally in my company.  I am a software developer, but have little
> > > experience with web apps other than my recent work going through the
> > > sams django tutorial book.
>
> > > I'm wondering if anyone knows of any open source/free django web app
> > > that I might be able to use to get started on this project.  Let me
> > > describe the usage model to give you an idea of what I'm aiming for.
>
> > > At a very high level, the usage model for this web app is that a
> > > "manager" assigns tasks to "employees" on a weekly basis. Associated
> > > with each task is a set of measurements that must be performed by the
> > > employee as he/she does the task.  The measurements vary based on the
> > > task, and somemes the measurement is reported with a comment string,
> > > sometimes a number, or sometimes a check mark in one of 'n' radio
> > > boxes.   As the employees complete the tasks, they fill in the
> > > measurements.  At the end of the week, the manager can look at each
> > > task and review the resulting measurements, and based on that data,
> > > decide the next weeks'  tasks.
>
> > > Unlike a project mangament tool like MS Project, which helps you
> > > schedule and gannt chart the schedule, this is really a tool to for
> > > enhancing project communication.  It is intended to allow the manager
> > > to easily communicate tasks to the employees, get the results back,
> > > and then make decisions about what the next set of tasks sould be.
> > > All without having to spend a lot of time emailing and talking to
> > > people.  In the environement where it will be used, the manager is
> > > getting results back from maybe 100 different employees, each of which
> > > have a few tasks to do.  The data is not complex, but there is just
> > > too much of it to manage without a tool.  Currently folks are using
> > > wiki and excel, but in my opninion this is not really automated
> > > enough.
>
> > > My thought is that a django web client could provide a very simple and
> > > easy to use interface, and could also be extended to get all sorts of
> > > nice long term trend information.  For exmaple, t would be interesting
> > > to know if a project being run at site A executes task 'foo' more
> > > frequently or for longer periods of time than a project being run at
> > > site B.  As data is across multiple similar projects, it seems that it
> > > could be mined for lots of interesting info to help improve the
> > > productivity of future projects.
>
> > > Ok - so hopefully you get the idea.  Now for my questions:
>
> > > * Does anyone know of exist

Re: exclude() method bug

2008-12-04 Thread maeck

If quantity is an integer field, should you not use the exclude as:
Place.objects.exclude(itemplace__quantity = 0)
If this is not it, please show us the models.


Maeck


On Dec 4, 4:58 am, Karantir <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've just found strange django behaviour and want to understand is it
> a bug or an inconvenient feature. I have two models -- Place and Item
> bound through the intermediate table ItemPlace (that stores additional
> field -- quantity). Physically it describes some quantity of items
> lying on the some places.
>
> Then i've tried to fetch spare places with the following request:
> Place.objects.filter(itemplace__quantity = None) and it works
> perfectly. After that i've run Place.objects.exclude
> (itemplace__quantity = None) to fetch occupied places but this request
> anyway returns an empty list.
>
> Surely i can use Place.objects.filter(itemplace__quantity__gte = 0)
> and it works but why the previous request fails? Any ideas?
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: open source project management app that uses django?

2008-12-03 Thread maeck

Margie,

If you can think up a decent model, you might be able to setup the
core of the project management application in the Django contrib.admin
module.
Development will go fast as long as you can stay with standard CRUD
pages.
The admin model will also give you the user security hooks necessary
for the manager and employees.

As soon as you nee a need for reporting pages or ways to do things a
little more complex than the admin can give you, you can build custom
pages for those. But I would think you could have 80% of your app
running only by setting up the database models and nice admin pages.

Maeck



On Dec 3, 3:41 pm, Margie <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> I would like to create a django project managment web app to be used
> internally in my company.  I am a software developer, but have little
> experience with web apps other than my recent work going through the
> sams django tutorial book.
>
> I'm wondering if anyone knows of any open source/free django web app
> that I might be able to use to get started on this project.  Let me
> describe the usage model to give you an idea of what I'm aiming for.
>
> At a very high level, the usage model for this web app is that a
> "manager" assigns tasks to "employees" on a weekly basis. Associated
> with each task is a set of measurements that must be performed by the
> employee as he/she does the task.  The measurements vary based on the
> task, and somemes the measurement is reported with a comment string,
> sometimes a number, or sometimes a check mark in one of 'n' radio
> boxes.   As the employees complete the tasks, they fill in the
> measurements.  At the end of the week, the manager can look at each
> task and review the resulting measurements, and based on that data,
> decide the next weeks'  tasks.
>
> Unlike a project mangament tool like MS Project, which helps you
> schedule and gannt chart the schedule, this is really a tool to for
> enhancing project communication.  It is intended to allow the manager
> to easily communicate tasks to the employees, get the results back,
> and then make decisions about what the next set of tasks sould be.
> All without having to spend a lot of time emailing and talking to
> people.  In the environement where it will be used, the manager is
> getting results back from maybe 100 different employees, each of which
> have a few tasks to do.  The data is not complex, but there is just
> too much of it to manage without a tool.  Currently folks are using
> wiki and excel, but in my opninion this is not really automated
> enough.
>
> My thought is that a django web client could provide a very simple and
> easy to use interface, and could also be extended to get all sorts of
> nice long term trend information.  For exmaple, t would be interesting
> to know if a project being run at site A executes task 'foo' more
> frequently or for longer periods of time than a project being run at
> site B.  As data is across multiple similar projects, it seems that it
> could be mined for lots of interesting info to help improve the
> productivity of future projects.
>
> Ok - so hopefully you get the idea.  Now for my questions:
>
> * Does anyone know of existing web apps (django or otherwise) like
> that already exists?
>
> * Does this sound like something that would be good to do in Django?
>
> * Does anyone know of any free/open source software (django based)
> that I could use as a starting point?  Not being a web developer, I
> know that if I do this from scratch, I will probably not do a great
> job.  No doubt there are a ton of intracacies to window layout, the
> structure of the models, the html templates, and other things I
> haven't even thought of.  So I'm thinking it would be great to
> bootstrap from some existing code, even if it doesn't do quite what I
> want.  I would be happy to contribute my own work back to the open
> source community.
>
> Thanks for any ideas!
>
> Margie
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Keeping fields out of the Admin

2008-11-21 Thread maeck

Please note that the result of this is that if you use
'editable=False' this field is not visible in the admin at all.
As far as I know there is no good way (see below) of putting read only
data in an admin page.

You could however, create a read only widget (there are some examples
to be fund on the internet), however, if you still need to save the
form, you nee dto keep that data in a hidden form field which opens up
the possibility of people fiddling with POST data.

Last resort, create your own custom view.

maeck.



On Nov 20, 11:46 pm, Lars Stavholm <[EMAIL PROTECTED]> wrote:
> Epinephrine wrote:
> > I have a field that should never be edited by hand.  It is basically
> > date_letter_sent, and it should be filled in by a view function when
> > it sends a letter.
>
> > How can I keep the field from being editable in the Admin edit page
> > for that class?
>
> editable = False in the model definition.
> /L
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: urlpatterns and generic views cheatsheet

2008-08-25 Thread maeck

I have printed this from scribd into a PDF and use it as such, no need
for login.
Works somewhat, cannot select the text from it (could have run some
text recognition on it), but expect to find the original code or pdf
somewhere soon (Google code maybe).

maeck
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms is_valid issue

2007-05-02 Thread maeck

d = Person.objects.get(id=1)
p = forms.models.form_for_instance(d)
f=p()

After I do this both "f.is_valid()" and "f.is_bound" are false.
However, there is correct data in the form if I do "print f" (and that
confuses me).

An alternative way I tried was:
  d = Person.objects.get(id=1)
  p = forms.models.form_for_instance(d)
  f = p(d.__dict__)
When I do this, the form is bound but not valid.
The value for the foreign key field "country" is lost and therefore
not longer valid, which is correct.
Nevertheless the value for the country field should be set correctly
(as it is if I do print d.__dict__).

I am using Django 0.96 release version on mysql.

M.


On May 1, 11:19 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2007-05-01 at 21:21 -0700, maeck wrote:
> > oops, did not use form_for_instance(d).
> > However, is_valid is not telling me that the form is correct.
> > What am I doing wrong?
>
> Well, if f.bound is True and f.is_valid() is false, f.errors will
> contain the validation errors. That would be a good spot to start
> looking.
>
> Regards,
> Malcolm


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms is_valid issue

2007-05-01 Thread maeck

oops, did not use form_for_instance(d).
However, is_valid is not telling me that the form is correct.
What am I doing wrong?

>>> d = Person.objects.get(id=1)
>>> p = forms.models.form_for_instance(d)
>>> f=p()
>>> print f
Name:
Country:
-
USA
Netherlands

Addr1:
Addr2:
Addr3:
Addr4:




On May 1, 10:10 pm, maeck <[EMAIL PROTECTED]> wrote:
> I am confused about the following:
> If I get a previous saved record, transform it into a form instance
> and then create a form out of it, the data is not valid nor bound (see
> below). However, if I print out the form, all fields are populated
> correctly.
> Am I missing a step?
>
> Thanks, Marcel
>
> >>> d = Person.objects.get(id=1)
> >>> p = forms.models.form_for_model(d)
> >>> f=p()
> >>> f.is_valid()
> False
> >>> f.is_bound
> False
> >>> print f
>
> Name: type="text" name="name" maxlength="200" />
> Country: name="country" id="id_country">
> -
> USA
> Netherlands
> 
> Addr1: id="id_addr1" type="text" name="addr1" maxlength="200" />
> Addr2: id="id_addr2" type="text" name="addr2" maxlength="200" />
> Addr3: id="id_addr3" type="text" name="addr3" maxlength="200" />
> Addr4: id="id_addr4" type="text" name="addr4" maxlength="200" />
>
>


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



newforms is_valid issue

2007-05-01 Thread maeck

I am confused about the following:
If I get a previous saved record, transform it into a form instance
and then create a form out of it, the data is not valid nor bound (see
below). However, if I print out the form, all fields are populated
correctly.
Am I missing a step?

Thanks, Marcel

>>> d = Person.objects.get(id=1)
>>> p = forms.models.form_for_model(d)
>>> f=p()
>>> f.is_valid()
False
>>> f.is_bound
False
>>> print f
Name:
Country:
-
USA
Netherlands

Addr1:
Addr2:
Addr3:
Addr4:
>>>


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django keeps growing, performance keeps dropping

2007-03-07 Thread maeck

First, what database platform do you use: MySQL or Postgres.

MySQL has ways of logging slow queries (see /etc/mysql/my.cnf), this
will give you an understanding of which queries are slow and you may
be able to add indices where necessary. Secondly, if you use
PHPmyAdmin it can tell you what tuning parameters need to be changed.
You may want to do this on your development environment, not on
production.

I have no experience with Postgres. But learning how to tune a
database is something that you can learn thru the MySQL or Postgres
channels. Sometimes an increase in table or buffer size can make a
serious difference in database responsiveness.

good luck.



On Mar 7, 9:47 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Sounds good. How does one go about profiling? Is there a tutorial or
> something you can point me to?
>
> Also, I appreciate everyone's patience with these dumb and vague
> questions. It's frustrating being a stupid newbie.
>
> For what it's worth, I have found some things, most notably that I was
> - for whatever reason - cycling through every post for every topic
> when I built the topic list. That might be slowing things down a bit.
>
> On Mar 7, 10:26 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
>
> > On 3/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > I think the problem lies in the forum (a modified Myghtyboard install)
> > > and in it's relationship to users. Since both forum posts and users
> > > keeps growing, I wonder if I've created some sort of exponential
> > > growth situation for myself.
>
> > Probably the first thing to do is start profiling to figure out where
> > the time is actually being spent; without knowing where your
> > bottleneck is, it's hard to suggest possible solutions.
>
> > --
> > "Bureaucrat Conrad, you are technically correct -- the best kind of 
> > correct."


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---