How does Django handle Foreign Key in MySQL?

2010-12-21 Thread Andy
Say I have these models: class Musician(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) class Album(models.Model): artist = models.ForeignKey(Musician) name = models.CharField(max_length=100) MySQL with MyISAM tables

Re: Problem with simple file upload.

2010-12-21 Thread vivek_12315
Awaiting reply! On Dec 22, 3:36 am, vivek_12315 wrote: > I am a beginner in Django programming. I am writing a simple module > for file upload looking at link: > > http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=o... > > I have made a view =

Re: template inheritance problem

2010-12-21 Thread Harbhag Singh Sohal
> When you pass apples, you cannot expect oranges :) Well, I got your point. I just ignored the whole point of inheritance and was expecting some magic to happen. -- Harbhag Singh Sohal http://harbhag.wordpress.com -- You received this message because you are subscribed to the Google Groups

Re: Suspending tasks in response to a systematic transient error

2010-12-21 Thread dmitry b
Woops, sorry, please ignore. I posted this to a wrong group. -- 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

Suspending tasks in response to a systematic transient error

2010-12-21 Thread dmitry b
Hi, Let's say I have several hundred instances of a task waiting in a queue and this task needs a database connection to complete successfully. Somewhere along the way the database goes down, so tasks are starting to fail one after another. When this happens (say when ), is there a way to

Admin Site: how to add apps with no db model?

2010-12-21 Thread armandoperico
Hi, on my "homepage" app i have some helper classes//scripts that are responsible for doing some specific "ADMIN" tasks: for example: - download rss files from a list of sources - store the rss (downloaded infos) info in a table - find some specific words and add on the "tags" table - ... right

Sorl and Apache

2010-12-21 Thread Heath
Hello, I am using sorl thumbnail generation and all works well under the Django development server. On the production server (Apache:81-django; Lighttpd:80- static), there is no key/value created in response to the template tag request, and hence, no thumbnail generated. If the same view is

Re: Haystack error rebuinding index

2010-12-21 Thread Daniel França
Hi, the problem was some incompatibilites between haystack and haystack-xapian 2010/12/21 Daniel França > here's the stackstrace > > Traceback (most recent call last): > File "manage.py", line 28, in > execute_from_command_line() > File >

Re: Noob question: using multiple classes in a detail page's view

2010-12-21 Thread Matt
Swapping out the get_object_or_404 mess with the select_related method works in some sense in that my executive detail pages show up properly but the template is still ignoring the information from the nonprofit class. I'm expecting that a click on that href would result in /nonprofit/1 but

Re: English translation for error message?

2010-12-21 Thread Bill Freeman
On Tue, Dec 21, 2010 at 5:53 PM, Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > [jhayw...@cmlnxbld01 invdb]$ python manage.py shell > Python 2.7 (r27:82500, Dec 2 2010, 14:06:29) > [GCC 4.2.4] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >

English translation for error message?

2010-12-21 Thread Jonathan Hayward
[jhayw...@cmlnxbld01 invdb]$ python manage.py shell Python 2.7 (r27:82500, Dec 2 2010, 14:06:29) [GCC 4.2.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> import models Traceback (most recent call last): File "", line 1, in File

Problem with simple file upload.

2010-12-21 Thread vivek_12315
I am a beginner in Django programming. I am writing a simple module for file upload looking at link: http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=olddocs I have made a view = upload.py and corresponding html = upload.html. Its content are as follows:

Re: Noob question: using multiple classes in a detail page's view

2010-12-21 Thread Mário Neto
For that you could use the method select_related, if you want the details page has executives related to the nonprofit: e = Executive.objects.select_related().get(pk=id) Thus, there is a performance gain, it does not require database queries. 2010/12/21 Matt > I have

Re: Nested iteration through related models

2010-12-21 Thread Javier Guerra Giraldez
in the view: persons = Person.objects.all().order_by('group') in the template: {% for p in persons %} {% ifchanged p.group %} {{p.group}}: {%endifchanged%} {{p.name}} {% endfor %} -- Javier -- You received this message because you are subscribed to the Google Groups "Django

Nested iteration through related models

2010-12-21 Thread Dopster
Let's say I have the following models: class Group(models.Model): group_name = models.CharField(max_length=20) class Person(models.Model): group = models.ForeignKey(Group) name = models.CharField(max_length=50) How do I get an output of the following? GroupA: John, Stacy, Pete

Re: virtualenv and deployment

2010-12-21 Thread Graham Dumpleton
If you are using mod_wsgi read: http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode In short, code changes by default aren't picked up until a process restart. Thus when they are read depends on when specific hosting mechanisms starts new or restarts old processes. Graham On

Noob question: using multiple classes in a detail page's view

2010-12-21 Thread Matt
I have two classes in my model: nonprofit and executive. It's a one-to- many relationship, multiple executives for each nonprofit. I created an index page that displays all executives and all nonprofits. I've created detail pages for nonprofit and executive. But when I try to link back to a

Re: Basic django coding question - how to get totals on a summary screen

2010-12-21 Thread Casual Coder
Ah. That looks simple. Thanks! On Dec 21, 2:01 pm, Javier Guerra Giraldez wrote: > 2.1) use the sum() aggregation with the queryset, -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Basic django coding question - how to get totals on a summary screen

