aggregation puzzle

2009-12-12 Thread Preston Holmes
I've hit a case where I want to use aggregation, but I think I'll have to end up using a for loop. I have items. They have an estimated cost and an actual cost They may have one, the other, or both defined. They are both DecimalFields I can get the sum of the estimated cost with a simple

Re: {{ form.as_table }} not displaying in template

2009-12-12 Thread Brian Neal
On Dec 12, 5:04 pm, GoSantoni wrote: > Hey i've got a very basic question about django form processing. Got > haystack installed and searching works fine in the standard search > template (http://haystacksearch.org/docs/tutorial.html#search- > template) in the /search .

Re: Cron vs event triggered action

2009-12-12 Thread creecode
Hello Tim, On Dec 12, 2:58 pm, Tim Daniel wrote: > Solution A: Have a datetime field with an expiry date and say every 10 > minutes a cron job checks the DB table for expired entries and > performs the programed action. I've used solution A in combination with custom

Re: Scope of variables in template blocks

2009-12-12 Thread pjrhar...@gmail.com
In your template tag you can add the variable to the global context like this: context.dicts[-1]['last_upload'] = whatever Pete -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Django-admin edit-form & change-list doesn't show to_field column

2009-12-12 Thread Kostas M
Karen thank you very much for your accurate reply. >  Changing the display in the > change view is a little more involved -- that needs to change the form used > by the admin to one where the field in question has a customized > label_from_instance that returns what you are looking for. > This

{{ form.as_table }} not displaying in template

2009-12-12 Thread GoSantoni
Hey i've got a very basic question about django form processing. Got haystack installed and searching works fine in the standard search template (http://haystacksearch.org/docs/tutorial.html#search- template) in the /search . Though i want to use the search box defined by {{ form.as_table }} in

Re: The best way to populate sqlite3 database

2009-12-12 Thread Zeynel
On Dec 12, 3:04 pm, Shawn Milochik wrote: > > http://pastebin.com/f651cf8de Hi, Thanks for the script, I want to use it but I have some questions. These are from the previous thread: http://groups.google.com/group/django-users/msg/091f964c6c8e40c7 but I have others as

Scope of variables in template blocks

