Re: Rails-style form value deserializer?

2009-12-19 Thread Matt Schinckel
On Dec 20, 2:22 pm, Todd Blanchard wrote: > I think what i actually want is a form set, but I don't find that all that > well done either. > > What I'm finding lacking is the ability to put a master/detail relationship > in a single form.  For instance, Author/Books. You

Re: Cron vs event triggered action

2009-12-19 Thread creecode
Hello Tim, On Dec 19, 6:28 am, Tim Daniel wrote: > Brian & Creecode Django Custom management commands are really the same > as this: > > from django.core.management import setup_environ > import settings > setup_environ(settings) > > or am I wrong? I'm just running the

Re: choice model with objects.values_list options

2009-12-19 Thread GoSantoni
Found this (old) post http://oebfare.com/blog/2008/feb/23/changing-modelchoicefield-queryset/ So i tried class Post(models.Model): blog = models.ForeignKey(blog) . url = models.ModelChoiceField (queryset=Image.objects.values_list()) def __init__(self, *args,

Re: Rails-style form value deserializer?

2009-12-19 Thread Todd Blanchard
I think what i actually want is a form set, but I don't find that all that well done either. What I'm finding lacking is the ability to put a master/detail relationship in a single form. For instance, Author/Books. Furthermore, I don't see a nice way to work with dynamically expanding forms

Re: Rails-style form value deserializer?

2009-12-19 Thread Todd Blanchard
Clear as mud. Where does it show how I update two objects in one form? On Dec 19, 2009, at 1:16 PM, Antoni Aloy wrote: > 2009/12/19 Todd Blanchard : >> How does this solve the problem of having two related objects that have the >> same attribute name (like "name") on the

announcement: SHPAML (alternative to haml)

2009-12-19 Thread Steve Howell
Hi, I have ported some haml concepts to Python in my implementation of SHPAML. Details here: http://shpaml.webfactional.com/ For those of you not aware of haml, haml is a markup language implemented in Ruby that allows you to eliminate end tags in HTML. Like Python itself, haml and SHPAML use

choice model with objects.values_list options

2009-12-19 Thread GoSantoni
Hey just a newbie question about the design of the models.py What is the best way to use the result of objects.values_list for a choices model ? ** shell *** In [1]: from photos.models import Image, Pool In [3]: Image.objects.values_list('image') Out[3]:

Re: LDAP-groups problem

2009-12-19 Thread Peter Herndon
On Dec 18, 2009, at 10:15 AM, Peter Herndon wrote: >> >> The error message came from command: python manage.py syncdb >> Creating table ldap_groups_ldapgroup >> Traceback (most recent call last): >> > [snip] >> cx_Oracle.DatabaseError: ORA-02329: column of datatype LOB cannot be >> unique or a

Re: install question:django-admin.py for help

2009-12-19 Thread Bob
Thank you very much for your quick response. That seems to have fixed it. The site I used was http://codemagnet.blogspot.com/2008/12/py-association-in-vistawindows-missing.html . I had to go into the windows registry, into the Computer/

Re: Rails-style form value deserializer?

2009-12-19 Thread Karen Tracey
On Fri, Dec 18, 2009 at 7:27 PM, Todd Blanchard wrote: > One thing I'm keenly missing from rails is the form input naming convention > that causes the form values to be converted into a hierarchy. For instance, > > > > > will result in the request values being stored as {

Re: very noob : DRY violation in views.py

2009-12-19 Thread Ethan Jucovy
Lately I have really liked using custom template tags for these sorts of queries. Once you get the hang of writing them, it's very quick to build a little library of queries in custom tags for your application. These are *very* convenient to use because you don't have to modify views.py -- or

Re: install question:django-admin.py for help

2009-12-19 Thread Karen Tracey
On Sat, Dec 19, 2009 at 7:04 PM, Bob wrote: > Hi, > I am trying to get started with django on windows vista. I have > successfully installed it as "import django" works in python. > However, whenever I try at the command prompt > "django-admin.py startproject myproject" >

install question:django-admin.py for help

2009-12-19 Thread Bob
Hi, I am trying to get started with django on windows vista. I have successfully installed it as "import django" works in python. However, whenever I try at the command prompt "django-admin.py startproject myproject" I get "Type 'django-admin.py help' for usage". I have tried four installs on 3

install question:django-admin.py for help

2009-12-19 Thread Bob
Hi, I am trying to get started with django on windows vista. I have successfully installed it as "import django" works in python. However, whenever I try at the command prompt "django-admin.py startproject myproject" I get "Type 'django-admin.py help' for usage". I have tried four installs on 3

Re: very noob : DRY violation in views.py

2009-12-19 Thread Osiaq
@Brian Thank you very much for clear explanation! I gives me much more than enormous pages of manuals. @Itay Thanks for suggestion, but refractoring inside views.py looks more clear to manage. I wasn't also sure, if such simple solution requires middleware involved. I will probably have more than

Is this right: Modifying the admin changelist?

