Online Jobs.Earn Rs.50000 every month.Part time Jobs.No Investment
Online Jobs.Earn Rs.5 every month.Part time Jobs.No Investment http://netjobss.blogspot.com/ --~--~-~--~~~---~--~~ 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: choices/, how to get rid of the dashes?
I am also struck on this... I need output as Select your gender Male Female we are waiting for your valuable comments cschand --~--~-~--~~~---~--~~ 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 Email Failure
Andrey, Thank you for your reply. Your suggestion solved my problem along with correcting my mistake of not putting the to address in a list. I don't know how I ever would have figured out that the EMAIL_HOST_USER and EMAIL_HOST_PASSWORD were not for sending and needed to be commented out. Everything is working great at this time. Thanks again for your help, kidormb On Oct 2, 4:38 pm, Andrey Khavryuchenko <[EMAIL PROTECTED]> wrote: > k> I am trying to use the send_email facility from django.core.mail with > k> the following > k> in my settings.py > > k> EMAIL_HOST = 'smtp-server.cfl.rr.com' > k> EMAIL_PORT = '25' > k> EMAIL_HOST_USER = 'username' > k> EMAIL_HOST_PASSWORD = 'password' > > k> I get the error message: > > k> SMTP AUTH extension not supported by server. > > k> I am sure the username and password are correct and am using > k> RoadRunner in the central Florida area: > > Are you sure that this login/password are for *sending*? Try commenting > out EMAIL_HOST_USER and EMAIL_HOST_PASSWORD. > > -- > Andrey V Khavryuchenko > Django NewGate - http://www.kds.com.ua/djiggit/ > Chytach -http://www.chytach.com/ --~--~-~--~~~---~--~~ 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 Email Failure
Thejaswi, Thank you for your reply. For the record I am using XUbuntu 7.04 and the subversion release of django. My problem has been solved by another responder. Thanks again, kidormb On Oct 2, 3:46 am, Thejaswi Puthraya <[EMAIL PROTECTED]> wrote: > On Oct 2, 8:04 am, kidormb <[EMAIL PROTECTED]> wrote: > > > Thanks for the reply, but > > > SMTP AUTH extension not supported by server. > > > is the exact error message that I receive, which I think is > > a python error. > > Have never come across this problem!!! Which version of Django do you > use? Django 0.96 or from the subversion repository? Can you also give > us some information about the OS you use...sometimes Windows XP > firewall blocks port 25. > > Cheers > Thejaswi Puthraya --~--~-~--~~~---~--~~ 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: clean_data or cleaned_data
On 10/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > so changed to slug=form.cleaned_data['slug'], it is ok now. > > why? If you are using the development version of Django, it is very much in your best interest to follow Django's development carefully; from time to time, backwards-incompatible changes are made as needed, and each one is documented fully in this list between releases: http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges And then is added to the release notes when a new official release is packaged. The release notes for the Django 0.96 release indicated that several backwards-incompatible changes would take place before the next release, and if you're unwilling or unable to follow the development version carefully, you may want to stick to the last official release, or standardize your development on a particular SVN revision you're familiar with. -- "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 -~--~~~~--~~--~--~---
clean_data or cleaned_data
just a discussion: i used the code from djangosnippets.com for a newform: slug=form.clean_data['slug'], and it said there are no clean_data. so changed to slug=form.cleaned_data['slug'], it is ok now. why? you know i integrate code of djangosnippets.com as a app, it works well. just want to know how to make clean_data or change to cleaned_data. --~--~-~--~~~---~--~~ 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: Add a permission to a production db
On Wed, 2007-10-03 at 07:58 +0800, Russell Keith-Magee wrote: > On 10/3/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > > > How should I add a permission to an app/model that already exists in a > > production db? The docs say to use syncdb, but that doesn't work (I > > don't think) when the db tables already exist. Also, sqlall doesn't show > > the SQL that's used to create the permissions. > > > > I'm just really worried that I'll accidentally hose my db. > > My reading of this code is that it should add the permissions for your > pre-existing table. create_permissions() calls get_or_create for all > permissions on all models in a given app, and the handler will be > called for all installed apps. If you have a pre-existing table, it > won't have a permissions, so they should be created without any drama. > Thanks! I feel much better, now. Todd --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
choices/, how to get rid of the dashes?
Hi all, sorry for repeating my question but I haven't gotten a solution on first attempt and this really nags me. This is my model: class Person(models.Model): GENDER_CHOICES = ( ( 'm', 'Male' ), ( 'f', 'Female' ), ) gender = models.CharField( blank=False, null=False, "gender", maxlength=1, choices=GENDER_CHOICES, default='m' ) Using form_for_model() on the above model results in HTML like this: - Male Female How do I get rid of the first option (the dashes)? Creating my form with initial={ 'gender':'m' } at least sets the default option correctly (default='m' on the model is happily ignored btw, why?) but the dashes are still there. It obviously doesn't make sense to offer an option to the user that they aren't allowed to select, so can anyone confirm that this is a bug or is my code just acting wierd? -mark --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
MltiValueField-usage problem
Hi i'm trying to create some MltiValueField's so i found that code : http://www.djangosnippets.org/snippets/399/ When i tried it on the shell : class DateF(forms.Form): d=DateField() And on the console : In [48]: data={'d':[1,12,2004]} In [49]: d=DateF(data) In [50]: d.errors Out[50]: {'d': [u'This field is required.']} Where is my error ? How should i initialize it ? Thanks ffrom now :) --~--~-~--~~~---~--~~ 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: where to put algorithm libraries
On 10/2/07, staff-gmail <[EMAIL PROTECTED]> wrote: > I have a class full of algorithms - where is the best place to put this > in Django so that I can then just "import libxxx" in any model class. If they're logically part of the application, put them in the application. Nothing in Django prohibits you adding extra files beyond the standard set and, in fact, it's quite common to do that. Or if they're not application-specific, just put them somewhere on your Python path. -- "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 -~--~~~~--~~--~--~---
where to put algorithm libraries
I have a class full of algorithms - where is the best place to put this in Django so that I can then just "import libxxx" in any model class. --~--~-~--~~~---~--~~ 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: Add a permission to a production db
On 10/3/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > How should I add a permission to an app/model that already exists in a > production db? The docs say to use syncdb, but that doesn't work (I > don't think) when the db tables already exist. Also, sqlall doesn't show > the SQL that's used to create the permissions. > > I'm just really worried that I'll accidentally hose my db. The permissions are installed using a post-syncdb handler, registered by django.contrib.auth.management. The handler is create_permissions(). This is the reason that the SQL isn't included in sqlall - sqlall only shows you the create table/index calls. My reading of this code is that it should add the permissions for your pre-existing table. create_permissions() calls get_or_create for all permissions on all models in a given app, and the handler will be called for all installed apps. If you have a pre-existing table, it won't have a permissions, so they should be created without any drama. I don't think there's any risk that it would hose your db. However, Murphy being the man he is, I'd still take a backup before I did anything :-) Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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: Custom User model in django.contrib.auth
In addition, I think if you duplicate the existing auth app under another name, you're not going to be able to use the django.contrib applications, since lots of those (like admin) count on being able to do database joins between their table and the existing auth app's model objects. In other words, if you're trying to use session, admin, and so forth, tweaking the existing auth app might work, but I don't think duplicating it will work. Not an expert but just spent some time working through this stuff, Leo On Oct 2, 9:38 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 10/2/07, handsome greg <[EMAIL PROTECTED]> wrote: > > Short version - you can't do what you describe. The database tables > for the contrib.auth app aren't customizable, so you're not going to > be able to point them at your own database without duplicating the > existing auth app, or tweaking the existing one. > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ 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: deleting many2many relationship in object
On 10/3/07, Nabuco <[EMAIL PROTECTED]> wrote: > > In a view I receive some videokeyword id's existing in a Video to be > deleted. I tried > > sql = 'videokeyword_id IN (keywords)' <-- (filling keywords > placeholder with the id's, of course) > keywords = get_list_or_404(video.keywords_list.extra(where=[sql])) > for k in keywords: > k.delete() It looks to me that what you want is: video.keywords_list.remove(keywords) where keywords is a list of Keyword objects, or a list of primary keys of Keyword objects. For more details: http://www.djangoproject.com/documentation/db-api/#backward Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Add a permission to a production db
How should I add a permission to an app/model that already exists in a production db? The docs say to use syncdb, but that doesn't work (I don't think) when the db tables already exist. Also, sqlall doesn't show the SQL that's used to create the permissions. I'm just really worried that I'll accidentally hose my db. Thanks, Todd P.S. We just deployed a Django site entirely written by me and my high school students that we're hoping will evolve into a cool way for the school to exchange information. We just added over 2000 users and parents and teachers are using the system to schedule conferences. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with sessions
Hello! I'm working with the latest svn code and I have found that the db backend to store the session does not work anymore. It works if I configure the backend as cache and the caché itself as some kind of memory caché, but if fails on the other options. I have opened the ticket #5667 but it would be nice to know it somebody has the same problem or "is only on my machine". Regards, -- Antoni Aloy López Binissalem - Mallorca http://www.trespams.com Soci de Bulma - http://www.bulma.cat --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Recovery Windows Registry
Repair corrupted registry, fix your system http://windowsfreetips.blogspot.com/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problems creating a project with django-admin startproject (New Django user)
Just installed python/apache/django/mod_python with all the latest versions. I think I got most of my PATH variables set up correctly. However, when I try: C:\django>django-admin.py startproject testproject1 Traceback (most recent call last): File "C:\Python25\Scripts\django-admin.py", line 5, in management.execute_from_command_line() File "C:\Python25\lib\site-packages\django\core\management \__init__.py", line 255, in execute_from_command_line utility.execute() File "C:\Python25\lib\site-packages\django\core\management \__init__.py", line 215, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Python25\lib\site-packages\django\core\management\base.py", line 70, in run_from_argv self.execute(*args, **options.__dict__) File "C:\Python25\lib\site-packages\django\core\management\base.py", line 84, in execute output = self.handle(*args, **options) File "C:\Python25\lib\site-packages\django\core\management\base.py", line 152, in handle label_output = self.handle_label(label, **options) File "C:\Python25\lib\site-packages\django\core\management\commands \startproje ct.py", line 30, in handle_label settings_contents = open(main_settings_file, 'r').read() IOError: [Errno 2] No such file or directory: 'C:\\django\ \testproject1\\setting s.py' What might be wrong ? :/ Googling in general hasn't turned up much. I'm pretty newb all around though so it very well may be something simple and obvious. If more information is needed I can furnish that. --~--~-~--~~~---~--~~ 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 question with multiple object types in the same form
Thanks... I think that might be it! On 10/2/07, Doug B <[EMAIL PROTECTED]> wrote: > > > Search for 'prefix' in the regression tests, that does what you want. > Doesn't seem to be in the docs. > > > http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/forms.py > > > > > > -- Fred Palmer | Senior Software Engineer 615.653.7228 | www.studionow.com --~--~-~--~~~---~--~~ 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: how to scale
On 10/2/07, Andrey Khavryuchenko <[EMAIL PROTECTED]> wrote: > Shouldn't it? In case of MySQL replication (which is quite widely used) > and transactions someone somehow *has* to decide where the whole > transaction is going - to a master or to a slave. In the case of MySQL, use MySQL Cluster, which designates a "SQL Node" to receive the queries and route them through the cluster. > The most obvious candidate for "someone" is the developer and the > housekeeping stuff could be hidden in decorators. I wrote a bit more on > this at [1] (no working code yet, sorry). So when you change the number of databases in your cluster, do you also have to update *every* view in your application? You're making my case for me if that's so ;) -- "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 -~--~~~~--~~--~--~---
Re: how to scale
JB> As for database clustering, there's a philosophical issue here: Django JB> shouldn't need to know whether there's one database server behind it, JB> or five, or a hundred. Shouldn't it? In case of MySQL replication (which is quite widely used) and transactions someone somehow *has* to decide where the whole transaction is going - to a master or to a slave. The most obvious candidate for "someone" is the developer and the housekeeping stuff could be hidden in decorators. I wrote a bit more on this at [1] (no working code yet, sorry). Footnotes: [1] http://a.khavr.com/2007/10/01/how-to-use-mysql-replication-in-django/ -- Andrey V Khavryuchenko Django NewGate - http://www.kds.com.ua/djiggit/ Chytach - http://www.chytach.com/ --~--~-~--~~~---~--~~ 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 Email Failure
k> I am trying to use the send_email facility from django.core.mail with k> the following k> in my settings.py k> EMAIL_HOST = 'smtp-server.cfl.rr.com' k> EMAIL_PORT = '25' k> EMAIL_HOST_USER = 'username' k> EMAIL_HOST_PASSWORD = 'password' k> I get the error message: k> SMTP AUTH extension not supported by server. k> I am sure the username and password are correct and am using k> RoadRunner in the central Florida area: Are you sure that this login/password are for *sending*? Try commenting out EMAIL_HOST_USER and EMAIL_HOST_PASSWORD. -- Andrey V Khavryuchenko Django NewGate - http://www.kds.com.ua/djiggit/ Chytach - http://www.chytach.com/ --~--~-~--~~~---~--~~ 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 question with multiple object types in the same form
Search for 'prefix' in the regression tests, that does what you want. Doesn't seem to be in the docs. http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/forms.py --~--~-~--~~~---~--~~ 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: Variables in TemplateTags
Hi Niklas, I'm not certain, but you might find that the default template tag, widthratio already does what you need: http://www.djangoproject.com/documentation/templates/#widthratio The example shows how it can be used to create bar-charts etc. (to display percentage complete). Otherwise, yes your custom template can access the variable's value. You can look at the source of the widthratio tag to see how it's done there (django_src/django/templates/defaulttags.py). -Michael On Oct 3, 4:07 am, "niklas.voss" <[EMAIL PROTECTED]> wrote: > I have a Problem and can't find anything about it, that helps me... > > I integrated a self-made templatetag into django and it works well. > this tag just generate a percent bar. > There is only one argument which is given to the function, it is the > percentage status, but i dont want a static percentage by giving > everytime the page loads the same argument, instead of this there > shoud be a variable, which shows the user his status. > > So in code it should look like this: > If user is my argument that was given to render_to_response, i want to > give the function the submodel status of user; like this: > {{ percentbar user.status }} > > Is there a way to give this variable to the percentbar function in the > template? > Or should I do it through the views.py... > > I hope you understood my problem, because my english is very bad :) > > Niklas Voss --~--~-~--~~~---~--~~ 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: Downloadable HTML documentation?
Thanks, that looks great. I'll give it a try. Regards, -scott On Sep 30, 6:08 pm, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote: > On Sep 30, 2:23 pm, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > Given the age of that ticket, however, is the procedure that "requires > > a bit of work" documented anywhere? > > Or you could just use SmileyChris' implementation [1]_ for now (which > works well). > > .. [1]http://smileychris.tactful.co.nz/ramblings/django-documentation/ --~--~-~--~~~---~--~~ 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 question with multiple object types in the same form
Hi, I'm looking for the recommended way of handling this. I have some models like so: class ContactInfo(models.Model): uuid= UUIDField('UUID', blank=False, maxlength=50, core=True, unique=True, editable=False) first_name = models.CharField(blank=True, maxlength=20) last_name = models.CharField(blank=True, maxlength=20) address1= models.CharField(blank=True, maxlength=100) class TestProfile( models.Model): uuid= UUIDField('UUID', blank=False, maxlength=50, core=True, unique=True, editable=False) website_name= models.CharField(blank=False, null=True, maxlength=100) number_of_employees = models.IntegerField(blank=False, null=True) primary_contact_info= models.ForeignKey(ContactInfo, related_name='primary_address', blank=False, null=True) secondary_contact_info = models.ForeignKey(ContactInfo, related_name='payee_address', blank=False, null=True) I want to be able to simply call the form_for_model function and get a form for the TestProfile but this doesn't work out of the box if you are submitting all new data for the contact fields. So the question is how is this normally done? Doesn't seem possible with using auto_id to distinguish the two ContactInfo fields of TestProfile in the form since the "name" attribute is still the same. --~--~-~--~~~---~--~~ 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: def __str__(self) error in tutorial part 1
On 10/2/07, rhett <[EMAIL PROTECTED]> wrote: > > Total newbie here to Django and Python. Thanks for any insight. > > 1) I am working in TextMate and copied/pasted below code. In TextMate > the "def __str__(self)" is not indented from the pub_date line - it's > the same indent. I know indents are important - is there a way to set > up TextMate to show correct indentation? Or should I use a different > (Mac) editor? (I have to un-indent to not have a syntax error, but it > seems like it should be indented and the code doesn't execute > correctly). In TextMate, View -> Show Invisibles. Then, at the bottom of your document window, ensure "soft tabs" is checked, and use 4 spaces. In your document, replace any tabs with 4 spaces. Whitespace is significant in Python. Mixing tabs and spaces is a cardinal sin. I think TextMate is a fine editor for Python; you've just gotten unlucky with your cut-and-paste. --~--~-~--~~~---~--~~ 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: Unhashed passwords and django.contrib.auth
On Wed, 2007-10-03 at 01:00 +0600, Densetsu no Ero-sennin wrote: > I've just thought that it would be nice if Django supported pluggable hash > functions for passwords. This is one of those cases where it's micro-customisation without real widespread benefit. As a rule, when you need control over the hash function, you also need to touch other authentication things. This is supported as custom authentication backends. It's not that we necessarily say people should only use our default storage method, it's just that it is very much a real edge case to want to change just that one feature. Adding settings for every fine-grained feature leads to settings bloat and maintenance problems in the future. So we've made the common use-case (store and validate a password, without caring about the mechanics) and the harder stuff (any customisation you like) possible. 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: Unhashed passwords and django.contrib.auth
On 10/2/07, Densetsu no Ero-sennin <[EMAIL PROTECTED]> wrote: > Then it would be possible to define custom hash functions: > > class PlainText(object): > name = 'plain' > def get_hex_digest(salt, raw_password): > return raw_password Django will never support storing passwords in plain text. In fact, I'd go so far as saying that storing plaintext passwords *should* be a major pain in the ass: storing unhashed passwords is one of the most dangerous things a web developer can do. Jacob --~--~-~--~~~---~--~~ 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: Unhashed passwords and django.contrib.auth
I've just thought that it would be nice if Django supported pluggable hash functions for passwords. Something like this: class Sha1Hash(object): name = 'sha1' def get_hex_digest(salt, raw_password): import sha return sha.new(salt + raw_password).hexdigest() Then it would be possible to define custom hash functions: class PlainText(object): name = 'plain' def get_hex_digest(salt, raw_password): return raw_password A variable in settings.py could be used to specify which function to use for hashing new passwords (analogous to AUTH_PROFILE_MODULE): PASSWORD_HASH_MODULE = 'some.module.PlainText' --~--~-~--~~~---~--~~ 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: forum to mailing list integration
On Tue, 2007-10-02 at 13:22 -0400, Ian Lawrence wrote: > Hi > I have a requirement for all forum posts to go to a mailing list (this > i have implemented) but also that all subsequent posts on the mailing > list to the thread appear on the forum too. > Has anyone ever implemented anything like this before? I would prefer > a mailman solution but that is not crucial Not a lot of Django relevance here. Search for mail2news gateways and things like that. There are plenty of SMTP <-> NNTP solutions around, so customising one for a forum wouldn't be too hard. The only semi-tough part if identifying which thread to attach things to on the forum side, but even that's usually pretty easy. 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: hidden fields
I had a similar situation with hidden fields. I was using a newform, but didn't include the hidden fields. Then, in my template I had something like: {{ form }} where id_email had been set earlier in the view. This worked for me. On Oct 2, 7:27 am, Ana <[EMAIL PROTECTED]> wrote: > Thanks RajeshD :) > It wasn't exactly what I wanted to do but it was helpful. > > On Sep 7, 4:45 pm, RajeshD <[EMAIL PROTECTED]> wrote: > > > On Sep 7, 9:55 am, Ana <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > I'd like to have "last modified by" and "owner" fields in my > > > application. I'd like to set fields value automatically, and I want > > > those fields to be hidden. Is there any way I can do that? > > > Yes. > > > Here's one way to do it: > > > Add those two fields to your model and set editable=False on them so > > they don't show in the Admin. > > > Override your model's save method and set "last modified by" to > > current time i.e. datetime.datetime.now(). Also set the owner to the > > request user. Here's an article on how to get request.user using a > > custom middleware: > > >http://lukeplant.me.uk/blog.php?id=1107301634 --~--~-~--~~~---~--~~ 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: Unhashed passwords and django.contrib.auth
On Wed, 2007-10-03 at 00:38 +0600, Densetsu no Ero-sennin wrote: > On 3 October 2007 (Wed), James Bennett wrote: > > So don't use set_password(), and avoid any built-in views which try to > > hash things. > > That's not all. I won't be able to use check_password(), which also calls > get_hexdigest(). And I'll have to reimplement ModelBackend because of that, > and possibly some other things. And I'll have to tweak admin interface to > make password changing work. I'd really like to see some cleaner and simpler > solution. I think you're colliding two separate problems together here: custom authentication method and trying to use default methods to manage them. The first problem is using something other than the default authentication method (since you want to use a different storage method). That is solve by writing a custom authentication backend. See authentication.txt and search the wiki for some more information about that. You can store the plain text password in a field in the user profile or wherever you like. Then use the set_unusable_password() method on the User model to avoid any accidental use of the default system. The second problem is try to co-opt the standard User model methods to work with your custom auth scheme. That isn't what the default auth system is designed to handle -- if you want to customise, it's done via custom authentication backends and you are going to have to do the management of that yourself. However, some of this automatic use can be done via the fact that Python is designed to allow methods and functions to be replaced. Import the User model early enough in your code and then do things like User.check_password = my_custom_check_password and so on. No Django core changes required. 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: Unhashed passwords and django.contrib.auth
On 3 October 2007 (Wed), James Bennett wrote: > So don't use set_password(), and avoid any built-in views which try to > hash things. That's not all. I won't be able to use check_password(), which also calls get_hexdigest(). And I'll have to reimplement ModelBackend because of that, and possibly some other things. And I'll have to tweak admin interface to make password changing work. I'd really like to see some cleaner and simpler solution. > And make sure your stakeholders are OK with the security > implications of storing passwords in plain text. Actually, this is exactly what they want, so I guess it can't be helped. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
def __str__(self) error in tutorial part 1
Total newbie here to Django and Python. Thanks for any insight. 1) I am working in TextMate and copied/pasted below code. In TextMate the "def __str__(self)" is not indented from the pub_date line - it's the same indent. I know indents are important - is there a way to set up TextMate to show correct indentation? Or should I use a different (Mac) editor? (I have to un-indent to not have a syntax error, but it seems like it should be indented and the code doesn't execute correctly). 2) Working through Part 1 of the 0.96 tutorial, I don't get expected results when trying to add def __str__(self) to models.py. class Poll(models.Model): question = models.CharField(maxlength=200) pub_date = models.DateTimeField('date published') def __str__(self): return self.question def was_published_today(self): return self.pub_date.date() == datetime.date.today() class Choice(models.Model): poll = models.ForeignKey(Poll) choice = models.CharField(maxlength=200) votes = models.IntegerField() def __str__(self): return self.choice I get this returned in the shell: >>> Poll.objects.all() [] When I would expect: >>> Poll.objects.all() [] Any help greatly appreciated. Rhett --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Variables in TemplateTags
I have a Problem and can't find anything about it, that helps me... I integrated a self-made templatetag into django and it works well. this tag just generate a percent bar. There is only one argument which is given to the function, it is the percentage status, but i dont want a static percentage by giving everytime the page loads the same argument, instead of this there shoud be a variable, which shows the user his status. So in code it should look like this: If user is my argument that was given to render_to_response, i want to give the function the submodel status of user; like this: {{ percentbar user.status }} Is there a way to give this variable to the percentbar function in the template? Or should I do it through the views.py... I hope you understood my problem, because my english is very bad :) Niklas Voss --~--~-~--~~~---~--~~ 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: Unhashed passwords and django.contrib.auth
On 10/2/07, Densetsu no Ero-sennin <[EMAIL PROTECTED]> wrote: > I need to store unhashed user passwords in the DB. Is it possible with > django.contrib.auth? User.set_password method uses SHA-1 and it cannot be > overridden easily. So don't use set_password(), and avoid any built-in views which try to hash things. And make sure your stakeholders are OK with the security implications of storing passwords in plain text. -- "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 -~--~~~~--~~--~--~---
PyCon-Tech meeting starting now.
Just a friendly reminder that the meeting is starting now. http://pycon.blogspot.com/2007/10/next-pycon-tech-meeting-2-october.html -Doug --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Unhashed passwords and django.contrib.auth
Hi, I need to store unhashed user passwords in the DB. Is it possible with django.contrib.auth? User.set_password method uses SHA-1 and it cannot be overridden easily. --~--~-~--~~~---~--~~ 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: fell sad will a newform implement
Narrow this down and you should be able to work through it. First - is the view getting invoking correctly, regardless of what newforms is doing? If you're running on a dev server instance (i.e. django-admin runserver), then try printing out the request.POST or request.GET in the view to see what is coming through. You can also invoke django-admin shell and load up the Form and "poke at it", which I've found to be a pretty good debugging tool. i.e. >>> import forms >>> >>> example_data = { 'name' : 'test', 'description' : 'blue', 'vendor' : 'ford' } >>> f = forms.AddTypeForm(example_data) >>> f.is_valid() True or whatever. Break it down into steps to debug it, and then determine if each piece is working. You'll make good progress that way. -joe On 10/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > can somebody help me out of newform,i spend one whole day to study > djangosnipppets.com's newform, but it did not work for me. > > models.py: > class Vendor(models.Model): > > name = models.CharField(maxlength=100) > slug = models.SlugField() > > class Type(models.Model): > > vendor = models.ForeignKey(Vendor) > name = models.CharField(maxlength=100) > description = models.TextField() > > forms.py: > from django import newforms as forms > from models import Vendor > > attrs_dict = { 'class': 'required' } > > class AddTypeForm(forms.Form): > def __init__(self, *args, **kwargs): > super(AddTypeForm, self).__init__(*args, **kwargs) > self.fields['language'].choices = [('', '--')] + > [(x.id, x.name) for x in Vendor.objects.all()] > > > name = forms.CharField(max_length=100, > widget=forms.TextInput(attrs=attrs_dict)) > description = > forms.CharField(widget=forms.Textarea(attrs=attrs_dict)) > vendor = forms.ChoiceField(choices=(), > widget=forms.Select(attrs=attrs_dict)) > > views.py: > def add_car(request): > > if request.method == 'POST': > form = forms.AddTypeForm(request.POST) > if form.is_valid(): > new_type = Type(name=form.clean_data['name'], > > description=form.clean_data['description'], > > vendor_id=form.clean_data['vendor'], >) > new_type.save() > return HttpResponseRedirect(new_type.get_absolute_url()) > else: > form = forms.AddTypeForm() > return render_to_response('rate/add_car_form.html', > { 'form': form }, > > context_instance=RequestContext(request)) > add_car = login_required(add_car) > > templates: > > > > and i got this error: > > Page not found (404) > Request Method: GET > Request URL: http://127.0.0.1/cars/add/ > > No Vendor matches the given query. > > > > can somebody help me, thanks! > > > > > --~--~-~--~~~---~--~~ 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: Post question
Yes, absolutely. You have all the form data in the request object that comes into the view - you can use that to tweak data and send off another request externally. It's relatively high latency, but it definitely is possible. -joe On 10/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I dunno if this is possible or not. I have a form that posts to a > third party. It's a paypal payment processing type thing. What I want > to do is go through a view (or middleware??) and do something before I > go on to where the form was posting to. But I need to pass all the > form data on to the third party without losing it. So is it doable? > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Filefield issues with saving
Hey everyone, I have brought up this issue before, and I was able to fix a few things but I am still having a lot of problems. I have a model with a filefield, and i was testing it with the development server and it worked perfectly. When I tried to copy it into the working server is when I started having problems. The following is the model: class BulkDataRegFile(models.Model): """DataProviders can register their data sets in large amounts without having to enter the information into the same form several times. This class takes a file field that uploads the file to the system server and then reads the file and places the data into the database for use by others """ user = models.ForeignKey(User, blank = False) domain = models.ForeignKey(DataDomain, blank = False) bulk = models.FileField(upload_to = 'bulk/', unique = True) def __str__(self): return self.bulk def save(self): super(BulkDataRegFile, self).save() import ConfigParser config = ConfigParser.ConfigParser() file = get_bulk_filename() config.readfp(open(file)) sec = config.sections() for i in sec: set_name = i it = config.items(i) for k in it: tag = k[0] if tag == 'url': url = k[1] elif tag == 'type': type1 = k[1] elif tag == 'end_date': end = k[1] elif tag == 'start_date': start = k[1] elif tag == 'metadata': meta = k[1] if type1 == 'timeseries': type1 = 0 else: type1 = 1 univ = '%s.%s' % (domain.get_udi_prefix(), set_name) b = DataSet(domain = self.domain, data_set_type = type1, udi = univ, start_time = start, end_time = end, metadata = meta, server_url = url,) b.save() class Admin: pass I updated the database to add the table and synced it. Now I go into the Admin and try to upload a file through the admin interface and I get the following error: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in get_response 74. response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/ decorators.py" in _checklogin 55. return view_func(request, *args, **kwargs) File "/usr/lib/python2.4/site-packages/django/views/decorators/ cache.py" in _wrapped_view_func 40. response = view_func(request, *args, **kwargs) File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/ main.py" in add_stage 257. new_object = manipulator.save(new_data) File "/usr/lib/python2.4/site-packages/django/db/models/ manipulators.py" in save 101. new_object.save() File "/opt/vidars/cns/vidars/models.py" in save 189. config.readfp(open(file)) IOError at /admin/vidars/bulkdataregfile/add/ [Errno 2] No such file or directory: '' I have no idea what to do from here, for some reason it wont actually save the file to the directory I specified if i configured it correctly, which i am still not sure about. MEDIA_ROOT = '/var/www/media/' MEDIA_URL = 'https://vidars.sr.unh.edu/media/' media is a symbolic link to the media file in my app which contains all the css and images, so the apache server is serving those. other than that i dont know what to do. I am wondering if it is at a django level because when i get the traceback it gives me the values of the variables being used and the field 'bulk' doesnt get an id like the following. auto_now_add False f new_data http://terra.sr.unh.edu/cgi-bin/dataserver.pl\nstart_date: 1997-08-27\nend_date: 200-12-18\nmetadata: These data have been scraped from the NASA/CDAWEB website:\n http://cdaweb.gsfc.nasa.gov/cdaweb/istp_public/\n They are only meant for internal use and VIDARS testing.\n Use at your own risk! Jimmy Raeder [EMAIL PROTECTED]: timeseries\nurl: http://terra.sr.unh.edu/cgi-bin/dataserver.pl\nstart_date: 1997-08-27\nend_date: 2004-12-31\nmetadata: These data have been scraped from the NASA/\n\t CDAWEB website:http://cdaweb.gsfc.nasa.gov/ \n\t cdaweb/istp_public/ \n They are only meant for internal use and VIDARS\n\t testing.Use at your own risk! Jimmy Raeder\n\n[ac.bygse] \ntype: timeseries\nurl: http://terra.sr.unh.edu/cgi-bin/dataserver.pl\nstart_date: 1997-08-27\nend_date: 2004-12-31\nmetadata: These data have been scraped from the NASA/\n\t CDAWEB website:http://cdaweb.gsfc.nasa.gov/ \n\t cdaweb/istp_public/ \n They are only meant for internal use and VIDARS\n\t testing.Use at your own risk! Jimmy Raeder\n\n\n[ac.bzgse] \ntype:
forum to mailing list integration
Hi I have a requirement for all forum posts to go to a mailing list (this i have implemented) but also that all subsequent posts on the mailing list to the thread appear on the forum too. Has anyone ever implemented anything like this before? I would prefer a mailman solution but that is not crucial thx Ian -- http://ianlawrence.info --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
deleting many2many relationship in object
Hi, given the models class VideoKeyword(models.Model): """Keywords assigned to video information.""" name = models.CharField(max_length=120) class Video(models.Model): """Videos, videos, videos! keywords_list = models.ManyToManyField(VideoKeyword) this many2many relationship creates the tables app_video, app_videokeyword and the intermediate table app_video_keywords_list. In a view I receive some videokeyword id's existing in a Video to be deleted. I tried sql = 'videokeyword_id IN (keywords)' <-- (filling keywords placeholder with the id's, of course) keywords = get_list_or_404(video.keywords_list.extra(where=[sql])) for k in keywords: k.delete() but I found that this also deletes the keyword from app_videokeyword! I don't like to write raw SQL, is there any way to treat the middle table (app_video_keywords_list) or anything I'm missing in the db-api? or shall I go for the raw SQL? thanks in advance, hector --~--~-~--~~~---~--~~ 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: Random objects in view
This works for me. My model: class BannerPosition(models.Model): position = models.SmallIntegerField() banner = models.ForeignKey(BannerItem) class Meta: ordering = ('position', 'banner') def __str__(self): return '%s - %s' % (self.banner.name, self.position) class Admin: pass which is sorted via Class Meta. than my view: import random def banner(request, object_id): """ get the banners check if random or sorted. """ object = Banner.objects.select_related().get(id=object_id) objectMain = object object = object.banners.all() object = list(object) if objectMain.randomize: random.shuffle(object) return render_to_response('playlist.xml', {'object': object}) it checks if the "randomize" field is set in the banner object., if so it takes the list (you need to convert it to a list for shuffle to work) and shuffles it. than passes it on. works fine for me. o On Oct 1, 6:29 pm, "Alessandro Ronchi" <[EMAIL PROTECTED]> wrote: > I tried to reate a random view with the code on the bottom. It > doesn't work, the order is always the same. > What's wrong? > > # Create your views here. > > from adottami.adozioni.models import Scheda, Referente > from django.views.generic.list_detail import object_list > #from django.views.generic.list_detail import object_detail > > def random(request, provincia, numero, tipo): > items = Scheda.objects.all() > if provincia != None: > items.filter(provincia__iexact=provincia) > > if tipo != None: > items.filter(tipo__iexact=tipo) > > # Ordino a caso > items.order_by('?') > > if numero != None: > items = items[:numero] > > template = "random.html" > > return object_list( > request, > queryset = items, > template_name=template, > ) > > -- > Alessandro Ronchi > Skype: aronchihttp://www.alessandroronchi.net- Il mio sito > personalehttp://www.soasi.com- Sviluppo Softtware e Sistemi Open Source --~--~-~--~~~---~--~~ 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: trying to make Django work with fastcgi
I'm exactly there with you, David. Same with the manage.py. I can even sync up fine with MYSQL. If anybody has any ideas, I'm more than willing to try pretty much anything at this point. On Oct 2, 5:30 am, David Brown <[EMAIL PROTECTED]> wrote: > I'm actually having the exact same problem (I'm even an ASO customer, as > well). I got rid of the permission errors by changing the permissions on > dispatch.fcgi to 755. However, my .htaccess and dispatch.fcgi are > exactly the same (except that I removed the path stuff, since django and > flup are already in my path). I was able to run manage.py without any > errors, so that pretty much rules out import exceptions and such. > > Any ideas what else might be causing this? > > Thanks, > David Brown > > [EMAIL PROTECTED] wrote: > > Hi, > > > I'm new at this - learning as I go, but I can't seem to get Django > > running with fastcgi. > > > A Small Orange, my webhost, doesn't have mod_python support, so I've > > been trying to follow a number of different recommendations online to > > try and get my site up and running. > > > I've installed flup, downloaded the django trunk, created a project, > > and placed a 'dispatch.fcgi' file in the web root. > > > If I point my browser to the dispatch.fcgi file, it spins and spins > > forever, not even bothering with the kindness of timing out. > > > If I run the dispatch.fcgi file in the shell, I get the following > > error: > > >> # ./dispatch.fcgi > >> WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI! > >> WSGIServer: missing FastCGI param SERVER_NAME required by WSGI! > >> WSGIServer: missing FastCGI param SERVER_PORT required by WSGI! > >> WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI! > >> Status: 301 MOVED PERMANENTLY > >> content-type: text/html; charset=utf-8 > >> location:http://localhost:80/ > > > my .htaccess file: > > > > AddHandler fastcgi-script .fcgi > > RewriteEngine On > > RewriteBase / > > RewriteRule ^(media/.*)$ - [L] > > RewriteRule ^(admin_media/.*)$ - [L] > > RewriteRule ^(dispatch\.fcgi/.*)$ - [L] > > RewriteRule ^(.*)$ dispatch.fcgi/$1 [L] > > > > > my dispatch.fcgi file: > > > > #!/usr/bin/env python > > import sys, os > > > # Add a custom Python path. > > sys.path.insert(0, "/home/soulgt/projects/django/trunk") > > sys.path.insert(0, "/home/soulgt/projects/flup/trunk/flup") > > sys.path.insert(0, "/home/soulgt/projects") > > > # Set the DJANGO_SETTINGS_MODULE environment variable. > > os.environ['DJANGO_SETTINGS_MODULE'] = "pythonlearning.settings" > > > from django.core.servers.fastcgi import runfastcgi > > runfastcgi(method="threaded", daemonize="false") > > > > > I have no idea what's going on and really want to get this off the > > ground. Any help would be greatly appreciate - thanks in advance --~--~-~--~~~---~--~~ 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: Strange 'if' behaviour in template
I've just spotted something fairly obvious! The whole thing is wrapped in: {% if inline_admin_form.original or inline_admin_form.show_url %} That would explain it then! On Oct 2, 4:25 pm, AndyB <[EMAIL PROTECTED]> wrote: > Hi there, > > I'm overriding an admin template (but doubt uf that is particularly > relevent) and am not sure why the following behaviour occurs. > > I've modified the line: > > {% if inline_admin_form.original %}{{ inline_admin_form.original }}{% > endif %} > > to be: > > {% if inline_admin_form.original > %}test1{{ inline_admin_form.original }} {% else %}test2{% endif %} > > This is in a inline tabular fieldset so I can display the text 'Please > add another item' in the row of the table that represents the blank > new item rather than an existing one. "inline_admin_form.original" > contains the text of the existing item. I would expect any empty rows > to display test2 or at least show test1 if for some reason an expty > value still evaluated to True but instead they show nothing. > > So we have a test that fails an 'if' and doesn't pass the else? Or am > I missing something more obvious here? > > The file I'm overriding is: > newforms-admin\django\contrib\admin\templates\admin\edit_inline > \tabular.html --~--~-~--~~~---~--~~ 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: Generic/Views implementation decision
On Sep 29, 2007, at 6:14 PM, Panos Laganakos wrote: > > > On Sep 28, 12:18 pm, Panos Laganakos <[EMAIL PROTECTED]> > wrote: >> Having two different models, ie: Toy, ToyPicture. >> >> ToyPicture, has a ForeignKey to Toy, so you can define many pictures, >> that relate to a specific toy. >> >> The question is this: in which way should I make the data available >> for viewing? >> >> 1. Create list/detail generic views for Toy? That would mean I would >> have to create a custom template tag, in order to make the >> ToyPicture, >> available at the template level of Toy. >> >> 2. Create my own custom views of Toy/ToyPicture. >> >> What we should consider best practice, or is there's a completely >> different way to do it? Hi, Panos. Total newbie here with the same "problem" you have, but I think your ToyPicture objects should already be accessible in your template by doing a 'toypicture_set.all' call to your Toy object. In the template called by your Toy model's object_detail view, for example, you can do a {% for toypicture in object.toypicture_set.all %} to iterate through the ToyPicture objects. In my case though, I'm also not so sure if this is a good way (or "the way") for accessing the related objects when using the generic views. (I hope someone can clarify this.) > I created a list/detail generic view for Toy, and passed ToyPicture > objects, as an extra_context. That seems to work, not sure, how to > filter the objects at a URLconf level though, if that's possible, or > if I'll have to filter it at a template level. > > Still not sure if this is the *best* way to do it. Regarding doing a 'filter' on the queryset supplied to generic views, I found this article by Malcolm Tredinnick while searching the 'net for example usage of generic views: http://www.pointy-stick.com/blog/2006/06/29/django-tips-extending- generic-views/ In that article he wrote a view to wrap the call to the generic_view and supply a filtered queryset. (I think it's also a good idea to supply a 'select_related()'ed queryset to your Toy model's object_detail so you don't incur another database hit when accessing the related ToyPicture objects). HTH, Lemuel --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Strange 'if' behaviour in template
Hi there, I'm overriding an admin template (but doubt uf that is particularly relevent) and am not sure why the following behaviour occurs. I've modified the line: {% if inline_admin_form.original %}{{ inline_admin_form.original }}{% endif %} to be: {% if inline_admin_form.original %}test1{{ inline_admin_form.original }} {% else %}test2{% endif %} This is in a inline tabular fieldset so I can display the text 'Please add another item' in the row of the table that represents the blank new item rather than an existing one. "inline_admin_form.original" contains the text of the existing item. I would expect any empty rows to display test2 or at least show test1 if for some reason an expty value still evaluated to True but instead they show nothing. So we have a test that fails an 'if' and doesn't pass the else? Or am I missing something more obvious here? The file I'm overriding is: newforms-admin\django\contrib\admin\templates\admin\edit_inline \tabular.html --~--~-~--~~~---~--~~ 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: error when trying to save unicode data
On 02-Oct-07, at 7:47 PM, Nis Jørgensen wrote: > > get_or_create with "defaults" does what you asked for originally - > though the person commenting in the ticket got the syntax wrong. I'll test it out again and revert -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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: new user vs. logged out user
On 10/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I want to distinguish requests from people that have never had an > account from folks that just have an expired session. This really isn't possible; once their cookie expires, anything you "knew" about them disappears. You could set some sort of additional session value at log in, something like a "has_logged_in_once", but again -- once their cookie expires that value will disappear with it and you won't be able to tell again whether they're an unauthenticated user or someone who's never logged in. -- "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 -~--~~~~--~~--~--~---
new user vs. logged out user
Hi, I want to distinguish requests from people that have never had an account from folks that just have an expired session. The difference is important in saying "sign in again" vs. "here is what we do, go here to sign up". A wrinkle in this is the test cookie setup where you write a cookie to test if they have cookies turned on. The current test I was doing to see if the user had an account before was: def hasSession(request): return request.META.has_key("HTTP_COOKIE") But this will return true if you've seen the site before, and the test cookie was set and not deleted. I know there is a hygene issue around deleting test cookies. How does that relate to authenticating a user? If you login a user then delete the test cookie (or vice verse), what happens? Is there a way to test if the cookie is a test cookie? Is is somewhere in the session, and is it additive? Like "test cookie worked" + "authenticated user X" are both stored in the session? Thanks, Ivan --~--~-~--~~~---~--~~ 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: error when trying to save unicode data
Kenneth Gonsalves skrev: > On 02-Oct-07, at 6:21 PM, Nis Jørgensen wrote: > > >>> get_or_create, *only* using the value of 'word' in the query - if >>> created, then I do an update to set the other fields - otherwise I >>> leave it alone. >>> >> You could also use the "defaults" argument to get_or_create: >> >> http://www.djangoproject.com/documentation/db-api/#get-or-create- >> kwargs >> > > tried that too - it didnt help. For what it's worth, I filed a bug, > although I am not completely sure whether it is a bug. > > http://code.djangoproject.com/ticket/5662 > Part of your description in the ticket - specifically this part """ If the row containing 'word' is got, then the row has to be updated with the remaining values. If it is created - again it needs to be updated with the remaining values. """ is different from the description in this thread (quoted above), as well as from the first part of the ticket """ If the 'word' exists, the no action should be taken, """ get_or_create with "defaults" does what you asked for originally - though the person commenting in the ticket got the syntax wrong. Nis --~--~-~--~~~---~--~~ 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: Creating a Form with some uneditable fields
Was a "look all the fields type before asking problem" ... I've solved with HiddenField and disabled option ... class RuoteForm(forms.Form): line_name = forms.ChoiceField(choices=get_lines(), widget=forms.HiddenInput) prefix = forms.ChoiceField(choices=get_prefixes(), widget=forms.HiddenInput) shown_pre = forms.ChoiceField(choices=get_prefixes(), widget=forms.TextInput(attrs={'disabled': 'disabled'})) termination_name = forms.ChoiceField(choices=get_terminations()) This way the international prefix is shown but uneditable and the subsequent POST data let me choose the correct Route object to update. (One page shows more than one RouteForm for a given line_name) I need both prefix and shown_pre because when adding the 'disabled' attr POST doesn't have data for that field, I suppose that's the way html works ... >> I have some models like : >> >> class UserOfSomeStuff(models.Model): >> [...] >> >> class AvailableStuffToUse(models.Model): >> [...] >> >> class CurrentlyUsedStuff(models.Model): >> user = models.ForeignKey(UserOfSomeStuff) >> used_stuff = models.ForeignKey(AvailableStuffToUse) >> >> >> In my application I don't need to add new Users or new Stuff, I only >> need to change what Stuff is currently Used [1] >> So I want to create a form which when bounded to an instance of >> CurrentlyUsedStuff renders the "user" in plain text, and when saved >> just >> updates the data, without creating a new object. >> >> Is there a clean way to do this ? >> >> >> >> [1] : it's a GUI for routing calls with asterisk/python/mysql if >> you mind >> >> >> >> > > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
fell sad will a newform implement
can somebody help me out of newform,i spend one whole day to study djangosnipppets.com's newform, but it did not work for me. models.py: class Vendor(models.Model): name = models.CharField(maxlength=100) slug = models.SlugField() class Type(models.Model): vendor = models.ForeignKey(Vendor) name = models.CharField(maxlength=100) description = models.TextField() forms.py: from django import newforms as forms from models import Vendor attrs_dict = { 'class': 'required' } class AddTypeForm(forms.Form): def __init__(self, *args, **kwargs): super(AddTypeForm, self).__init__(*args, **kwargs) self.fields['language'].choices = [('', '--')] + [(x.id, x.name) for x in Vendor.objects.all()] name = forms.CharField(max_length=100, widget=forms.TextInput(attrs=attrs_dict)) description = forms.CharField(widget=forms.Textarea(attrs=attrs_dict)) vendor = forms.ChoiceField(choices=(), widget=forms.Select(attrs=attrs_dict)) views.py: def add_car(request): if request.method == 'POST': form = forms.AddTypeForm(request.POST) if form.is_valid(): new_type = Type(name=form.clean_data['name'], description=form.clean_data['description'], vendor_id=form.clean_data['vendor'], ) new_type.save() return HttpResponseRedirect(new_type.get_absolute_url()) else: form = forms.AddTypeForm() return render_to_response('rate/add_car_form.html', { 'form': form }, context_instance=RequestContext(request)) add_car = login_required(add_car) templates: and i got this error: Page not found (404) Request Method: GET Request URL: http://127.0.0.1/cars/add/ No Vendor matches the given query. can somebody help me, thanks! --~--~-~--~~~---~--~~ 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: Forms vs. Admin?
Although I think this view is mostly true at the moment I have a feeling that it will change in the near future. The admin pages are currently fairly customisable and newforms-admin expands this capability extensively. The problem is two-fold: 1. Documentation in this area is fairly weak and a lot of the customization involves subclassing Django classes etc. Currently the only way to understand this is to read the Django source - as readable as it is this is a whole level of complexity beyond that needed to use Django's standard features. 2. newforms-admin isn't quite ready yet - although it's getting very close. I decided to go down this route myself instead of writing my own CRUD. I am beginning to think I jumped the gun by a few months. There are still a few rough edges and it's hard to get answers when you are stuck as not many people are using Django Admin in this way. I'm nearly there although the fact that my users are will be fairly trustworthy has enabled me to cut a few corners that wouldn't be appropriate on a public website. Do have a look at what is possible in Admin simply by overriding the basic templates. The fact that you can do this on a model by model basis is extremely powerful in itself. Andy On Oct 1, 6:13 pm, cjl <[EMAIL PROTECTED]> wrote: > HG: > > Thank you for your reply. > > I guess I don't really have a well-formed question, but I having > trouble thinking of an example of using the admin interface that isn't > artificial. > > It seems that admin might be good when you are developing a website or > application to quickly add and edit data, but a mature website or > application will have data entry and editing done through forms. > > My confusion, and presumably the confusion of other newcomers, is that > admin is shown early in the learning process of the official tutorial, > and appears to be the way to enter data. Of course, admin is a huge > 'selling point', so I can understand why the developers would want to > show it off. > > OK, I guess my question is: In a mature web application developed with > Django, is admin really used for anything? Or, now that newforms- > admin is almost here, is there any difference between admin and forms? > Will admin just be another form, with low level access to the models? > > -cjl --~--~-~--~~~---~--~~ 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: hidden fields
Thanks RajeshD :) It wasn't exactly what I wanted to do but it was helpful. On Sep 7, 4:45 pm, RajeshD <[EMAIL PROTECTED]> wrote: > On Sep 7, 9:55 am, Ana <[EMAIL PROTECTED]> wrote: > > > Hi, > > I'd like to have "last modified by" and "owner" fields in my > > application. I'd like to set fields value automatically, and I want > > those fields to be hidden. Is there any way I can do that? > > Yes. > > Here's one way to do it: > > Add those two fields to your model and set editable=False on them so > they don't show in the Admin. > > Override your model's save method and set "last modified by" to > current time i.e. datetime.datetime.now(). Also set the owner to the > request user. Here's an article on how to get request.user using a > custom middleware: > > http://lukeplant.me.uk/blog.php?id=1107301634 --~--~-~--~~~---~--~~ 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: error when trying to save unicode data
On 02-Oct-07, at 6:21 PM, Nis Jørgensen wrote: >> get_or_create, *only* using the value of 'word' in the query - if >> created, then I do an update to set the other fields - otherwise I >> leave it alone. > You could also use the "defaults" argument to get_or_create: > > http://www.djangoproject.com/documentation/db-api/#get-or-create- > kwargs tried that too - it didnt help. For what it's worth, I filed a bug, although I am not completely sure whether it is a bug. http://code.djangoproject.com/ticket/5662 -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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: Forms vs. Admin?
All, I am new to DJango and web frameworks. I've gone through the tutorial to make the Poll application. The way I see it, the Admin module is for the site builders to have an automatic interface to maintain the look-up tables (sometimes called domain tables). These are the tables that populate most of the select, radio, and checkbox tags on the forms where the regular user does her data entry, or used for any other type of behind the scenes data tables. Think of the Poll application... you used the Admin module to make a poll and assign it choices. Then, outside of the Admin module, you built the poll detail view which contained a form that presents the poll question with radio buttons for the choices to allow the user to vote. Upon voting, the user is presented with the results view. Again, the actual voting by the user was written by hand. On Oct 1, 11:40 am, cjl <[EMAIL PROTECTED]> wrote: > I'm a Django and web-development newcomer, working on a tutorial for > other newcomers like me: > > http://www.instantdjango.com > > Anyway, I am working on the second chapter of my tutorial, and want to > show people how the 'admin' interface works. I am using the 'newforms- > admin' branch for this (hoping it will me merged soon). > > I realized that I don't really know when is the "right" time to use > the admin interface, and when is to the "right" time to accept input > through forms instead of using the admin interface. > > I know that they serve different purposes, but I'm having trouble > articulating those differences. > > Can anyone give me their opinion, or point me in the right direction > to learn more? > > -cjlesh --~--~-~--~~~---~--~~ 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: error when trying to save unicode data
Kenneth Gonsalves skrev: > > I now do > get_or_create, *only* using the value of 'word' in the query - if > created, then I do an update to set the other fields - otherwise I > leave it alone. You could also use the "defaults" argument to get_or_create: http://www.djangoproject.com/documentation/db-api/#get-or-create-kwargs Nis --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[offTopc]Novas Publicações!
Bom dia Amigos e Amigas!!! O site do Grupo New Business OnLine tem novas publicações, acesse agora mesmo o site (http://businessnewonline.blogspot.com/) e fique por dentro das novas oportunidades da Net!!! Em uma das publicações explicamos com clareza a dúvida mais frequente em nossa site, "*Quanto eu posso ganhar por mês na Internet?* ** Obrigado a todos e desculpa estar invadindo este espaço! Grupo New Business OnLine Ltda. http://businessnewonline.blogspot.com/ --~--~-~--~~~---~--~~ 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: trying to make Django work with fastcgi
I'm actually having the exact same problem (I'm even an ASO customer, as well). I got rid of the permission errors by changing the permissions on dispatch.fcgi to 755. However, my .htaccess and dispatch.fcgi are exactly the same (except that I removed the path stuff, since django and flup are already in my path). I was able to run manage.py without any errors, so that pretty much rules out import exceptions and such. Any ideas what else might be causing this? Thanks, David Brown [EMAIL PROTECTED] wrote: > Hi, > > I'm new at this - learning as I go, but I can't seem to get Django > running with fastcgi. > > A Small Orange, my webhost, doesn't have mod_python support, so I've > been trying to follow a number of different recommendations online to > try and get my site up and running. > > I've installed flup, downloaded the django trunk, created a project, > and placed a 'dispatch.fcgi' file in the web root. > > If I point my browser to the dispatch.fcgi file, it spins and spins > forever, not even bothering with the kindness of timing out. > > If I run the dispatch.fcgi file in the shell, I get the following > error: > >> # ./dispatch.fcgi >> WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI! >> WSGIServer: missing FastCGI param SERVER_NAME required by WSGI! >> WSGIServer: missing FastCGI param SERVER_PORT required by WSGI! >> WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI! >> Status: 301 MOVED PERMANENTLY >> content-type: text/html; charset=utf-8 >> location: http://localhost:80/ >> > > my .htaccess file: > > AddHandler fastcgi-script .fcgi > RewriteEngine On > RewriteBase / > RewriteRule ^(media/.*)$ - [L] > RewriteRule ^(admin_media/.*)$ - [L] > RewriteRule ^(dispatch\.fcgi/.*)$ - [L] > RewriteRule ^(.*)$ dispatch.fcgi/$1 [L] > > > my dispatch.fcgi file: > > #!/usr/bin/env python > import sys, os > > # Add a custom Python path. > sys.path.insert(0, "/home/soulgt/projects/django/trunk") > sys.path.insert(0, "/home/soulgt/projects/flup/trunk/flup") > sys.path.insert(0, "/home/soulgt/projects") > > > # Set the DJANGO_SETTINGS_MODULE environment variable. > os.environ['DJANGO_SETTINGS_MODULE'] = "pythonlearning.settings" > > from django.core.servers.fastcgi import runfastcgi > runfastcgi(method="threaded", daemonize="false") > > > I have no idea what's going on and really want to get this off the > ground. Any help would be greatly appreciate - thanks in advance --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problems with XMLField+Jing
Hello there, I'm using an XMLField in one of my models. I've downloaded jing for compilation with gjc from http://www.thaiopensource.com/relaxng/jing.html (I got the link from Djano documentation), compiled it and installed it fine. But when I create a new object from that model, using the admin interface (Django 0.96) I get: | Traceback (most recent call last): File "/var/lib/python-support/python2.5/django/core/handlers/base.py" in get_response 77. response = callback(request, *callback_args, **callback_kwargs) File "/var/lib/python-support/python2.5/django/contrib/admin/views/decorators.py" in _checklogin 55. return view_func(request, *args, **kwargs) File "/var/lib/python-support/python2.5/django/views/decorators/cache.py" in _wrapped_view_func 39. response = view_func(request, *args, **kwargs) File "/var/lib/python-support/python2.5/django/contrib/admin/views/main.py" in change_stage 325. errors = manipulator.get_validation_errors(new_data) File "/var/lib/python-support/python2.5/django/oldforms/__init__.py" in get_validation_errors 59. errors.update(field.get_validation_errors(new_data)) File "/var/lib/python-support/python2.5/django/oldforms/__init__.py" in get_validation_errors 362. self.run_validator(new_data, validator) File "/var/lib/python-support/python2.5/django/oldforms/__init__.py" in run_validator 352. validator(new_data.get(self.field_name, ''), new_data) File "/var/lib/python-support/python2.5/django/oldforms/__init__.py" in isValidXML 1013. v(field_data, all_data) File "/var/lib/python-support/python2.5/django/core/validators.py" in __call__ 539. ignored, line, level, message = error.split(':', 3) ValueError at /admin/servidores/software/1/ need more than 3 values to unpack Guys at #django told me that this means that django expected a different output format from jing. How can this be solved? Is there another location to download jing from (I haven't been able to find an Ubuntu package up to now). Thanks. PS: That ValueError doesn't happen from a python shell though. | --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- begin:vcard fn:Gonzalo Delgado n:Delgado;Gonzalo org:Fortix email;internet:[EMAIL PROTECTED] tel;work:+543814237797 tel;home:+543814243587 tel;cell:+3815183731 x-mozilla-html:FALSE version:2.1 end:vcard
Re: choose the database at runtime
On 2 Ott, 03:58, "Ben Ford" <[EMAIL PROTECTED]> wrote: > I've had to do something similar to this myself... my suggestion would be to > have a look at the multiple-db-support branch, here is some code that I use > on top of that branch to connect to different databases with the same > schema: .. > This function is from the wiki > articlehttp://code.djangoproject.com/wiki/DynamicModelswith some changes: You have done a great work, but probably I will create multiple istances of the application, as Russell suggested. It seems simpler. Besides in that way I will not have to care about changes done in the Django db core. However thanks a lot! Yours. --~--~-~--~~~---~--~~ 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: How to keep track of iterations through a for loop in my template?
Am 2007-10-01 um 23:59 schrieb Greg: > I have a table in my template that will contain an x number of rows > depanding on what I get back from the view. I want my table row > background color to rotate between red and white. As of now, I don't > know how to keep track of each iteration through my for loop to set > the appropriate bgcolor. Another solution is changing the CSS class of the rows afterwards with a bit of JavaScript (I love jQuery for such). It's a bit dirty, but I often need it if I dynamically change my forms/tables with JS anyway. Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) --~--~-~--~~~---~--~~ 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: choose the database at runtime
On 2 Ott, 02:34, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > Well, anything is possible, but not necessarily easy. It certainly > isn't a built-in feature - at least, not like you describe. You're right. The problem is often the time and the effort to achieve the goal. > There are possibly other ways to acheive what you want - you might > want to look at the sites framework, and consider the ways that you > could deploy multiple instances of your Django application, with a > common login interface that redirects to the appropriate site after > login. Well, this seems an ugly workaround, but should work in my case with little effort. Thanks a lot. Yours. --~--~-~--~~~---~--~~ 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: Random objects in view
Alessandro Ronchi napsal(a): > 2007/10/1, Tomas Kopecek <[EMAIL PROTECTED]>: > >> Now, I don't understand. What is the difference between these two cases? > > I don't know. If I put the random order before filter it works, if I > put it after filter it doesn't. > > Maybe it is worth a ticket in trac. -- Tomas Kopecek e-mail: permonik at mesias.brnonet.cz ICQ: 114483784 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
JOIN THE HOTTEST GROUP ON THE NET !OVER 10,000 JOIN WEEKLY! JOIN THE HOTTEST GROUP ON THE NET !!!! OVER 10,000 JOIN WEEKLY FREE SIGN UP!
JOIN THE HOTTEST GROUP ON THE NET !OVER 10,000 JOIN WEEKLY! JOIN THE HOTTEST GROUP ON THE NET OVER 10,000 JOIN WEEKLY FREE SIGN UP! http://www.blpurl.com/ar53 --~--~-~--~~~---~--~~ 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: oracle backend doesn't cache connections
Hi again, I've found out recently that there is Oracle Connection Manager which might just be what I need. I still need to test it though. Later, Stefan On Sep 19, 2:26 pm, Stefan Bethge <[EMAIL PROTECTED]> wrote: > Hello, > > i've recently found out that django does not cache connections to the > database but connects for every request and disconnects afterwards. I > don't know if this is fine for postgresql/database servers on the same > machine. Maybe using pg_pool helps a lot for postgres. However, in our > setup, we have anoracleserver on another machine in the network. > Connecting tooracletakes a while, sometimes up to some seconds, > which is completely unusable for a live website. Until now, I've not > heard of a similar solution like pg_pool fororacle(and sqlrelay is > not supported for now in django,http://code.djangoproject.com/ticket/409). > Are there plans to implement some kind of connection caching or may I > have not seen a connection pool daemon fororacle? > Or is it in some way possible to manage the connections in the django > application itself? > > Thanks for any suggestion, > Stefan Bethge --~--~-~--~~~---~--~~ 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: Using an existing database of astronomic images
On 10/2/07, Thejaswi Puthraya <[EMAIL PROTECTED]> wrote: > > [snipped] > > First and before the feeding of the database, after creating my > > database in the mysql prompt by inserting SQL code could django > > analyse my clean database and create class for each table? > > with the right field type? > > Try using the inspectdb command. Refer to > http://www.djangoproject.com/documentation/legacy_databases/#auto-generate-the-models > for more details. Fair warning in advance - while this approach should _mostly_ work, Django doesn't currently have any support for the MySQL Polygon types, so you may encounter some difficulties with that field. You may find it necessary to 'tweak' the models produced by inspectdb, and it will probably be necessary to define a custom Field type to represent the Polygon data. Queries on the polygon data will also be somewhat restricted. Since Django doesn't have support for a Polygon field, it doesn't contain any helpful query language specific to Polygons, either. However, if you're willing to drop to raw SQL occasionally, you should be able to use Django to manage the basic framework of the application you are describing. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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: error when trying to save unicode data
On 02-Oct-07, at 2:46 PM, Nis Jørgensen wrote: >> improper formatting - but am unable to find out where exactly the >> formatting is improper. If I put this function in the 'save' method >> of the model - I get the same error. > > This is an instance of the problem described here: > > http://code.djangoproject.com/ticket/5043 yes - looks like it. Anyway, until that is resolved I did a work around. In my model 'word' is unique. So the behaviour expected is, if 'word' is already in the table, do not insert. If it is not there, insert. I found that django is using get_or_create, and when it finds a record where 'word' equals the 'word' I am trying to insert *and* one or more of the other fields differ from the existing record, it tries to insert and bumps into duplicate key error. I now do get_or_create, *only* using the value of 'word' in the query - if created, then I do an update to set the other fields - otherwise I leave it alone. So my save method is like this now: def save(self): """dumping all the words in the word database""" super(Lesson_line,self).save() spkwords = self.sentencespk.split() for wrd in spkwords: lng=self.lesson.language wd = wrd.strip('!.,?') a,w = Word.objects.get_or_create(word=wd,language=lng) if w: a.written=False a.save() wrtwords = self.sentencewrt.split() for wrd in wrtwords: lng=self.lesson.language wd = wrd.strip('!.,?') a,w = Word.objects.get_or_create(word=wd,language=lng) if w: a.written=True a.save() -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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: Index
On 10/2/07, Atayal <[EMAIL PROTECTED]> wrote: > > Hello, > > I understand that I can have custom primary keys. Aside from primary > key, MySQL allows indexing on certain fields to facilitate searching. > Is it supported via Django's API? > Yes, it's in the very complete documentation: http://www.djangoproject.com/documentation/model-api/#db-index Regards, -- Ramiro Morales --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Index
Hello, I understand that I can have custom primary keys. Aside from primary key, MySQL allows indexing on certain fields to facilitate searching. Is it supported via Django's API? Timothy --~--~-~--~~~---~--~~ 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: using a existing database
Hi Greg What you'll need to is create a project (django-admin.py startproject I think). Then create an app inside that project (./manage.py startapp). Once you have the project and app directory structure edit the settings.py file to put it your database settings. After that's done you should be able to run: ./manage.py inspectdb > app_directory/models.py The models.py file will now reflect the structure of your database (i.e. it will have created all of the models for you). You will just need to go through it and edit any fields which are ForeignKeys, and any which are primary keys (add primary_key=True). You'll probably want to tidy up the reverse relation names too (I don't like having "_set" so I usually override this with related_name="whatever"). ManyToMany will be a bit more complicated... assuming that there are no extra fields in your many to many table then you could add "db_table=" to the ManyToMany field declaration and delete the Model that inspectdb will have created for you. Or you could leave it in your models.py and add two ForeignKey declarations to that model. Hope that helps, Ben On 02/10/2007, Greg_IAP <[EMAIL PROTECTED]> wrote: > > > HI, yesterday i send a message which asks of using an existing > database with Django. > > Thanks to the guy who has answered me, but i have to explain a little > bit more my problem. > > I 'm in charge of developping an astronomic images and metadata > database for scientists in mysql, composed by 9 tables with many > relations between them (one to one, many to many, one to many) and > among them there is image table which contains specific image field > implemented by mysql "the polygon class". > it permit to describe an astronomical image as a sky surface with 4 > points in spherical coordinates, i mean a bounding box around a part > of the sky.It permit, for example, to know how many astronomic images > of the database contains "M31 galaxy" object. > > Astronomic images are in the FITS format : there is headers containing > metadata and an other part for pixels data. > > Here is for example the image table of the database > > CREATE TABLE image ( > idimage INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, > Channel_idChannel INTEGER UNSIGNED NOT NULL, > CalibrationKit_idCalibrationKit INTEGER UNSIGNED NOT NULL, > Run_idRun INTEGER UNSIGNED NOT NULL, > Instrument_idInstrument INTEGER UNSIGNED NOT NULL, > SkyFootPrint MULTIPOLYGON NULL, > AstromAccuracy DOUBLE PRECISION NULL, > EQUINOX DOUBLE PRECISION NULL, > Name VARCHAR(20) NULL, > OBJECT VARCHAR(80) NULL, > DATE_OBS DATETIME NULL, > EXPTIME DOUBLE PRECISION NULL, > AIRMASS DOUBLE PRECISION NULL, > PHOT_C DOUBLE PRECISION NULL, > Quality1 DOUBLE PRECISION NULL, > QUALITY2 DOUBLE PRECISION NULL, > IngestionFlags BIT(8) NULL, > IngestionDate DATETIME NULL, > ProcessingFlags BIT(8) NULL, > LastProcessingDate BIT(8) NULL, > ProcessingTimeZone CHAR(3) NULL, > ReferenceChip INTEGER UNSIGNED NULL, > PathURL VARCHAR(255) NULL, > UTC_OBS TIME NULL, > PRIMARY KEY(idimage), > INDEX image_FKIndex1(Instrument_idInstrument), > INDEX image_FKIndex2(Run_idRun), > INDEX image_FKIndex3(CalibrationKit_idCalibrationKit), > INDEX image_FKIndex4(Channel_idChannel) > ) > TYPE=InnoDB; > > I create the database structure myself and the database is feeded > using python scripts by scanning the headers of the images (containing > metadata and others astronomical informations) and fill the database. > But i need django to admin this database and to permit some users to > consult it, display images, do queries .. > > So many questions are present in my mind when i discovered what could > be done with django... > > First and before the feeding of the database, after creating my > database in the mysql prompt by inserting SQL code could django > analyse my clean database and create class for each table? > with the right field type? > what happens if the field type does not exists in django ? (the case > of POLYGON TYPE) > is that mean that i can abandon or there is another way to go through > this... > > How could i make django understand the relation between tables of my > database, primary and foreign keys as shown in my image table? > > Coule it be done after the feed of the database or could i integrate > my python scripts into my django application structure? > > i hope my explanations and questions will be understood... > > Thanks > > Greg > Astrophysic Institute of Paris > > > > > -- Regards, Ben Ford [EMAIL PROTECTED] +6281317958862 --~--~-~--~~~---~--~~ 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: Using an existing database of astronomic images
[snipped] > First and before the feeding of the database, after creating my > database in the mysql prompt by inserting SQL code could django > analyse my clean database and create class for each table? > with the right field type? Try using the inspectdb command. Refer to http://www.djangoproject.com/documentation/legacy_databases/#auto-generate-the-models for more details. --~--~-~--~~~---~--~~ 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: Forms vs. Admin?
I'll give you a real life example: 1. Admin panel is used by fully priviledged administartor who is one of the application developers (app producents team). 2. The same Admin panel is used by Application Admin who is a person delegated by a customer (he is in fact a more priviledged application user). What is important here? Permissions! Application Admin belongs to a group that has access only to specified tables like dictionaries (this is great because I got if for free from Django) and application users. The latest was a bit harder because I had to write some custom templates and views overriding Admin defaults (for example: Application Admin can't manage Global Admin (from point 1.) users). HTH On 1 Paź, 17:40, cjl <[EMAIL PROTECTED]> wrote: > I'm a Django and web-development newcomer, working on a tutorial for > other newcomers like me: > > http://www.instantdjango.com > > Anyway, I am working on the second chapter of my tutorial, and want to > show people how the 'admin' interface works. I am using the 'newforms- > admin' branch for this (hoping it will me merged soon). > > I realized that I don't really know when is the "right" time to use > the admin interface, and when is to the "right" time to accept input > through forms instead of using the admin interface. > > I know that they serve different purposes, but I'm having trouble > articulating those differences. > > Can anyone give me their opinion, or point me in the right direction > to learn more? > > -cjlesh --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using an existing database of astronomic images
HI, yesterday i send a message which asks of using an existing database with Django. Thanks to the guy who has answered me, but i have to explain a little bit more my problem. I 'm in charge of developping an astronomic images and metadata database for scientists in mysql, composed by 9 tables with many relations between them (one to one, many to many, one to many) and among them there is image table which contains specific image field implemented by mysql "the polygon class". it permit to describe an astronomical image as a sky surface with 4 points in spherical coordinates, i mean a bounding box around a part of the sky.It permit, for example, to know how many astronomic images of the database contains "M31 galaxy" object. Astronomic images are in the FITS format : there is headers containing metadata and an other part for pixels data. Here is for example the image table of the database CREATE TABLE image ( idimage INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, Channel_idChannel INTEGER UNSIGNED NOT NULL, CalibrationKit_idCalibrationKit INTEGER UNSIGNED NOT NULL, Run_idRun INTEGER UNSIGNED NOT NULL, Instrument_idInstrument INTEGER UNSIGNED NOT NULL, SkyFootPrint MULTIPOLYGON NULL, AstromAccuracy DOUBLE PRECISION NULL, EQUINOX DOUBLE PRECISION NULL, Name VARCHAR(20) NULL, OBJECT VARCHAR(80) NULL, DATE_OBS DATETIME NULL, EXPTIME DOUBLE PRECISION NULL, AIRMASS DOUBLE PRECISION NULL, PHOT_C DOUBLE PRECISION NULL, Quality1 DOUBLE PRECISION NULL, QUALITY2 DOUBLE PRECISION NULL, IngestionFlags BIT(8) NULL, IngestionDate DATETIME NULL, ProcessingFlags BIT(8) NULL, LastProcessingDate BIT(8) NULL, ProcessingTimeZone CHAR(3) NULL, ReferenceChip INTEGER UNSIGNED NULL, PathURL VARCHAR(255) NULL, UTC_OBS TIME NULL, PRIMARY KEY(idimage), INDEX image_FKIndex1(Instrument_idInstrument), INDEX image_FKIndex2(Run_idRun), INDEX image_FKIndex3(CalibrationKit_idCalibrationKit), INDEX image_FKIndex4(Channel_idChannel) ) TYPE=InnoDB; I create the database structure myself and the database is feeded using python scripts by scanning the headers of the images (containing metadata and others astronomical informations) and fill the database. But i need django to admin this database and to permit some users to consult it, display images, do queries .. So many questions are present in my mind when i discovered what could be done with django... First and before the feeding of the database, after creating my database in the mysql prompt by inserting SQL code could django analyse my clean database and create class for each table? with the right field type? what happens if the field type does not exists in django ? (the case of POLYGON TYPE) is that mean that i can abandon or there is another way to go through this... How could i make django understand the relation between tables of my database, primary and foreign keys as shown in my image table? Coule it be done after the feed of the database or could i integrate my python scripts into my django application structure? i hope my explanations and questions will be understood... Thanks Greg Astrophysic Institute of Paris --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
using a existing database
HI, yesterday i send a message which asks of using an existing database with Django. Thanks to the guy who has answered me, but i have to explain a little bit more my problem. I 'm in charge of developping an astronomic images and metadata database for scientists in mysql, composed by 9 tables with many relations between them (one to one, many to many, one to many) and among them there is image table which contains specific image field implemented by mysql "the polygon class". it permit to describe an astronomical image as a sky surface with 4 points in spherical coordinates, i mean a bounding box around a part of the sky.It permit, for example, to know how many astronomic images of the database contains "M31 galaxy" object. Astronomic images are in the FITS format : there is headers containing metadata and an other part for pixels data. Here is for example the image table of the database CREATE TABLE image ( idimage INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, Channel_idChannel INTEGER UNSIGNED NOT NULL, CalibrationKit_idCalibrationKit INTEGER UNSIGNED NOT NULL, Run_idRun INTEGER UNSIGNED NOT NULL, Instrument_idInstrument INTEGER UNSIGNED NOT NULL, SkyFootPrint MULTIPOLYGON NULL, AstromAccuracy DOUBLE PRECISION NULL, EQUINOX DOUBLE PRECISION NULL, Name VARCHAR(20) NULL, OBJECT VARCHAR(80) NULL, DATE_OBS DATETIME NULL, EXPTIME DOUBLE PRECISION NULL, AIRMASS DOUBLE PRECISION NULL, PHOT_C DOUBLE PRECISION NULL, Quality1 DOUBLE PRECISION NULL, QUALITY2 DOUBLE PRECISION NULL, IngestionFlags BIT(8) NULL, IngestionDate DATETIME NULL, ProcessingFlags BIT(8) NULL, LastProcessingDate BIT(8) NULL, ProcessingTimeZone CHAR(3) NULL, ReferenceChip INTEGER UNSIGNED NULL, PathURL VARCHAR(255) NULL, UTC_OBS TIME NULL, PRIMARY KEY(idimage), INDEX image_FKIndex1(Instrument_idInstrument), INDEX image_FKIndex2(Run_idRun), INDEX image_FKIndex3(CalibrationKit_idCalibrationKit), INDEX image_FKIndex4(Channel_idChannel) ) TYPE=InnoDB; I create the database structure myself and the database is feeded using python scripts by scanning the headers of the images (containing metadata and others astronomical informations) and fill the database. But i need django to admin this database and to permit some users to consult it, display images, do queries .. So many questions are present in my mind when i discovered what could be done with django... First and before the feeding of the database, after creating my database in the mysql prompt by inserting SQL code could django analyse my clean database and create class for each table? with the right field type? what happens if the field type does not exists in django ? (the case of POLYGON TYPE) is that mean that i can abandon or there is another way to go through this... How could i make django understand the relation between tables of my database, primary and foreign keys as shown in my image table? Coule it be done after the feed of the database or could i integrate my python scripts into my django application structure? i hope my explanations and questions will be understood... Thanks Greg Astrophysic Institute of Paris --~--~-~--~~~---~--~~ 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: trying to make Django work with fastcgi
2007/10/2, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > > and a few of these: > [2007-10-02 02:03:32]: error: file has no execute permission: (/home/ > soulgt/public_html/dispatch.fcgi) > Esp. this error looks interesting IMO. Does your host perhaps offer some information on how they execute the FastCGI processes? Since you yourself can execute the script in the shell directly (without passing it explicitly to the python interpreter) it even looks like as if they're not using something like suExec but execute the script as a certain user :-/ --~--~-~--~~~---~--~~ 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: trying to make Django work with fastcgi
The errorlog shows a couple of these: [Tue Oct 2 05:43:50 2007] [error] [client 76.167.197.252] FastCGI: incomplete headers (0 bytes) received from server "/home/soulgt/ public_html/dispatch.fcgi" [Tue Oct 2 05:43:50 2007] [error] [client 76.167.197.252] FastCGI: comm with (dynamic) server "/home/soulgt/public_html/dispatch.fcgi" aborted: (first read) idle timeout (240 sec) many many many of these: [Tue Oct 2 05:44:11 2007] [warn] FastCGI: (dynamic) server "/home/ soulgt/public_html/dispatch.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds and a few of these: [2007-10-02 02:03:32]: error: file has no execute permission: (/home/ soulgt/public_html/dispatch.fcgi) I hope this helps, as I'm completely lost. On Oct 2, 2:39 am, "Horst Gutmann" <[EMAIL PROTECTED]> wrote: > Have you already looked at the error.log your webhost should normally > provide? The behaviour you indicated normally means, that the process > died or gave output back, that is not really close to an HTTP response > as expected by the webserver. > > 2007/10/2, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > > > > Hi, > > > I'm new at this - learning as I go, but I can't seem to get Django > > running with fastcgi. > > > A Small Orange, my webhost, doesn't have mod_python support, so I've > > been trying to follow a number of different recommendations online to > > try and get my site up and running. > > > I've installed flup, downloaded the django trunk, created a project, > > and placed a 'dispatch.fcgi' file in the web root. > > > If I point my browser to the dispatch.fcgi file, it spins and spins > > forever, not even bothering with the kindness of timing out. > > > If I run the dispatch.fcgi file in the shell, I get the following > > error: > > ># ./dispatch.fcgi > > >WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI! > > >WSGIServer: missing FastCGI param SERVER_NAME required by WSGI! > > >WSGIServer: missing FastCGI param SERVER_PORT required by WSGI! > > >WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI! > > >Status: 301 MOVED PERMANENTLY > > >content-type: text/html; charset=utf-8 > > >location:http://localhost:80/ > > > my .htaccess file: > > > > AddHandler fastcgi-script .fcgi > > RewriteEngine On > > RewriteBase / > > RewriteRule ^(media/.*)$ - [L] > > RewriteRule ^(admin_media/.*)$ - [L] > > RewriteRule ^(dispatch\.fcgi/.*)$ - [L] > > RewriteRule ^(.*)$ dispatch.fcgi/$1 [L] > > > > > my dispatch.fcgi file: > > > > #!/usr/bin/env python > > import sys, os > > > # Add a custom Python path. > > sys.path.insert(0, "/home/soulgt/projects/django/trunk") > > sys.path.insert(0, "/home/soulgt/projects/flup/trunk/flup") > > sys.path.insert(0, "/home/soulgt/projects") > > > # Set the DJANGO_SETTINGS_MODULE environment variable. > > os.environ['DJANGO_SETTINGS_MODULE'] = "pythonlearning.settings" > > > from django.core.servers.fastcgi import runfastcgi > > runfastcgi(method="threaded", daemonize="false") > > > > > I have no idea what's going on and really want to get this off the > > ground. Any help would be greatly appreciate - thanks in advance. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
change dic text based on select box option
Hello, I'm using 0.96 and now I have working form_for_model with custom callback function that creates select drop down box when form is rendered. Great, but I would like to have a under the select box with different text for each selected option (like a help text). How should I do that? thanks Robert Smol --~--~-~--~~~---~--~~ 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: trying to make Django work with fastcgi
Have you already looked at the error.log your webhost should normally provide? The behaviour you indicated normally means, that the process died or gave output back, that is not really close to an HTTP response as expected by the webserver. 2007/10/2, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > Hi, > > I'm new at this - learning as I go, but I can't seem to get Django > running with fastcgi. > > A Small Orange, my webhost, doesn't have mod_python support, so I've > been trying to follow a number of different recommendations online to > try and get my site up and running. > > I've installed flup, downloaded the django trunk, created a project, > and placed a 'dispatch.fcgi' file in the web root. > > If I point my browser to the dispatch.fcgi file, it spins and spins > forever, not even bothering with the kindness of timing out. > > If I run the dispatch.fcgi file in the shell, I get the following > error: > ># ./dispatch.fcgi > >WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI! > >WSGIServer: missing FastCGI param SERVER_NAME required by WSGI! > >WSGIServer: missing FastCGI param SERVER_PORT required by WSGI! > >WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI! > >Status: 301 MOVED PERMANENTLY > >content-type: text/html; charset=utf-8 > >location: http://localhost:80/ > > my .htaccess file: > > AddHandler fastcgi-script .fcgi > RewriteEngine On > RewriteBase / > RewriteRule ^(media/.*)$ - [L] > RewriteRule ^(admin_media/.*)$ - [L] > RewriteRule ^(dispatch\.fcgi/.*)$ - [L] > RewriteRule ^(.*)$ dispatch.fcgi/$1 [L] > > > my dispatch.fcgi file: > > #!/usr/bin/env python > import sys, os > > # Add a custom Python path. > sys.path.insert(0, "/home/soulgt/projects/django/trunk") > sys.path.insert(0, "/home/soulgt/projects/flup/trunk/flup") > sys.path.insert(0, "/home/soulgt/projects") > > > # Set the DJANGO_SETTINGS_MODULE environment variable. > os.environ['DJANGO_SETTINGS_MODULE'] = "pythonlearning.settings" > > from django.core.servers.fastcgi import runfastcgi > runfastcgi(method="threaded", daemonize="false") > > > I have no idea what's going on and really want to get this off the > ground. Any help would be greatly appreciate - thanks in advance. > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
trying to make Django work with fastcgi
Hi, I'm new at this - learning as I go, but I can't seem to get Django running with fastcgi. A Small Orange, my webhost, doesn't have mod_python support, so I've been trying to follow a number of different recommendations online to try and get my site up and running. I've installed flup, downloaded the django trunk, created a project, and placed a 'dispatch.fcgi' file in the web root. If I point my browser to the dispatch.fcgi file, it spins and spins forever, not even bothering with the kindness of timing out. If I run the dispatch.fcgi file in the shell, I get the following error: ># ./dispatch.fcgi >WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI! >WSGIServer: missing FastCGI param SERVER_NAME required by WSGI! >WSGIServer: missing FastCGI param SERVER_PORT required by WSGI! >WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI! >Status: 301 MOVED PERMANENTLY >content-type: text/html; charset=utf-8 >location: http://localhost:80/ my .htaccess file: AddHandler fastcgi-script .fcgi RewriteEngine On RewriteBase / RewriteRule ^(media/.*)$ - [L] RewriteRule ^(admin_media/.*)$ - [L] RewriteRule ^(dispatch\.fcgi/.*)$ - [L] RewriteRule ^(.*)$ dispatch.fcgi/$1 [L] my dispatch.fcgi file: #!/usr/bin/env python import sys, os # Add a custom Python path. sys.path.insert(0, "/home/soulgt/projects/django/trunk") sys.path.insert(0, "/home/soulgt/projects/flup/trunk/flup") sys.path.insert(0, "/home/soulgt/projects") # Set the DJANGO_SETTINGS_MODULE environment variable. os.environ['DJANGO_SETTINGS_MODULE'] = "pythonlearning.settings" from django.core.servers.fastcgi import runfastcgi runfastcgi(method="threaded", daemonize="false") I have no idea what's going on and really want to get this off the ground. Any help would be greatly appreciate - thanks in advance. --~--~-~--~~~---~--~~ 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: error when trying to save unicode data
Kenneth Gonsalves skrev: > hi, > > I have a view that takes a sentence in unicode from a database, > splits it into words and dumps those words in the Word table. The > 'word' in word table is unique, and it is expected that duplicates be > rejected, so I put 'save()' within a try-except statement. If my view > does one record at a time - it works perfectly. If I try to loop > through all the records, I get a ProgrammingError complaining of > improper formatting - but am unable to find out where exactly the > formatting is improper. If I put this function in the 'save' method > of the model - I get the same error. This is an instance of the problem described here: http://code.djangoproject.com/ticket/5043 You may be able to get around this by using manual transaction handling. I see now that someone requested that I start a thread on django-dev about the issue ... will do so when time permits. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Free Magazines
One Year Free Magazine Subscription, please visit http://www.afmagazines.blogspot.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
help with the project
guys, please help me on my youtube project. nobody is looking at my video and I spent so much time putting it together. it's not perfect yet, but in some ways it's better than many amateurish videos out there. thanks so much to you all! http://www.youtube.com/watch?v=nhQJHJGJE2Y --~--~-~--~~~---~--~~ 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: Handling DB connect error.
On Oct 2, 1:47 am, handsome greg <[EMAIL PROTECTED]> wrote: > Ok here's another quick question. How can I catch a DB connect that > fails and perform some kind of action (display a "sorry... site's > down" page, etc.) if the DB isn't available? I can't seem to figure it > out. Thanks! Use the tryexcept statements. try: except OperationalError: return HttpResponse("Sorry Site is down") # you could also use render_to_response Cheers Thejaswi Puthraya --~--~-~--~~~---~--~~ 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: default locations for css and js files
On Oct 2, 6:37 am, staff-gmail <[EMAIL PROTECTED]> wrote: > I can't figure out where to put my css and js files. I did not want to > hard code the media path in my settings file so it is the default ''. > So if I put a css file in my template - where does Django look for the > relative path ? Any help appreciated. The default location for serving static files (like css and js) is specified by the media setting in the settings.py file. But most users maintain separate directories for these and then serve them as static files by making changes in the urls.py file. Check out http://www.djangoproject.com/documentation/static_files/ for more details. Cheers Thejaswi Puthraya --~--~-~--~~~---~--~~ 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 Email Failure
On Oct 2, 8:04 am, kidormb <[EMAIL PROTECTED]> wrote: > Thanks for the reply, but > > SMTP AUTH extension not supported by server. > > is the exact error message that I receive, which I think is > a python error. > Have never come across this problem!!! Which version of Django do you use? Django 0.96 or from the subversion repository? Can you also give us some information about the OS you use...sometimes Windows XP firewall blocks port 25. Cheers Thejaswi Puthraya --~--~-~--~~~---~--~~ 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: Random objects in view
2007/10/1, Tomas Kopecek <[EMAIL PROTECTED]>: > Now, I don't understand. What is the difference between these two cases? I don't know. If I put the random order before filter it works, if I put it after filter it doesn't. -- Alessandro Ronchi Skype: aronchi http://www.alessandroronchi.net - Il mio sito personale http://www.soasi.com - Sviluppo Software e Sistemi Open Source --~--~-~--~~~---~--~~ 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: RSS feed reader in Python
stanleypark skrev: > We just finiched a really cool RSS feed news reader. I need people > comments on it. > here is the link of the web site. > I see no link at this point in your post. Anyway, who are "we"? > If you wish to know more about RSS feeds here is a group link that I > just started. > http://groups.google.com/group/adsense-and-rss-feeds/web/netsplorer-com?hl=en > all the best to everyone > If you want to attract people, you should make this readable to non-members. I am not going to sign up for something just to see if it is interesting. Nis --~--~-~--~~~---~--~~ 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: Help accessing user.
Nevermind - I got it. Thanks. On 10/1/07, Jason C. Leach <[EMAIL PROTECTED]> wrote: > Hi: > > I have sessions installed - and working. Just don't know how to get at them > from > in a template? {{ request.session.user }}? Noting seems to work. > > On 10/1/07, Richard Dahl <[EMAIL PROTECTED]> wrote: > > > > Django works just like any other web app. It is stateless. There is > > no way of passing the object from one view to another. You must > > enable sessions in order to store the user associated with any given > > login. Refer to the django documentation for sessions. > > -richard > > > > On Oct 1, 2007, at 9:46 PM, Jason wrote: > > > > > > > > Hi: > > > > > > So I pass the built in login my own template for authentication - and > > > it works. I get a user object back and life is good. > > > > > > However I can't access the user outside of this page/template. I don't > > > seem to be able to get a handle on the Context's so - I'm stuck. > > > > > > Can anyone help. I'd just like to be able to check - in other > > > templates if the user.is_authenticated, etc. How can I pass this > > > object arround or dig it up when I need to? > > > > > > Thanks in advance, > > > J. > > > > > > > > > > > > > > > > > > > > > > > -- > > Jason C. Leach > PGP Key: 0x62DDDF75 > Keyserver: gpg.mit.edu > -- Jason C. Leach PGP Key: 0x62DDDF75 Keyserver: gpg.mit.edu --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---