Re: openid
thank you. On Sun, Jun 14, 2009 at 9:10 PM, Rama Vadakattu wrote: > > Recently i worked with openid i have used the below package for > implementing it. > http://code.google.com/p/django-openid-consumer/ > It is basically a fork of simonwillison django-openid implementing > new openid features. > > I did not face any problems and successfully implemented openid on my > site. > > --rama > > > > > > > > > > > On Jun 14, 9:42 am, Vance Dubberly wrote: >> So after looking around a bit it looks like simonwilsons openid >> package is pretty where it's at for openid in django. >> >> Question is: is the package that hasn't been touched 2 years >> django_openidconsumer the right one to use or has django_openid come >> along far enough to implement/test. I note that there was an email >> further back that said django_openidconsumer doesn't work unless you >> use the openid2.0 branch so I'm a bit lost. >> >> Vance >> >> -- >> To pretend, I actually do the thing: I have therefore only pretended to >> pretend. >> - Jacques Derrida > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
openid
So after looking around a bit it looks like simonwilsons openid package is pretty where it's at for openid in django. Question is: is the package that hasn't been touched 2 years django_openidconsumer the right one to use or has django_openid come along far enough to implement/test. I note that there was an email further back that said django_openidconsumer doesn't work unless you use the openid2.0 branch so I'm a bit lost. Vance -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: application profiling
Thanks Clement. Much appreciated. 2009/5/5 Clément Nodet : > > Hi there, > > Had that itch a few days ago, found a few nice snippets for in-browser > profiling, > using cProfile : > http://www.djangosnippets.org/snippets/727/ > or using hotshots : > http://www.djangosnippets.org/snippets/605/ > > Also : > http://www.rkblog.rk.edu.pl/w/p/django-profiling-hotshot-and-kcachegrind/ > > Regards, > -- > Clément > > On Tue, May 5, 2009 at 1:28 PM, Vance Dubberly wrote: >> >> Having a hard time trying to figure out how to profile a django >> application. Doesn't seem to be anything built into django itself that >> knows how to report on time spent in methods or sql queries or any >> such thing. Please tell me I'm delusional. Pretty Please? >> >> -- >> To pretend, I actually do the thing: I have therefore only pretended to >> pretend. >> - Jacques Derrida >> >> > >> > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
application profiling
Having a hard time trying to figure out how to profile a django application. Doesn't seem to be anything built into django itself that knows how to report on time spent in methods or sql queries or any such thing. Please tell me I'm delusional. Pretty Please? -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: database fail over
Just saw this: http://softwaremaniacs.org/soft/mysql_replicated/en/description/ anybody try it? Looks pre- queryset refactor, don't know if that matters. Vance On Thu, Oct 16, 2008 at 11:17 AM, Vance Dubberly <[EMAIL PROTECTED]> wrote: > Ok just got a huge project that is going to require alot of big iron. > Prolly 4 webservers and at least 2 if not 4 database server and a > memecache server. > > Load balancing across webservers isn't a big deal. But 1 very big > weakness I'm seeing in django as it stands is the ability to deal with > multiple database servers. At the minimum I'm going to have 1 master > and 1 slave mysql server and if the master goes down I'll need to fail > over to the slave. I don't see anyway to manage this in django, am I > missing something? I saw a post on using sqlalchemy to pool > connections perhaps I should be looking there for failover too? > > Vance > > > -- > To pretend, I actually do the thing: I have therefore only pretended to > pretend. > - Jacques Derrida > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
database fail over
Ok just got a huge project that is going to require alot of big iron. Prolly 4 webservers and at least 2 if not 4 database server and a memecache server. Load balancing across webservers isn't a big deal. But 1 very big weakness I'm seeing in django as it stands is the ability to deal with multiple database servers. At the minimum I'm going to have 1 master and 1 slave mysql server and if the master goes down I'll need to fail over to the slave. I don't see anyway to manage this in django, am I missing something? I saw a post on using sqlalchemy to pool connections perhaps I should be looking there for failover too? Vance -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: ModelMultipleChoiceField and initial values
Wow this is really screwing me royal. Doesn't work with any form of select, best I can tell initial doesn't work with ChoiceFields at all. I've tried going into the source and logging out the value param to the widget and it is always just []. Am I on crack, can somebody verify, so I can file a bug report if I'm not. ( by default these days I just assume I'm an idiot. ) Vance On Sat, Sep 20, 2008 at 8:24 PM, Vance Dubberly <[EMAIL PROTECTED]> wrote: > Ok hopefully this will be the last stupid question I ask for a long > time... been struggling with this for several hours: > > I've got a ModelMultipleChoiceField in a form as such > > class ApplicationCriteraForm(forms.Form): > pay_hourly = forms.CharField() > pay_yearly = forms.CharField() > locations = > forms.ModelMultipleChoiceField(Location.objects.all(),widget=forms.CheckboxSelectMultiple()) > transportation_method = > forms.ModelMultipleChoiceField(TransportMethod.objects.all(), > widget=forms.CheckboxSelectMultiple()) > driving_violations = forms.ChoiceField(BOOLEAN_CHOICE, > widget=forms.CheckboxSelectMultiple()) > > Now when I use this form I may have preset data for it, as in the form > is being used to update info instead of create it so I do something > like this: > > criteria_form = ApplicationCriteraForm(initial={ >'pay_hourly' : application.pay_hourly, >'pay_yearly' : application.pay_yearly, >'locations ' : application.locations, >'transportation_method' : application.transportation_method, >'driving_violations' : application.driving_violations > }) > > None of the multiple choice fields pre-popluate with data. I've tried > a number of different methods as it looks like what the various > SelectMultiple widgets expect is a list of the id's but none of the > following work: > > > 'locations ' : application.locations, > 'locations ' : application.locations.all(), > 'locations ' : [ int(location.id) for location in application.locations.all()] > 'locations ' : application.locations.values() > > Also it doesn't matter whether it's the CheckboxSelectMultiple or another. > > Not real sure where what else to try... digging through django source > cause I'm sure I'm doing something amazingly stupid. > > Vance > > > > > > -- > To pretend, I actually do the thing: I have therefore only pretended to > pretend. > - Jacques Derrida > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ModelMultipleChoiceField and initial values
Ok hopefully this will be the last stupid question I ask for a long time... been struggling with this for several hours: I've got a ModelMultipleChoiceField in a form as such class ApplicationCriteraForm(forms.Form): pay_hourly = forms.CharField() pay_yearly = forms.CharField() locations = forms.ModelMultipleChoiceField(Location.objects.all(),widget=forms.CheckboxSelectMultiple()) transportation_method = forms.ModelMultipleChoiceField(TransportMethod.objects.all(), widget=forms.CheckboxSelectMultiple()) driving_violations = forms.ChoiceField(BOOLEAN_CHOICE, widget=forms.CheckboxSelectMultiple()) Now when I use this form I may have preset data for it, as in the form is being used to update info instead of create it so I do something like this: criteria_form = ApplicationCriteraForm(initial={ 'pay_hourly' : application.pay_hourly, 'pay_yearly' : application.pay_yearly, 'locations ' : application.locations, 'transportation_method' : application.transportation_method, 'driving_violations' : application.driving_violations }) None of the multiple choice fields pre-popluate with data. I've tried a number of different methods as it looks like what the various SelectMultiple widgets expect is a list of the id's but none of the following work: 'locations ' : application.locations, 'locations ' : application.locations.all(), 'locations ' : [ int(location.id) for location in application.locations.all()] 'locations ' : application.locations.values() Also it doesn't matter whether it's the CheckboxSelectMultiple or another. Not real sure where what else to try... digging through django source cause I'm sure I'm doing something amazingly stupid. Vance -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: ModelForm vs CheckboxSelectMultiple
Martin, Thank you, that let me delete my extra bunch of code and made me feel silly for even going there. ;) Vance On Sat, Sep 20, 2008 at 4:42 PM, Martin Ostrovsky <[EMAIL PROTECTED]> wrote: > > When creating your widget, you need to set empty_label = None, this > will supress the '' choice. > > Also, I think you want to use forms.ModelMultipleChoiceField in > conjunction with the widget forms.CheckboxSelectMultiple. > > On Sep 20, 6:26 pm, "Vance Dubberly" <[EMAIL PROTECTED]> wrote: >> End result is I duplicated the code form the CheckboxSelectMultiple >> and made my own. Only difference is that I test for for an option >> value and don't append to the form if there isn't one >> >> if option_value: >>... >> output.append(u'%s %s' % (label_for, >> rendered_cb, option_label)) >> >> Vance >> >> >> >> On Sat, Sep 20, 2008 at 2:04 PM, Vance Dubberly <[EMAIL PROTECTED]> wrote: >> > Unfortunately no luck >> >> > locations = forms.ModelChoiceField(Location.objects.all(), >> > widget=forms.CheckboxSelectMultiple(), initial='') >> > locations = forms.ModelChoiceField(Location.objects.all(), >> > widget=forms.CheckboxSelectMultiple(), initial=None) >> >> > no impact. >> >> > Vance >> >> > On Fri, Sep 19, 2008 at 9:03 PM, Joshua Jonah <[EMAIL PROTECTED]> wrote: >> >> >> ... use the 'initial' attribute of the form field. >> >> >> Vance Dubberly wrote: >> >>> So with a form that does this: >> >>> forms.ModelChoiceField(TransportMethod.objects.all(), >> >>> widget=forms.CheckboxSelectMultiple()) >> >> >>> The first check box has no value and is labeled '-' is there >> >>> an option to have that not exist. I don't don't see a passable param >> >>> which would turn it off in either ModelChoiceField or >> >>> CheckboxSelectMultiple. Am I blind? >> >> >>> Vance >> >> > -- >> > To pretend, I actually do the thing: I have therefore only pretended to >> > pretend. >> > - Jacques Derrida >> >> -- >> To pretend, I actually do the thing: I have therefore only pretended to >> pretend. >> - Jacques Derrida > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: ModelForm vs CheckboxSelectMultiple
End result is I duplicated the code form the CheckboxSelectMultiple and made my own. Only difference is that I test for for an option value and don't append to the form if there isn't one if option_value: ... output.append(u'%s %s' % (label_for, rendered_cb, option_label)) Vance On Sat, Sep 20, 2008 at 2:04 PM, Vance Dubberly <[EMAIL PROTECTED]> wrote: > Unfortunately no luck > > locations = forms.ModelChoiceField(Location.objects.all(), > widget=forms.CheckboxSelectMultiple(), initial='') > locations = forms.ModelChoiceField(Location.objects.all(), > widget=forms.CheckboxSelectMultiple(), initial=None) > > no impact. > > Vance > > > > On Fri, Sep 19, 2008 at 9:03 PM, Joshua Jonah <[EMAIL PROTECTED]> wrote: >> >> ... use the 'initial' attribute of the form field. >> >> Vance Dubberly wrote: >>> So with a form that does this: >>> forms.ModelChoiceField(TransportMethod.objects.all(), >>> widget=forms.CheckboxSelectMultiple()) >>> >>> The first check box has no value and is labeled '-' is there >>> an option to have that not exist. I don't don't see a passable param >>> which would turn it off in either ModelChoiceField or >>> CheckboxSelectMultiple. Am I blind? >>> >>> Vance >>> >>> >> >> >> >> >> > > > > -- > To pretend, I actually do the thing: I have therefore only pretended to > pretend. > - Jacques Derrida > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: ModelForm vs CheckboxSelectMultiple
Unfortunately no luck locations = forms.ModelChoiceField(Location.objects.all(), widget=forms.CheckboxSelectMultiple(), initial='') locations = forms.ModelChoiceField(Location.objects.all(), widget=forms.CheckboxSelectMultiple(), initial=None) no impact. Vance On Fri, Sep 19, 2008 at 9:03 PM, Joshua Jonah <[EMAIL PROTECTED]> wrote: > > ... use the 'initial' attribute of the form field. > > Vance Dubberly wrote: >> So with a form that does this: >> forms.ModelChoiceField(TransportMethod.objects.all(), >> widget=forms.CheckboxSelectMultiple()) >> >> The first check box has no value and is labeled '-' is there >> an option to have that not exist. I don't don't see a passable param >> which would turn it off in either ModelChoiceField or >> CheckboxSelectMultiple. Am I blind? >> >> Vance >> >> > > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ModelForm vs CheckboxSelectMultiple
So with a form that does this: forms.ModelChoiceField(TransportMethod.objects.all(), widget=forms.CheckboxSelectMultiple()) The first check box has no value and is labeled '-' is there an option to have that not exist. I don't don't see a passable param which would turn it off in either ModelChoiceField or CheckboxSelectMultiple. Am I blind? Vance -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: dumb question model-dictionary
Bruno, thanks that 2 mins of yours was exactly what I was looking for. I feel much worse about myself and much better about the world in general, which is the way things should be, thanks! Does seem odd that there is no such method in Model already but that it's in ModelForm instead. Oh well easy enough to add when I need it, and after the last round merges (1.0a1 and later) I just assume I'm wrong. The core group surpassed my expertise. Vance On Tue, Sep 2, 2008 at 1:18 AM, James Bennett <[EMAIL PROTECTED]> wrote: > > On Tue, Sep 2, 2008 at 2:30 AM, bruno desthuilliers > <[EMAIL PROTECTED]> wrote: >> More seriously, it took me 2 minutes playing with a model object in >> the interactive shell to come up with what seems a working solution: > > Yeah, which is why I pointed out the easy wrapper function for it in > my email above. > > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: dumb question model-dictionary
Wow. I guess it wasn't such a stupid question. foo._meta.fields .. each field will give me att names but not values. All the methods on the fields that look like they return values only return the values you give them, WTF? Foo.objects.filter(pk=1).values()[0] requires 2 calls to the database since the object I'm after has methods I actually want to use. I have to get do foo = Foo.objects.filter(pk=1) foo_data = Foo.objects.filter(pk=1).values()[0] Just seems stupid to make two calls to get data I already have. Hmm perhaps I should do foo = Foo.objects.filter(pk=1) foo_form = FooForm(instance=foo) data = foo_form.cleaned_data ok I figured something, it's stupid and couldn't possibly be the "right" way to do it but it does what I need. foo_data = Foo.objects.filter(pk=1).values()[0] foo = Foo(**foo_data) Vance On Mon, Sep 1, 2008 at 12:12 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Mon, 2008-09-01 at 15:10 -0400, Jay Parlar wrote: >> On Mon, Sep 1, 2008 at 2:48 PM, Vance Dubberly <[EMAIL PROTECTED]> wrote: >> > >> > So I'm finding there are multiple places where I'm needing to iterate >> > over the properties of a Model and I'm absolutely certain it's got to >> > be insanely easy to get a dictionary from a model but for the life of >> > me I can't figure it out, and I can't find any documentation on the >> > matter. >> > >> > basically I want to be able to do this: >> > >> > class Foo(models.Model): >> >bar = model.CharField(max_length=20) >> >barfoo = model.ForeignKey(Bar) >> > >> > foo = Foo.objects.get(pk=1) >> > foo.get_dictionary() >> > {'barfoo': 1, 'bar': 'bar value'} >> >> There might be a better way, but try taking a look at >> foo._meta._fields It does't give you exactly what you need, but the >> pieces are there. > > Even simpler, Foo.objects.filter(pk=1).values()[0]. > > Regards, > Malcolm > > > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
dumb question model-dictionary
So I'm finding there are multiple places where I'm needing to iterate over the properties of a Model and I'm absolutely certain it's got to be insanely easy to get a dictionary from a model but for the life of me I can't figure it out, and I can't find any documentation on the matter. basically I want to be able to do this: class Foo(models.Model): bar = model.CharField(max_length=20) barfoo = model.ForeignKey(Bar) foo = Foo.objects.get(pk=1) foo.get_dictionary() {'barfoo': 1, 'bar': 'bar value'} or something similar... I'm sorry I know this is probably blatantly obvious and well documented. I'm just retarded at the moment. -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
dictionary from object
So I want to do something I'd think would be extremely common and simple. user = User.objects.get(pk=data['id']) I want a dictionary of the model attributes/values from user. user_dict = { 'first_name' : 'foo', .. Am I asking to much or reading to little? -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: select only some feilds
Thank you ! I'm obviously gone blind. w On Tue, Jun 3, 2008 at 1:29 PM, josesoa <[EMAIL PROTECTED]> wrote: > > http://www.djangoproject.com/documentation/db-api/#values-fields > > On Jun 3, 4:08 pm, "Vance Dubberly" <[EMAIL PROTECTED]> wrote: >> So I think I heard somewhere out there in django land that with the >> merge of QuerySet refactor we gained the ability specify the fields we >> want returned in a query. Unfortunately I can't find any info on this, >> am I being delusional or blind? Got any pointers? >> >> Vance >> >> -- >> To pretend, I actually do the thing: I have therefore only pretended to >> pretend. >> - Jacques Derrida > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
select only some feilds
So I think I heard somewhere out there in django land that with the merge of QuerySet refactor we gained the ability specify the fields we want returned in a query. Unfortunately I can't find any info on this, am I being delusional or blind? Got any pointers? Vance -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: OneToOne Relationships
Thanks that makes more sense than the current implementation. I hope that using ForeignKey for the current relationships now will allow me to update the with unique=True later ( of course realizing that I'll have to play with how I access the ForeignKey). Vance On Feb 5, 2008 6:10 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Tue, 2008-02-05 at 17:51 -0800, Vance Dubberly wrote: > > The Documentation has said for as long as I can remember (a year+) > > that the semantics of a the OneToOne relationship is going to change > > soon. Any clue as to when this is going to change > > Soon. > > > and/or what it's > > going to look like? > > It will look behave like ForeignKey(unique=True), except that a reverse > lookup will return the object on the reverse of the relation, not a list > containing one object (reverse lookups on ForeignKeys always return a > list, since it's one-to-many and we shouldn't change the return type > just because of the unique flag there). > > Also, the restriction that OneToOneFields are implicitly primary keys > will be removed, since there are cases where multiple one-to-one > relations in a model are required. > > Malcolm > > -- > I don't have a solution, but I admire your problem. > http://www.pointy-stick.com/blog/ > > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: Extending Django's admin application
Using the FileField or ImageField will get your files uploaded. Image field is also nice enough to check that it's an image. http://www.djangoproject.com/documentation/model-api/#filefield http://www.djangoproject.com/documentation/model-api/#imagefield Image Field also requires PIL which is what you'll use in-place of RMagick http://www.pythonware.com/products/pil/ peace. Vance On Feb 5, 2008 5:47 PM, Brandon Taylor <[EMAIL PROTECTED]> wrote: > > Hello everyone, > > I'm a complete n00b with Django, but would like to take advantage of > the built-in admin module for small freelance websites. Out-of-the- > box, it's pretty freakin' awesome. But, of course, I'd like to extend > it. > > In Rails, there are plugins, plugins and more plugins. One of those is > attachment_fu, which when coupled with ImageMagik, can auto-thumbnail, > crop, scale, etc. > > Does Django have similar capabilities in the hundreds of Python > modules that are out there, and if so, can someone please point me in > the right direction on getting some code samples? > > I have the Definitive Guide to Django book from Apress, and am > experienced developer...just not with Python :) I'm very anxious to > learn and get started really building something with this great > framework. > > Many TIA for your advice, > Brandon Taylor > > www.btaylordesign.com > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
OneToOne Relationships
The Documentation has said for as long as I can remember (a year+) that the semantics of a the OneToOne relationship is going to change soon. Any clue as to when this is going to change and/or what it's going to look like? -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: Best Practice for Ajax and Django. Please share your thoughts.
Interesting and organized but it seems like a lot of work. Do you write two versions of every method? For instance def ajax_latest_news(request): ... latest_news = ... json = simplejson.dumps(latest_news) return HttpResponse(json, mimetype='application/json') and also def latest_news(request): ... latest_news = ... return render_to_response.. My personal way to deal with this has to be make all ajax requests POST's and add a wants field to them, then to do something like this: def latest_news(request): latest_news = if request.method == 'POST' and request.POST.has_key('wants'): if request.POST.has_key('wants') == 'json' json = simplejson.dumps(latest_news) return HttpResponse(json, mimetype='application/json') else: normal template stuff It's kinda gludgy but I've not had time work it out yet but it seems the prime way to do this would be to add a custom header to the request that read 'accept-content-type='text/javascript' and then work off that but I'm of course not happy with my solution so am interested in seeing what other people feed back... Vance -- On Jan 29, 2008 2:37 PM, Julien <[EMAIL PROTECTED]> wrote: > > Hi all, > > I've started using Ajax in my Django sites. I'm using Jquery (and I > love it!), but here it doesn't really matter which JS library you use, > I'd just like to know your opinions on the best way to go to handle it > on the server side. > > I'm gonna tell you how I do it, then I'd really appreciate if you > could share the way you do it. There are probably many good > approaches, but maybe we could find some common ground that could for > example be put online on the wiki. > > What I do is mostly cosmetic to keep things tidy: > > 1) I put all my ajax views in a separate file 'ajax-views.py'. By > "ajax views" I mean all views that are called by a javascript, as > opposed to the traditional views which are called through the > browser's address bar. > The structure then looks like this: > myapp >|_ ajax-views.py >|_ models.py >|_ urls.py >|_ views.py > > 2) In the URLConf I also separate traditional views from ajax views: > > from django.conf.urls.defaults import * > > # Traditional views > urlpatterns = patterns('myapp.views', >url(r'^$', 'home'), >url(r'^news/$', 'list_news'), > ) > > # AJAX views > urlpatterns += patterns('myapp.ajax-views', # Don't forget the > '+=' sign here. >url(r'^ajax/news/latest/$', 'ajax_latest_news'), >url(r'^ajax/news/add/$', 'ajax_add_news'), > ) > > Note that I also add the prefix "ajax/" in the URLs for the ajax > views. > > 3) The ajax views can look like this: > > from django.utils import simplejson > > def ajax_latest_news(request): > ... > latest_news = ... > json = simplejson.dumps(latest_news) > return HttpResponse(json, mimetype='application/json') > > def ajax_add_news(request): > ... > results = {'success':True} > json = simplejson.dumps(results) > return HttpResponse(json, mimetype='application/json') > > Please let me know your thoughts ;) > Cheers! > > Julien > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 validation problem
If I get what you are asking correctly, you are trying to pre-populate some fields in a form without printing out the validation errors that occur from not having all the fields populated? If so this should help: # create object instance with pre-populated data obj_instance = Object(prepoulate_field_key="value") #create from with obj_instance obj_form = ObjectForm(instance=obj_instance) It's not obvious or in the docs, but it's a nice mechanism. Hope that helps. vance On Jan 28, 2008 9:47 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hello, > > I have a view with searches for a given record (using a text field). > If the object does not exist show a error and a link: Create > > On the create view if GET.get('val') then I put that data in the form. > I want this just to make it simple for a user to enter a new object if > it does not exist. > > My problem if that django validates the form with the data I added, so > I get several fields with have the "not provided value" (since I did > not pass that data) > > How can I make this work? Is there some flag to tell django not > validate the form when I'm first creating it? > > Regards, > > Luis > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 and updating
ah so the idea is to us a url something like this for form /module/item_id/edit and save to /module/item_id/save feels queer but i'll try and get used to it. thanks i guess i couldn't get my head outa the rut.. Vance On Jan 25, 2008 7:07 PM, Brian Rosner <[EMAIL PROTECTED]> wrote: > > On 2008-01-25 19:18:22 -0700, "Vance Dubberly" <[EMAIL PROTECTED]> said: > > > > > ok so this ones got to be really simple and I've go to be really stupid. > > > > I want to update a model of something I already have in the database > > so I made a ModelForm that doesn't do anything special for it and I > > use that form to generate a form in a template using the normal > > form.as_table method. Everything prints out alright except for one > > thing, there is no id. "Hmm this'll be troublesome.", I think. "How > > am I gunna know what record to update when the post comes in?" So I > > figure I'm on crack and obviously don't know anything about http or > > databases any of that stuff. Maybe django has some magic foo that's > > over my head. So I print out the form, click the submit button, and > > now there are two copies of this object in the database. So having > > read all the docs and book I now come to ya'll. How am i supposed to > > do a simple update using newforms? > > It sounds like you are not passing in the instance to the form in the > if request.method == "POST" condition. There is no need for an ID in > the form because you are probably POSTing to the same URL with ID > there. Check the following code: > > def view(request, pk): > instance = get_object_or_404(MyModel, pk=pk) > if request.method == "POST": > form = MyModelForm(request.POST, request.FILES, instance=instance) > if form.is_valid(): > form.save() > else: > form = MyModelForm(instance=instance) > return render_to_response("mytemplate.html", { > "form": form, > }, context_instance=RequestContext(request)) > > -- > Brian Rosner > http://oebfare.com > > > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 and updating
ok so this ones got to be really simple and I've go to be really stupid. I want to update a model of something I already have in the database so I made a ModelForm that doesn't do anything special for it and I use that form to generate a form in a template using the normal form.as_table method. Everything prints out alright except for one thing, there is no id. "Hmm this'll be troublesome.", I think. "How am I gunna know what record to update when the post comes in?" So I figure I'm on crack and obviously don't know anything about http or databases any of that stuff. Maybe django has some magic foo that's over my head. So I print out the form, click the submit button, and now there are two copies of this object in the database. So having read all the docs and book I now come to ya'll. How am i supposed to do a simple update using newforms? -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: file upload RAM buffer or stream to tmp
James, So very true. I tell you what, I've been meaning to contribute something to the project because it is a very nice framework but at this point I have a week to do this and getting code into trunk takes longer than a week. With cherrypy I can just write a Tool that filters the request before it's parsed, that's easier than managing branches, given my timeline. Once I'm done I'll give the code to the django people to do with it whatever they'd like. Also streaming uploaded data to disk isn't just important to my application it's essential to the frameworks stability. RAM used to buffer files is RAM that can't be used for concurrent requests and on improperly configured servers... well you get the point. I can't believe anybody let's users upload anything using django, it's begging to be DDoS'd. I've not seen RAM buffering for file uploads in almost 6 years until Django and Rails hit the scene. Sends chills up my spine. Vance On Jan 14, 2008 10:56 AM, James Bennett <[EMAIL PROTECTED]> wrote: > > On Jan 14, 2008 12:01 PM, Vance Dubberly <[EMAIL PROTECTED]> wrote: > > Kind of a bummer, guess I'll be using cherrypy for this project. Was > > hoping to use django but it looks like there is no way to hook into > > the request response loop before the request is parsed. :( > > If streaming uploads are vital to your application, you might consider > pitching in to help with supporting them in Django. > > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." > > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: file upload RAM buffer or stream to tmp
Thanks manI suppose I should have just RTFC :D Kind of a bummer, guess I'll be using cherrypy for this project. Was hoping to use django but it looks like there is no way to hook into the request response loop before the request is parsed. :( Please tell me I'm wrong. Vance On Jan 14, 2008 1:54 AM, Sebastjan Trepca <[EMAIL PROTECTED]> wrote: > > I'm afraid it still uses memory: > > http://code.djangoproject.com/browser/django/trunk/django/http/__init__.py#L100 > > Sebastjan > > > On 1/14/08, Vance Dubberly <[EMAIL PROTECTED]> wrote: > > > > Does django still buffer file uploads into RAM or is has it started > > streaming to temp files yet? > > > > -- > > To pretend, I actually do the thing: I have therefore only pretended to > > pretend. > > - Jacques Derrida > > > > > > > > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: Performance / Memory/CPU Usage of A Django App with 10,000+ Models in a High Traffic Site
umm ouch. 1) Aside from the description of your app sounding entirely unreal you've probably gone beyond the world that any basic web application framework can handle and into the world of needing to higher a few Ph.D's. No simple ORM is going to work for you not django, not sqlalchemy, not rails, not hibernate. You'll want to put alot of logic in your database, and in middle ware, not your webserver. 2) Django will load all the model classes into RAM with each apache process. So the frequency of model loading depends upon your max requests per child. Though ultimately you'll prolly need a couple of Sun E 20 K 's to server your website. Ultimately if you've got 10,000 entitties you've probably got a number of very serious design flaws. Or to many SQLServer DBA's working for you ;). Vance On Jan 13, 2008 9:41 PM, Sebastian Macias <[EMAIL PROTECTED]> wrote: > > Hi, > > I already posted this on the django developers group and wanted to get > feedback as well from the community as well. > > I'm developing a large webapp using django. One of my requirements > is > that it needs to be able to handle 10,000+ different entities or > models that need to be associated with a user. A single user have > needs to be able to to associate himself with any of the existing > models and have one record per model. Each model will have an average > of 30 fields (each need to be searchable). There will be several > hundred thousands and in some occasions millions of records per model > and we expect to have millions of users using the webapp. > > My questions are: > > 1) Do you recommend using a django model per entity or should I try a > different approach? > > 2) Will django initiate all of my models on each request? Should I be > concerned about CPU and memory usage? > > Thanks a lot in advance. > > Sebastian > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
file upload RAM buffer or stream to tmp
Does django still buffer file uploads into RAM or is has it started streaming to temp files yet? -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: File upload virus scanning
Before it's saved to a file... that would be tricky. But this might get you started: http://www.clamav.net/ . It'll run a daemon though I don't know if it opens sockets or ports... Vance On Nov 20, 2007 2:22 PM, leifbyron <[EMAIL PROTECTED]> wrote: > > Hi there, > > Is anyone aware of a command-line tool that can be used to scan file > uploads for viruses before they are saved to a file? I know this is > not specifically a Django question, but I'm sure a lot of people would > find the answer useful. > > Thanks, > Leif > > > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Django Developer wanted.
I'm posting this here because I couldn't find anything on the django site about there being an appropriate place for "Help Wanted." == official post == Web Application Developer Challenging full-time permanent position with ASANI Solutions, LLC. at NASA Ames Research Center in Mountain View, California. Description A standards oriented Web Developer with a strong background in developing on the LAMP (Linux, Apache, MySQL, PHP, Python, PERL) platform. Candidate must be able to handle the full range of a project life-cycle from co-ordinating with a task requester to developing and testing the final application. Primary responsibilities will include maintaining and extending an existing Content Management System, developing static websites and web applications, and co-managing server infrastructure. Required Skills HTML CSS Javascript (AJAX) Python PHP SVN MySQL Apache Unix Education/Experience Typically requires a bachelors degree with 2 - 4 years related web and database development experience. Onsite work only. US Citizenship Required. No head hunters or agencies. == end official post == Here are two of the websites this position will be responsible for: http://ti.arc.nasa.gov/ http://opensource.arc.nasa.gov/ One is currently on Django, the other is a home grown php framework which should probably be replaced with a Django powered app. There are several more but they are internal. This is killer job for somebody that is self motivated and LIKES programming. I've had it for 4 years and am just moving up and on, there is enough cool stuff happening here right now that I'm kinda regretting leaving. Feel free to send resumes to me and I'll pass them up to HR. Vance -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: nasa site on django
Jeremy, I don't know about Java vs Python speeds. I've little doubt Java is alot faster if for no other reason than the amount of resources Sun puts behind it. However resource intensity is a very big deal. RAM is a huge factor here. The Tomcat App was running in a VM limited 256 meg and serving roughly 8x the number of requests. Django suffers from running under mod_python in a prefork environment where every process loads a full copy of django. So as I'm sure you can imagine RAM gets chewed up very quickly. I've not read good things about running django in fastcgi so we've not tried that, frankly I don't trust fastcgi. As for optimizations neither version of the app has any to speak of. Just get me x,y and z from the database and push it into a page. No caching, although we'll be adding memcached in the near future in an attempt to recover some speed ( at the cost of RAM ). Frankly I think a generic python application server similar to tomcat would do a world of good for python apps in general. Something similar to cherrypy... but this is beyond the responsibilities of the django community which have plenty great work left. I really wish I could talk more about this provide actual benchmarks and server info and code example... unfortunately, GOVERNMENT should pretty well some up why I can't and getting this licensed under NOSA takes longer than the little bit of code written to do this is really worth. Vance On 6/27/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > > On 6/27/07, Vance Dubberly <[EMAIL PROTECTED]> wrote: > ... > > ball of red tape but let's just say django is ALOT more resource > intensive > > and ALOT slower. > > Have you done any profiling? I haven't compared such a port, but I'd > be surprised if performance is significantly (i.e. one order) > different without some optimization being missed. > > If you have, can you point to any parts of Django that we could improve? > > As presented, there's not much actionable. "Java is faster than > Python" is not news, but I doubt the language is the problem here. > > Thanks! > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: nasa site on django
No dynamically assembling the pages via django is faster than serving static files off disk with Apache. Vance On 6/27/07, KpoH <[EMAIL PROTECTED]> wrote: > > > I don't understand. Static files served by django? > > Vance Dubberly wrote: > > Moved http://opensource.arc.nasa.gov to django a couple of weeks ago. > > Thought ya'll might want to know that. > > > > Also thought you might want to know the site was running on > > Tomcat/Mysql and the performance difference is mind blowing. > > Unfortunately the actual server specs and benchmarks can't be released > > without going through a nasty ball of red tape but let's just say > > django is ALOT more resource intensive and ALOT slower. > > > > On the plus side it is faster than a similar PHP app ( with APC ) and > > faster than serving static files. > > > > -- > > To pretend, I actually do the thing: I have therefore only pretended > > to pretend. > > - Jacques Derrida > > -- > Artiom Diomin, Development Dep, "Comunicatii Libere" S.R.L. > http://www.asterisksupport.ru > http://www.asterisk-support.com > > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: nasa site on django
Kai, Very very untrue. RAM is much faster than Disk IO. Dynamically assembling a page from query results cached in database memory is far faster than going to disk. Caching the rendered page via memcached, squid, or even in a database table is so much faster than serving static disk bound files it'll make your router cry out for mercy. Vance On 6/27/07, Kai Kuehne <[EMAIL PROTECTED]> wrote: > > > Hi, > > > Vance Dubberly wrote: > > > On the plus side it is faster than a similar PHP app ( with APC ) and > > > faster than serving static files. > > Afaik, dynamic things _can't be_ faster than static things. > > Kai > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
nasa site on django
Moved http://opensource.arc.nasa.gov to django a couple of weeks ago. Thought ya'll might want to know that. Also thought you might want to know the site was running on Tomcat/Mysql and the performance difference is mind blowing. Unfortunately the actual server specs and benchmarks can't be released without going through a nasty ball of red tape but let's just say django is ALOT more resource intensive and ALOT slower. On the plus side it is faster than a similar PHP app ( with APC ) and faster than serving static files. -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: Apache configuration
James, If I get you right the request path is ^mysite/admin/ so ^admin shouldn't work. You've got to update all your top level urls to ^mysite/module_name as such (r'^mysite/admin/', include('django.contrib.admin.urls')), Also the stuff in the virtual host isn't neccesary if you are mounting via Location. Location defined at the server root trancends all virtualhosts. Frankly if you have the ability to add virtualhosts to your sever you're best off setting up a virtualhost for every django app. Vance On 5/21/07, dystopia <[EMAIL PROTECTED]> wrote: > > I've got this in my Apache httpd.conf: > > > SetHandler python-program > PythonHandler django.core.handlers.modpython > PythonPath "['/var/www/dev.django.exampleurl.co.uk/'] + sys.path" > SetEnv DJANGO_SETTINGS_MODULE mysite.settings > PythonDebug On > > > I also have this set up in my vhosts: > > > ServerName dev.django.exampleurl.co.uk > DocumentRoot /var/www/dev.django.exampleurl.co.uk/ > PythonPath "['/var/www/dev.django.exampleurl.co.uk/'] + > sys.path" > SetEnv mysite.settings > > > > If I access the site on "http://dev.django.exampleurl.co.uk/mysite/"; I > get the pretty welcome message. However when I enable the routing > rules for the generated admin area I get nasty messages telling me > (understandably) that the rules have not matched anything ^admin/. > > I'm worried that I haven't set this up properly, because in effect the > application (which is for test purposes) should really run off the > main domain rather than requiring to be accessed through a folder. > > Any ideas appreciated > > James > > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: Displaying my table data
My bet would be that this little bit of code right here: def __str__(self,): return self.choice the return of __str__ needs to be a string not an object. Vance On 5/21/07, Greg <[EMAIL PROTECTED]> wrote: > > I am trying to display the table in my Choice table. However it's > error's out everytime I try to see the contents of the table. > > In my python shell prompt I do the following and get the error > > C:\django\mysite>python manage.py shell > (InteractiveConsole) > >>> from mysite.rugs.models import Choice > >>> c = Choice.objects.all() > >>> c > Traceback (most recent call last): > File "", line 1, in ? > File "c:\Python24\lib\site-packages\django\db\models\query.py", line > 102, in _ > _repr__ > return repr(self._get_data()) > File "c:\Python24\lib\site-packages\django\db\models\base.py", line > 86, in __r > epr__ > return '<%s: %s>' % (self.__class__.__name__, self) > TypeError: __str__ returned non-string (type Style) > >>> > > Here are my choice models file > > class Choice(models.Model): > choice = models.ForeignKey(Style, edit_inline=models.TABULAR, > num_in_admin=5) > size = models.ForeignKey(Size, core=True) > price = models.ForeignKey(Price, core=True) > > def __str__(self,): > return self.choice > > Does anybody know why I can't display the data in the table? > > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 file upload
Thanks Sandro. I concur newforms beats the socks off maninpulator and validators but putting it in trunk prior to getting basic functionality completed was mean. But hey it's pre-1.0 so I guess anything goes. ;) Vance On 5/3/07, vega <[EMAIL PROTECTED]> wrote: > > Hi, > > in fact there is a working patch you can use: #3297 > > It's really out of my comprehension why fileupload and FloatField > have > been kept back (the latter due to design decision on decimals). > > I can't understand how the django-team suggests anybody switch to > newforms > without these 2 very important and already patched peaces of code. > And > moreover I wander how all those developers can develop w/o these > peaces... > > Just to make it clear: newforms is a really nice framework, the more > I use > it the more I like it. I can't just understand why they didn't add > an > already ready patch on what seems to be just the basic bricks to be > used. > > > sandro > *:-) > > > > > > -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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 file upload
Am I correct in my guess that uploading files and new forms are two things that just don't go together? I'm about to just do the file handling myself ( not a big deal ) but thought I'd check with the smart people before I went there. -- To pretend, I actually do the thing: I have therefore only pretended to pretend. - Jacques Derrida --~--~-~--~~~---~--~~ 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: getElementsByClass
DISREGARD. WRONG LIST!! SORRY. On 1/29/07, Vance Dubberly <[EMAIL PROTECTED]> wrote: > > Just checking if I'm delusional or whether dojo.html.getElementByClass is > broken in IE 7. > > dojo.debug("pre getElementByClass") > tabs = dojo.html.getElementByClass('tab', 'tabs', 'div'); > dojo.debug("post getElementByClass") > > on a chunk o' code that looks like this > > > blah > blah > > > results in > > DEBUG: pre getElementByClass > > > and nothing else. > > Works fine in Safari, FF, and Opera. > > Any suggestions or alternatives would be greatly appreciated. > > Vance > > > -- > Most People are not even aware of their need to conform. They live under > the illusion that they follow their own ideas and inclinations, that they > are individualists, that they have arrived a their opinions as the result of > their own thinking and that it just happens that their ideas are the same > as those of the majority > -- Eric Fromm -- Most People are not even aware of their need to conform. They live under the illusion that they follow their own ideas and inclinations, that they are individualists, that they have arrived a their opinions as the result of their own thinking and that it just happens that their ideas are the same as those of the majority -- Eric Fromm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
getElementsByClass
Just checking if I'm delusional or whether dojo.html.getElementByClass is broken in IE 7. dojo.debug("pre getElementByClass") tabs = dojo.html.getElementByClass('tab', 'tabs', 'div'); dojo.debug("post getElementByClass") on a chunk o' code that looks like this blah blah results in DEBUG: pre getElementByClass and nothing else. Works fine in Safari, FF, and Opera. Any suggestions or alternatives would be greatly appreciated. Vance -- Most People are not even aware of their need to conform. They live under the illusion that they follow their own ideas and inclinations, that they are individualists, that they have arrived a their opinions as the result of their own thinking and that it just happens that their ideas are the same as those of the majority -- Eric Fromm --~--~-~--~~~---~--~~ 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: Re: Re: Extending user model in 0.95?
Wow you're even in worse shape than I am. :) I Foreign Keyed my user profiles ( it's very hackish, PHP 3 hackish ) and had expected to need to write my own app to manage them whether I could subclass User or not. Asking the Admin Tool to acknowledge an extended user object is really being unreasonable. Of course not being able to subclass a model for use in your own tool is also being unreasonable ( albeit it's difficulte to write ). I'd plan to write my own auth system. The admin tool is a great convieniance but not a substitute for an actual application. Vance On 8/24/06, Jakub Labath <[EMAIL PROTECTED]> wrote: > > Hi, > > > On 8/9/06, Vance Dubberly <[EMAIL PROTECTED]> wrote: > > > I very much want to subclass User as I have more than one kind of user > > > and each has a different type of profile. > > > > Which is a different situation from probably 80% of the needs people > > have for extending the User model. > > I think I'm with the 20% just the extra fields is not enough in my case. > I will need the ability to call my functions before and/or after the > User object is saved in django user admin. For example > somebody changes user's email in admin I want to call function that > will report the new email address to a webservice. > > I guess the Foreign Key solution suggested by Joe would actually work > here. Since the inline objects are getting saved with parents and I > can just override the save of the inline object. However it still > feels Hackish. > > As you can guess my auth/user system might actually span across > multiple physical servers or at least parts of the user data will. > > Am I just better off writing my own auth system altogether or does > anybody have an elegant idea how to easily extend the user system with > own function calls? > > Thanks > > > > -- Most People are not even aware of their need to conform. They live under the illusion that they follow their own ideas and inclinations, that they are individualists, that they have arrived a their opinions as the result of their own thinking – and that it just happens that their ideas are the same as those of the majority -- Eric Fromm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Application Prefix
So I've got this insane requirement that says I need to isolate all my django apps under a prefix ... as suchhttp://www.sitename.com/prefix/I'm not really the kind guy to hardcode the prefix into all my templates and so on. So I came up with a solution that makes my stomach turn. That is: In setttings.py I define:PREFIX = '/prefix'and then in all my views I add something like thisfrom django.conf import settingsdef index(request): return render_to_response('auth/index.html', { 'app_root': settings.PREFIX })Then in the template I do something like thisDo ThingSomebody please tell me I've been hitting the crack pipe a bit to hard and that there is a more elegant solution to this silliness, either through Apache ( mod_rewrite? ) or Django. Vance-- Most People are not even aware of their need to conform. They live under the illusion that they follow their own ideas and inclinations, that they are individualists, that they have arrived a their opinions as the result of their own thinking – and that it just happens that their ideas are the same as those of the majority -- Eric Fromm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Re: Passing user.is_superuser through form
It's not a security hole if you are writing a user management application. And this information is being made avaliable to a trusted "administrative user". However, if you are using this data to re-populate a user object or edit user info, or for any purpose not administrative, and not validating that the end user has permission to edit the is_superuser property then yes it is. Any user viewing your page can simply view source, see the hidden field and then use a tool, like "Tamper Data" to alter the value of the field when the page is submited. This would give them super user privileges. Even if the data is never stored in the database they will have super user privs for the life of their log in session. Which is long enough for any hacker to have a good time with your site. Vance On 8/22/06, cyberco <[EMAIL PROTECTED]> wrote: > > Max, I'm not sure I fully understand your reply. Currently I got things > working by passing the user object to the template and returning its > attribute values: > > > value="{{user.is_superuser}}" /> > > > Is this a security hole? > > > > > -- Most People are not even aware of their need to conform. They live under the illusion that they follow their own ideas and inclinations, that they are individualists, that they have arrived a their opinions as the result of their own thinking – and that it just happens that their ideas are the same as those of the majority -- Eric Fromm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Re: syncdb without shell access
Some combination of cgi and a system or execute command is a fun way to both piss off your hosting provider and get that done. You'll need to insert all the appropriate paths but it would look something like this: os.system('/path/to/python /path/to/manage.py syncdb'); If your hosting provider is incompotent that will work. There are equivalents in php and perl if you can't run python as a normal cgi. Ultimately as Jermy said, get a new host. You shouldn't have to hack to get things done. Vance On 8/16/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > On 8/16/06, Jason F. McBrayer <[EMAIL PROTECTED]> wrote: > > > > Robin Gruyters <[EMAIL PROTECTED]> writes: > > > > >> > > My hosting provider doesn't give shell access, so I can't > > >> > > execute like "syncdb", "startapp", "startproject", etc. > > >> > > > > >> > > Is there another way to do this? (e.g. by creating a runsync.py > > >> > > script?! (or something?)) > > > > Hmm, I'd actually recommend changing hosts. > > > > -- Most People are not even aware of their need to conform. They live under the illusion that they follow their own ideas and inclinations, that they are individualists, that they have arrived a their opinions as the result of their own thinking – and that it just happens that their ideas are the same as those of the majority -- Eric Fromm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Re: How to build a tree on the page?
Thanks for sharing that spaceman. On 8/16/06, spacedman <[EMAIL PROTECTED]> wrote: > > > 一首诗 wrote: > > I have a table like this > > > > id | name | parentid > > > > And parentid is a Foreign Key to ID. > > > > So I have a tree in my database. My question is that, how can I > > represent it on the web as a tree. > > If you can rework your database slightly you can use Modified Preorder > Tree Traversal, which is a really slick way of doing trees in > relational databases. You can get everything you need to know to > present a tree diagram with ONE database call. If you store parent-id > then you can end up hitting the database many many more times as you > climb up and down the tree. > > See > http://code.djangoproject.com/wiki/ModifiedPreorderTreeTraversal > > And > http://www.sitepoint.com/print/hierarchical-data-database > > It takes a bit of thinking about, but once it 'clicks' you'll see how > neat it is. > > Barry > > > > > -- Most People are not even aware of their need to conform. They live under the illusion that they follow their own ideas and inclinations, that they are individualists, that they have arrived a their opinions as the result of their own thinking – and that it just happens that their ideas are the same as those of the majority -- Eric Fromm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: psycopg2
( still in beta yada yada yada ) <- that'd be the diatribe on the django site. so even though psycopg is stable it still officially isn't supported by the django developers. so anybody using it still has to eat their own pie.. h pie, I like pie. VanceOn 8/11/06, Laurent Rahuel <[EMAIL PROTECTED]> wrote: Le mercredi 9 août 2006 19:42, Vance Dubberly a écrit:>> Warning psycopg2 is not supported by django. ( still in beta yada > yada yada ). Unless you're willing to eat your own pie when things go> awry, don't use it.>Snip,Fromhttp://initd.org/projects/psycopg2, you can read :"""psycopg 2 is now the stable branch (psycopg 1 support has been discontinued.) More information is available on the psycopg 2 wiki."""Regards,Laurent.-- Most People are not even aware of their need to conform. They live under the illusion that they follow their own ideas and inclinations, that they are individualists, that they have arrived a their opinions as the result of their own thinking – and that it just happens that their ideas are the same as those of the majority -- Eric Fromm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Re: Extending user model in 0.95?
I could not disagree with this more. I very much want to subclass User as I have more than one kind of user and each has a different type of profile. You have the option of changing the user model. Copy it to your local app and change it. Until we get proper inheritence ( a huge flaw in django ) Joes method works great. -v On 8/9/06, James Bennett <[EMAIL PROTECTED]> wrote: > > On 8/9/06, Joe <[EMAIL PROTECTED]> wrote: > > I know this is a bit "hackish", but it will work until model > > inheritance is straightened out. > > What people actually want is not "a subclass of User that has extra > fields"; what people actually want is "User with extra fields". > There's a big important difference there, because the auth system uses > django.contrib.auth.models.User, and there is absolutely no way to > make it use some other model -- even if that model is a subclass of > User -- instead. We used to have 'replaces_module', but that was ugly > and went away a long time ago and, God willing, will never come back. > > So despite popular misconception, model inheritance does not and will > not provide any easier/better/more efficient way to extend the User > model (as I noted in my blog entry about extending User). The fact > that AUTH_PROFILE_MODULE and get_profile() were around when > subclassing worked in the 0.90 and 0.91 releases should indicate that > fact; building a separate model related to User is and probably always > will be the best way to extend it. > > -- > "May the forces of evil become confused on the way to your house." > -- George Carlin > > > > -- Most People are not even aware of their need to conform. They live under the illusion that they follow their own ideas and inclinations, that they are individualists, that they have arrived a their opinions as the result of their own thinking – and that it just happens that their ideas are the same as those of the majority -- Eric Fromm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: psycopg2
Not much difference between it and any other database due to django's ORDBM. The only difference during set up is that instead of setting the db to postgres you set it as such DATABASE_ENGINE = 'postgresql_psycopg2' If you didn't do it already you might want to follow the the last Q on this FAQ here: http://initd.org/tracker/psycopg/wiki/PsycopgTwoFaq lest the quantity of django output cause your eyes to bleed. Warning psycopg2 is not supported by django. ( still in beta yada yada yada ). Unless you're willing to eat your own pie when things go awry, don't use it. That said I've had absolutely no problems with it. I've also used it as the backend with SQLObject and found it quite stable and very fast. Vance On 8/9/06, a <[EMAIL PROTECTED]> wrote: > > how to use django with psycopg2? > > anyone tried it > > > > > -- Most People are not even aware of their need to conform. They live under the illusion that they follow their own ideas and inclinations, that they are individualists, that they have arrived a their opinions as the result of their own thinking – and that it just happens that their ideas are the same as those of the majority -- Eric Fromm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: psycopg2
Thank you much! VanceOn 7/30/06, Tom Tobin <[EMAIL PROTECTED]> wrote: On 7/30/06, Vance Dubberly <[EMAIL PROTECTED]> wrote:> postgresql_psycopg2>> Yes I found it. Yes I know it's not supported . But could somebody tell me > how to tell it to shut up? My eyes are bleeding! :) The debug output is> just a little overwhelming and quite useless unless you are the module> developer. Is there switch somewhere I could flip without shutting off > debugging for everything?See the last question here:http://initd.org/tracker/psycopg/wiki/PsycopgTwoFaqIn short, rebuild psycopg2 after yanking PSYCOPG_DEBUG from "define" in setup.cfg.-- Most People are not even aware of their need to conform. They live under the illusion that they follow their own ideas and inclinations, that they are individualists, that they have arrived a their opinions as the result of their own thinking – and that it just happens that their ideas are the same as those of the majority -- Eric Fromm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
psycopg2
postgresql_psycopg2Yes I found it. Yes I know it's not supported . But could somebody tell me how to tell it to shut up? My eyes are bleeding! :) The debug output is just a little overwhelming and quite useless unless you are the module developer. Is there switch somewhere I could flip without shutting off debugging for everything? ThanksVance --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---