2010-12-21 Thread Casual Coder
Thanks Venkat, I do like that book -- in fact, it was that book which pointed me to this google group. I considered all 4 of those options. Wasn't sure if any of them were contrary to the philosophy of Django. I wonder if I'm paranoid of an imaginary code review! Mike -- You received this

Re: Basic django coding question - how to get totals on a summary screen

2010-12-21 Thread Javier Guerra Giraldez
2.1) use the sum() aggregation with the queryset, making the DB do the work. pass to the template in an extra variable -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Creating initial Security/Auth objects with syncdb

2010-12-21 Thread Mark (Nosrednakram)
Hello, I would like to install an auth_group with my application and am considering using the following code in app/management/__init__.py. Is this an acceptable solution? Is there a better way to do this? Thanks, Mark from django.db.models import signals try: from

Question about MVC design

2010-12-21 Thread Marc Aymerich
I am designing an ISP control panel with django. I split the project in many apps, some will be reusable, others not. Well, one of its features is to provide mechanisms for users to create email accounts on a mail server with a cost. The apps involved on this process are: mails: store the mail

Re: template inheritance problem

2010-12-21 Thread Venkatraman S
Some effort in reading the docs always help. Please spend some time reading the DjangoBook and experimenting with it. For your current Q, did you try writing the code and reading http://www.djangobook.com/en/1.0/chapter04/ properly? Do you understand what you are doing in your view - as in, do

template inheritance problem

2010-12-21 Thread Harbhag Singh Sohal
I am having base.html template as follows: {% block title %}{% endblock %} Sohal Corporations Official Site {% block content%}{% endblock %} {% block footer %}{% endblock %} Then I am having title.html template as follows: {% extends "base.html" %}

Re: Basic django coding question - how to get totals on a summary screen

2010-12-21 Thread Venkatraman S
http://www.djangobook.com/ Helps in most of the cases. There are couple of solutions: 1) define a custom tag : pass the list as an argument to this function which computes the sum 2) when you are passing the list of items from your view to the template, why not calculate the same in the view

Re: Load file into a FileField

2010-12-21 Thread Chris Lawlor
Liriela, AFAIK it is not possible to programmatically populate a file input field, due to the many security exploits this would enable. If it were possible, it would be trivial to write a malicious script that would upload any file from a user's PC, so long as you knew the path. There are

Basic django coding question - how to get totals on a summary screen

2010-12-21 Thread Casual Coder
I am an experienced developer but new to web development, Python, and Django. Point me to a good book if you think this is too basic for this group. I coded a template that lists a bunch of items. Each item has a price. In the template, I want to include the sum of all the prices on a TOTAL

Re: Haystack error rebuinding index

2010-12-21 Thread Daniel França
here's the stackstrace Traceback (most recent call last): File "manage.py", line 28, in execute_from_command_line() File "/usr/lib/python2.6/dist-packages/django/core/management/__init__.py", line 352, in execute_from_command_line utility.execute() File

Re: Product to help Localize Django Application

2010-12-21 Thread Tom Evans
If you prefer to edit pofiles offline, then I would also recommend poedit[1], which has builds for most operating systems. Cheers Tom [1] http://www.poedit.net/ On Tue, Dec 21, 2010 at 4:38 PM, Eric wrote: > Perfect! :) > > Thank you Guillaume. > > On Dec 21, 11:11 am,

Re: Haystack error rebuinding index

2010-12-21 Thread Daniel França
Hi, here's my search index: import datetime from haystack import indexes from haystack import site from profiles.models import Profile class ProfileIndex(indexes.SearchIndex): text = indexes.CharField(use_template=True, document=True) first_name =

Re: Djangoweek.ly, a Django weekly newsletter

2010-12-21 Thread mengu
nice idea Jon. subscribed! On Dec 21, 2:00 pm, Jon Atkinson wrote: > Hello, > > I just wanted to drop a quick note to promote Django Weekly, a new weekly > Django newsletter which I'm putting together. I'm looking to send the first > issue around the 1st of January.

Re: Product to help Localize Django Application