2009-12-19 Thread yummy_droid
Hi, I wanted a "sum" of a particular column being listed in the admin list page. I looked it up and did it the following way. Is this the correct way of doing it? I modified the admin.py to do the calculation: class CollectionAdmin(admin.ModelAdmin): list_display = ('supplier',

Re: Rails-style form value deserializer?

2009-12-19 Thread Antoni Aloy
2009/12/19 Todd Blanchard : > How does this solve the problem of having two related objects that have the > same attribute name (like "name") on the same html form?  As I see it, it > doesn't.  There will be a conflict and it will be impossible to keep them > separate. > IOW, >

Re: very noob : DRY violation in views.py

2009-12-19 Thread Brian Victor
Osiaq wrote: > def services(request): > property = Property.objects.all().order_by('name')[:4] > city = City.objects.all() > category=PropertyCategory.objects.all() > status=PropertyStatus.objects.all() > return render_to_response('website/services.html',{'property':

Combine multiple Autopaginate on 1 page

2009-12-19 Thread GoSantoni
Guys got 2 columns generated by {% autopaginate blogs_one 3 %} {% for blog_post in blogs_one %} {% show_blog_post blog_post %} {% endfor %} {% paginate %} {% autopaginate blogs_two 3 %} {% for blog_post in

Re: SQL transaction style in django?

2009-12-19 Thread Christophe Pettus
On Dec 19, 2009, at 4:06 AM, Yusuf Mohsinally wrote: > In your experience, would it be better to use the > "@transaction.commit_on_success" decorator for the functions that need > it, or turn on transaction middleware for the whole app? My general approach, when using PostgreSQL as the backend,

Re: Humble-structure sites on Django // Suggestion needed

2009-12-19 Thread Brian McKeever
I'm not sure I'm entirely understanding your question, but yes, that does look easy to implement with django. What part is troubling you? You seem to have a good idea of what you want. On Dec 17, 6:42 am, tezro wrote: > Hello everyone. Making well-structured websites on

Re: Strange problem when starting project in Windows XP

2009-12-19 Thread Dane
Ok, figured this one out with google. Idle had taken over .py files. It was as simple as going to My Computer, Tools, Folder Options, File Types, scrolling down to .py, and clicking Restore Default (which is python). Thanks for the help all! On Dec 19, 2:14 pm, Dane

Re: Strange problem when starting project in Windows XP

2009-12-19 Thread Dane
C:\Python26\Scripts is where django-admin.py is, and it's in my PATH variable. It's strange because C:\Python26 (the path to python itself) is also in the same PATH variable, and that is working. If I just type 'python', I do get the shell. If idle.pyw has taken over .py associations, how would I

Re: Rails-style form value deserializer?

2009-12-19 Thread Todd Blanchard
How does this solve the problem of having two related objects that have the same attribute name (like "name") on the same html form? As I see it, it doesn't. There will be a conflict and it will be impossible to keep them separate. IOW, {{ account_form }} {{ contact_form }} def

Re: very noob : DRY violation in views.py

2009-12-19 Thread Itay Donenhirsch
i'm quite a noob myself but my best guess is to use context processor, see http://stackoverflow.com/questions/557460/django-having-middleware-communicate-with-views-templates On Sat, Dec 19, 2009 at 8:14 PM, Osiaq wrote: > VIEWS: > > def services(request): >        

very noob : DRY violation in views.py

2009-12-19 Thread Osiaq
VIEWS: def services(request): property = Property.objects.all().order_by('name')[:4] city = City.objects.all() category=PropertyCategory.objects.all() status=PropertyStatus.objects.all() return render_to_response('website/services.html',{'property':

Re: Cron vs event triggered action

2009-12-19 Thread Tim Daniel
David, Celery sounds really good, thanks for the tip, I'll have a deeper look into it as soon as I've got some time, if I can't get it up for this project I'll study it's details and put it up later maybe for a new release or a new project. For what I've seen until now it seems to be perfect,

Re: Migrating ForeignField to OneToOneField

2009-12-19 Thread Jonathan
Solved. It wasn't the OS, django, Python or MySQL versions... It was the South version. Locally I was using 0.6.2 whereas the on the development server I had 0.6-pre installed. btw, if you encounter this and try to "python setup.py install" the new South - remember to erase the old South folders

Re: question about django-pagination

2009-12-19 Thread Rodrigo Cea
You can paginate whatever you want. From the docs: "Note that you can give Paginator a list/tuple, a Django QuerySet, or any other object with a count() or __len__() method. " On Dec 19, 3:33 am, Continuation wrote: > In the django-pagination, it uses the example: > {%

Re: SQL transaction style in django?

2009-12-19 Thread Yusuf Mohsinally
Thanks! The blog post was very very helpful. In your experience, would it be better to use the "@transaction.commit_on_success" decorator for the functions that need it, or turn on transaction middleware for the whole app? Thanks On Sat, Dec 19, 2009 at 10:34 AM, Christophe Pettus

Feeds from the Tag Framework

2009-12-19 Thread Tim Sawyer
Hi Folks, The complex example of an Atom feed (http://docs.djangoproject.com/en/1.1/ref/contrib/syndication/#a-complex-example) is based on a model where it's possible to work out from a single element in the feed (in this case a Crime), what the driving object is (a Beat). So there's a

Re: Rails-style form value deserializer?

2009-12-19 Thread Jani Tiainen
Result is stored in request.POST (or you can do same with get params, ?foo=one=two). for example request.POST.getlist('foo'). Default getitem implementation returns only last occurence from list. See: http://docs.djangoproject.com/en/1.1/ref/request-response/#querydict-objectsfor more info.