2009-12-12 Thread Alex Rades
Hi, I have a master template which defines two blocks: {% block account %}{% endblock %} {% block content %}{% endblock %} I have a templatetag which tells me the time of the last image upload (it's a photo sharing site). This templatetag hits the database, and I don't want to call it multiple

Re: The best way to populate sqlite3 database

2009-12-12 Thread Shawn Milochik
The fastest way for large files is to use sqlite3's .import command to directly import a file. However, this will bypass any validation done by your models. You could end up with "bad" data, in that it doesn't conform to the rules of your models. Or, you can just write an external script to

Re: Count by date

2009-12-12 Thread philadams
i believe the way filters work (what martin referenced) is that you have to explicitly say which weekday you care about. what the op is looking for is a way to group by week day. ideally to write something like MyTable.objects.values(created__week_day).annotate (Count('id')) however, this

variable {% url %} parameter

2009-12-12 Thread Baurzhan Ismagulov
Hello, Another named URL question. I have the following pattern: (r'^app/(?P\d+)/$', create_update.update_object, {'model': App}, 'app-edit'), Now, using {% url 'app-edit' object.pk %} in a form throws TemplateSyntaxError, mentioning "NoReverseMatch: Reverse for 'rc.'app-edit'' with

Re: CSV to JSON snippet

2009-12-12 Thread Zeynel
This is fixed by modifying lines 31-32: http://stackoverflow.com/questions/1894099/csv2json-py-error On Dec 10, 3:12 pm, Zeynel wrote: > This worked fine before but now I get the error > > C:\...\Django\sw2\wkw2>csv2json.py csvtest1.csvwkw2.Lawyer > Converting

django.contrib.comments Templates

2009-12-12 Thread Carlos Ricardo Santos
Hi: I fully implemented the django.contrib.comments on my django app and comments are saved, showed, etc. Just one thing that annoys me... The write comment page and the confirmation page are not extending my base.html template. I found this post

Re: Inheriting from User, UserAdmin, and the Admin site

2009-12-12 Thread fgasperino
Looking into this a little deeper, it appears that from django.contrib.auth.admin.UserAdmin uses django.contrib.auth.models.User in the meta class. I've attempted to point this to my app's proxy model by inheriting here as well: -- forms.py -- from django.contrib.auth.forms import

RE: Looking for guidance on django-registration

2009-12-12 Thread Boris Schäling
> -Original Message- > From: django-users@googlegroups.com [mailto:django- > us...@googlegroups.com] On Behalf Of vishy > Sent: Saturday, December 12, 2009 5:41 PM > To: Django users > Subject: Looking for guidance on django-registration > > I have downloaded the latest module.Now,I

The best way to populate sqlite3 database

2009-12-12 Thread Zeynel
Hi, I first put the data in csv format than convert it to json and then create a fixture... which seems a long process. This http://stackoverflow.com/questions/1884694/how-to-populate-sqlite3-in-django/1885417#1885417 answer suggests to "Just load the database directly," but without giving much

Re: Looking for guidance on django-registration

2009-12-12 Thread Zeynel
I think this will be in the documentation of your hosting co, for instance, http://docs.webfaction.com/software/django.html#configuring-django-to-send-email-messages On Dec 12, 11:51 am, vishy wrote: > got the registration working.Now, how to setup activation email? > >

Re: Looking for guidance on django-registration

2009-12-12 Thread vishy
got the registration working.Now, how to setup activation email? On Dec 12, 9:41 pm, vishy wrote: > I have downloaded the latest module.Now,I need to set it up.I want > guidance,especially how to setup the templates, like what goes into > registration_form.html.If there

Looking for guidance on django-registration

2009-12-12 Thread vishy
I have downloaded the latest module.Now,I need to set it up.I want guidance,especially how to setup the templates, like what goes into registration_form.html.If there is some source code that will be great. thanks -- You received this message because you are subscribed to the Google Groups

Re: Can I change the models.py of an existing django app?

2009-12-12 Thread Zeynel
Shawn, Since I did not want to save the data I deleted the db file and ran synchdb and that created a new database. But eventually I will use south because I will keep adding new columns to this database. Thanks. On Dec 11, 7:50 pm, Shawn Milochik wrote: > I feel like a

Re: Can I change the models.py of an existing django app?

2009-12-12 Thread Zeynel
On Dec 11, 5:23 pm, Nick Arnett wrote: > If you don't need to save your existing data, the easiest thing is to drop > the old database and re-create it, then let syncdb create all the tables > again. Yes, I deleted the content of the sqlite3 database file and then ran

basic http authentication

2009-12-12 Thread Alessandro Ronchi
I need to make a view with a basic html authentication (because I need to use that url in a program that parse the result). I need to authenticate against the check of a permission. What's the best way to do that? -- Alessandro Ronchi http://www.soasi.com SOASI - Sviluppo Software e Sistemi

editable AutoField

2009-12-12 Thread Baurzhan Ismagulov
Hello, I'd like to have a numeric field that is shown in the admin and in the model form, the value entered by the user is saved, if no value is entered, the next sequence number is assigned by the database. Is there an easy way to do that? Or should I override the model's save method and use a

access legacy data without model.py

2009-12-12 Thread dundeemt
I need to access data in other databases. I don't want them listed in model.py as I won't be using django's orm for them. Given this, where is the preferred place to put the db connection for this data? The only references I could find show creating a db connection in the view,

Re: Error creating and saving a Django-object from the other script

2009-12-12 Thread tezro
Nope. Sorry for misdescription... Same error is "TypeError: 'slug' is an invalid keyword argument" when using: --- new_element = Element(title="title", date=datetime.now(), source=source_object, slug="slug") new_element.save() --- And the same "_mysql_exceptions.Warning: Field 'slug' doesn't have

HiddenInput for ModelChoiceField

2009-12-12 Thread Aaron
Say I have this model: model Foo(models.Model): bar = models.ForeignKey(Baz) I have a ModelForm for Foo (FooModelForm). However, instead of having a ModelChoiceField for bar, I want a single bar object in a hidden field that's specified when creating the FooModelForm. my_bar =

Re: Error creating and saving a Django-object from the other script

2009-12-12 Thread Shawn Milochik
On Dec 12, 2009, at 8:08 AM, tezro wrote: > Nope. Did it again on a clean project with the same models migrated > then by South. > > Same error. Any other clues? > > Thanks for replies. When you say "same error," do you mean this one: "Duplicate key name 'news_element_slug'"? If so, then it

Re: reverse in urlpatterns

2009-12-12 Thread Baurzhan Ismagulov
Hello Javier, On Thu, Dec 10, 2009 at 09:04:10AM -0500, Javier Guerra wrote: > urlpatterns = patterns('', >... >(r'^apps/$', list_detail.object_list, > {'queryset': App.objects.all()}, > 'app-list')), > ) > > urlpatterns += patterns('', >(r'^app/new/$':

Re: Error creating and saving a Django-object from the other script

2009-12-12 Thread tezro
Nope. Did it again on a clean project with the same models migrated then by South. Same error. Any other clues? Thanks for replies. On Dec 12, 3:25 am, Shawn Milochik wrote: > Why did you manually add a 'slug' field to your database after modifying the > model? Django's

Re: Error creating and saving a Django-object from the other script

2009-12-12 Thread tezro
Oops, sorry. Didn't remove the index. Now it worked. Proceeding :) On Dec 12, 3:51 pm, tezro wrote: > Added a migration with South... Ran it. > > --- > Running migrations for news: >  - Migrating forwards to 0002_add_slug. >  > news: 0002_add_slug > Traceback (most recent

Re: Error creating and saving a Django-object from the other script

2009-12-12 Thread tezro
Added a migration with South... Ran it. --- Running migrations for news: - Migrating forwards to 0002_add_slug. > news: 0002_add_slug Traceback (most recent call last): File "/home/tezro/lib/python2.5/South-0.6.2-py2.5.egg/south/ migration.py", line 330, in run_migrations

Re: Couldn't create tables.

2009-12-12 Thread rhce.san
I resolved the issue by creating the tables manually . Following command gave me more info about the tables. ./manage.py sqlall auth This is just a workaround let me know if we have a perfect solution for the same. Thanks, Santosh On Dec 12, 1:07 pm, "rhce.san" wrote: >

ProgrammingError: relation "django_session" does not exist

2009-12-12 Thread newpublic
when migrate djange from ubuntu 910 to fedora 12, there are so much trouble .. #- - == error information: Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch\ndefault=default_handler, arg=req,

Re: Should empty formsets call their own clean method?

2009-12-12 Thread patrickk
see also http://code.djangoproject.com/ticket/10828 I guess it´s a similar issue. On 11 Dez., 23:55, Preston Holmes wrote: > Well something wonky is going on. > > From my readthrough of the code, it *should* get called on empty > formsets: > > is_valid calls total_form_count

Re: Scammer / Job fraud rehash - Do NOT perform any business with Eike Post

2009-12-12 Thread bittin
thx for the tip :) On 12/12/09, David Ross @ Wolfeon wrote: > > Recently an individual has contacted me about "Eike Post"/"Eike Berend > Post" asking whether the person is legitimate. I must rehash an email > back from 2008 on this mailing list. > > The emails received

Re: Couldn't create tables.

2009-12-12 Thread rhce.san
I ran in many time but its not helping me . Can i create the tables manully.. On Dec 11, 11:52 pm, Ian wrote: > On Dec 11, 6:41 am, "rhce.san" wrote: > > > > > I have created the django project with necessary apps and trying to > > link it to the db. (