2010-12-21 Thread Eric
Perfect! :) Thank you Guillaume. On Dec 21, 11:11 am, Guillaume Piot wrote: > You need to look into the Rosetta application for Django. It will turn your > translation file into paginated form with a textarea for each > strings/sentences. > > Regards > >

Re: Product to help Localize Django Application

2010-12-21 Thread Guillaume Piot
You need to look into the Rosetta application for Django. It will turn your translation file into paginated form with a textarea for each strings/sentences. Regards Guillaume Piot On 21 Dec 2010, at 15:58, Eric wrote: > We have a Django application that we would like to localize in > Spanish.

Re: python list in django template

2010-12-21 Thread Harbhag Singh Sohal
> Please read http://www.djangobook.com/ for the basics; understanding how the > models, views and templates work. Thanks, I found the answer there. -- Harbhag Singh Sohal http://harbhag.wordpress.com -- You received this message because you are subscribed to the Google Groups "Django users"

Product to help Localize Django Application

2010-12-21 Thread Eric
We have a Django application that we would like to localize in Spanish. However, nobody in our group speaks Spanish and so, we have sent the po file out for translating. This has caused problems because some of the editors get confused by the file structure. So, I was wondering if there is an

Re: python list in django template

2010-12-21 Thread Venkatraman S
On Tue, Dec 21, 2010 at 8:25 PM, Harbhag Singh Sohal < harbhag.so...@gmail.com> wrote: > I am new to python and django. I want to know about how can I display > items of python list in browser using django template. > Suppose I have list days = ['sunday','monday','tuesday'] > Which variable I

data sharing with differents projects

2010-12-21 Thread olarcheveque
Allo Gang, I have a couple Django applications which are responsible for managing MySQL data, but some are only-readable tables. (You could open this mini-schema http://pastebin.com/DiZiEFbT) These ones come from synchro system : datamaster push selected data on differents projects (on differents

Problem with sessions

2010-12-21 Thread Antoni Aloy
Hello! We're running an application under gunicorn that stores the session a postgresql database (it saves > 2 Mb info so memcached is not an option) and sometimes it's not able to save the sessions. We have added logs in the session and in the database and we see that sometimes the session

Retrieve all referenced foreign key objects

2010-12-21 Thread MarcoS
Hi, I've some models with a ForeignKey like this class Object1 name = models.varchar(max_length=50) class Object2 name = models.varchart(max_length=50) referenced_field = models.ForeignKey(Object1) class Object3 name = models.varchart(max_length=50) referenced_field =

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-21 Thread Morgan Wahl
2010/12/20 Łukasz Rekucki : > On 21 December 2010 00:18, Morgan Wahl wrote: >> Actually, it's funny you mention #7623; my situation _is_ described in >> #11618 ( http://code.djangoproject.com/ticket/11618 ). That bug was >> marked as a dup of #7623, but

python list in django template

2010-12-21 Thread Harbhag Singh Sohal
I am new to python and django. I want to know about how can I display items of python list in browser using django template. Suppose I have list days = ['sunday','monday','tuesday'] Which variable I need to define in views.py Please tell me part of code I need to write in django template. Thanks

Re: apps, views and templates

2010-12-21 Thread bruno desthuilliers
On 21 déc, 15:01, Олег Корсак wrote: > hello. I have a question about using multiple apps on the same page > (template). > > Lets imagine a template with two blocks > > {% block left_side %}{% endblock %} > and > {% block right_side %}{% endblock %} > > in

Re: Djangoweek.ly, a Django weekly newsletter

2010-12-21 Thread Venkatraman S
On Tue, Dec 21, 2010 at 5:30 PM, Jon Atkinson wrote: > > I just wanted to drop a quick note to promote Django Weekly, a new weekly > Django newsletter which I'm putting together. I'm looking to send the first > issue around the 1st of January. Hopefully this will be of

apps, views and templates

2010-12-21 Thread Олег Корсак
hello. I have a question about using multiple apps on the same page (template). Lets imagine a template with two blocks {% block left_side %}{% endblock %} and {% block right_side %}{% endblock %} in left_side block there is a voting app for example and in the right_side block there is a

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-21 Thread Torsten Bronger
Hallöchen! Russell Keith-Magee writes: > On Tue, Dec 21, 2010 at 8:33 PM, Torsten Bronger > wrote: >> Hallöchen! >> >> Marc Aymerich writes: >> >>> [...] >>> >>> Morgan, take a look at the inheritanceManager of this app: >>>

Re: virtualenv and deployment

2010-12-21 Thread Álex González
A related question... why my apache forks (to server to the clients) don't update the code at same time? Can I force django to compile and load the .py files at time of server? (Only for debug) On Thu, Dec 16, 2010 at 22:33, Graham Dumpleton wrote: > > > On Friday,

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-21 Thread Russell Keith-Magee
On Tue, Dec 21, 2010 at 8:33 PM, Torsten Bronger wrote: > Hallöchen! > > Marc Aymerich writes: > >> [...] >> >> Morgan, take a look at the inheritanceManager of this app: >> https://github.com/carljm/django-model-utils#readme > > Is anything like this planned for

Re: Djangoweek.ly, a Django weekly newsletter

2010-12-21 Thread Dave Sayer
On 21 December 2010 12:00, Jon Atkinson wrote: > Hello, > I just wanted to drop a quick note to promote Django Weekly, a new weekly > Django newsletter which I'm putting together. I'm looking to send the first > issue around the 1st of January. Hopefully this will be of

FormSet validation - not sure how to implement

2010-12-21 Thread Michael Thamm
I am using 2 formsets on a template form and it shows fine but I don't know how to implement the form validation. Not allow a field to be empty. I have tried the basic method as documented but it doesn't trigger any messages. However, I also haven't put any defined errors anywhere so I don't know

Load file into a FileField

2010-12-21 Thread Liriela
Hi there, I am working now on a web server and come up with a problem. I want to have on my site a button which will load test data into a form -> for example -> a form has fileds: name and email -> the button will load into the fields values defined by me. That is not a problem for all the data

Re: turning a Model instance into an instance of one of it's subclasses

2010-12-21 Thread Torsten Bronger
Hallöchen! Marc Aymerich writes: > [...] > > Morgan, take a look at the inheritanceManager of this app: > https://github.com/carljm/django-model-utils#readme Is anything like this planned for core Django? It's the third or forth time I see someone needing it. Tschö, Torsten. -- Torsten

Re: Complex serialization from models

2010-12-21 Thread Dan Fairs
On 21 Dec 2010, at 12:19, gregory semah wrote: > Nobody has a quick answer ? > Take a look at Django's natural key support - it allows you to control what's serialized for fk references. Cheers, Dan > On Dec 20, 4:11 pm, gregory semah wrote: >> Hi all, >> >> I'm

Re: Complex serialization from models

2010-12-21 Thread Konrad Delong
On 21 December 2010 13:19, gregory semah wrote: > Nobody has a quick answer ? > It looks like xml serialisation wasn't designed to be customisable in the way you need. If I were you, I'd look around the code and see what I could reuse from there. Konrad > On Dec 20,

Re: Djangoweek.ly, a Django weekly newsletter

2010-12-21 Thread Robbington
Thanks Jon, I've signed up and am eagerly awaiting the first issue. :) Rob -- 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

Re: Complex serialization from models

2010-12-21 Thread gregory semah
Nobody has a quick answer ? On Dec 20, 4:11 pm, gregory semah wrote: > Hi all, > > I'm searching a simple way to generate xml from my models, and a > simple use of serializers can do this for me. > But my models are defined with ForeignKey and ManyToManyField... > The

Djangoweek.ly, a Django weekly newsletter

2010-12-21 Thread Jon Atkinson
Hello, I just wanted to drop a quick note to promote Django Weekly, a new weekly Django newsletter which I'm putting together. I'm looking to send the first issue around the 1st of January. Hopefully this will be of interest to some of the members of this list. http://djangoweek.ly/ Cheers,

Re: running projects on the back of a base URL and having issues with the homepage

2010-12-21 Thread mongoose
Thanks for your replies. Appreciated. In the end we have setup sub domains so each project now runs on a sub domain instead of piggy backing off a base site. On Dec 16, 4:23 am, Graham Dumpleton wrote: > 'Criticism' is such a negative sounding word. :-( > > On

Re: Database edit tutorial / open source projects to learn from

2010-12-21 Thread Michele JD Granocchia
I'll check! Thanks! On 21 Dic, 05:44, Kenneth Gonsalves wrote: > On Mon, 2010-12-20 at 06:58 -0800, Michele JD Granocchia wrote: > > Can anybody post a good tutorial / open source project to learn > > something about database transactions? > > postgresql manual is excellent >

Re: server connection dropped? IO Error? What's going on?

2010-12-21 Thread Dan Fairs
> > ATM I don't get anything at all. Tracking with firebug, response > status is ok (200), but the response body is empty. And I don't see > how one could help you debugging this without access to the code, > database etc. FWIW, this is what I was seeing too. Can you turn up debug logging on

Re: server connection dropped? IO Error? What's going on?

2010-12-21 Thread bruno desthuilliers
On 20 déc, 17:52, "bax...@gretschpages.com" wrote: > Foolishly posted this late last week, which is a tough time to get > help. Please forgive me for reposting, but I'm at my wit's end here. > > What I've got is a very localized, yet apparently completely random > sort of