Admin pages, filtering instance list by instance field value and a newbie (me)
Greetings, I'm here to seek your help: I'm new to Django (I have experience with Prado and Zope3 though). Here is my problem: I created a model having - among the other ones - a status field (approved, draft, proposed, etc) and a reference to the user that created the instance. I'd like to use Admin pages (derived from django.contrib.admin and django.contrib.auth.models.User) to interact with instances of this models. I'm trying to show - in the index (a.k.a. list) page for the instances of this models - only the instances created by the logged user, all of them if the logged user is the administrator and only the approved ones for anonymous users. I could easily resolve the problem with a simple template & view pair, but I was wondering if somehow I can specify in the class derived from admin.ModelAdmin and associated to my model somehow that I want to use a filter (Manager?) that reads a value from request.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-us...@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: Admin pages, filtering instance list by instance field value and a newbie (me)
In simpler terms: is there a way to filter instances shown with "admin" pages considering the logged user id? is there a way to "interface" request.User with admin.ModelAdmin ? On Mon, Jan 18, 2010 at 22:33, Massimiliano della Rovere < massimiliano.dellarov...@gmail.com> wrote: > Greetings, > I'm here to seek your help: > I'm new to Django (I have experience with Prado and Zope3 though). > > Here is my problem: > I created a model having - among the other ones - a status field (approved, > draft, proposed, etc) and a reference to the user that created the instance. > I'd like to use Admin pages (derived from django.contrib.admin and > django.contrib.auth.models.User) to interact with instances of this models. > I'm trying to show - in the index (a.k.a. list) page for the instances of > this models - only the instances created by the logged user, all of them if > the logged user is the administrator and only the approved ones for > anonymous users. > > I could easily resolve the problem with a simple template & view pair, but > I was wondering if somehow I can specify in the class derived > from admin.ModelAdmin and associated to my model somehow that I want to use > a filter (Manager?) that reads a value from request.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-us...@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: Admin pages, filtering instance list by instance field value and a newbie (me)
Solved: I found this (well hidden) page: http://code.djangoproject.com/wiki/RowLevelPermissions I do not know it is not embedded in Admin.site documentation... and why those fully functional methods are simply hidden in the source code... On Tue, Jan 19, 2010 at 10:00, Massimiliano della Rovere < massimiliano.dellarov...@gmail.com> wrote: > In simpler terms: > is there a way to filter instances shown with "admin" pages considering the > logged user id? > is there a way to "interface" request.User with admin.ModelAdmin ? > > > On Mon, Jan 18, 2010 at 22:33, Massimiliano della Rovere < > massimiliano.dellarov...@gmail.com> wrote: > >> Greetings, >> I'm here to seek your help: >> I'm new to Django (I have experience with Prado and Zope3 though). >> >> Here is my problem: >> I created a model having - among the other ones - a status field >> (approved, draft, proposed, etc) and a reference to the user that created >> the instance. >> I'd like to use Admin pages (derived from django.contrib.admin and >> django.contrib.auth.models.User) to interact with instances of this models. >> I'm trying to show - in the index (a.k.a. list) page for the instances of >> this models - only the instances created by the logged user, all of them if >> the logged user is the administrator and only the approved ones for >> anonymous users. >> >> I could easily resolve the problem with a simple template & view pair, but >> I was wondering if somehow I can specify in the class derived >> from admin.ModelAdmin and associated to my model somehow that I want to use >> a filter (Manager?) that reads a value from request.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-us...@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.
Admin site pages + display or hiding instance owner field
Is there a way to show or hide a model field in a admin site "change" page depending upon the value of request.user.is_superuser ? I was thinking about filling ModelAdmin.field or .fieldset depending on the value of request.user, but how to read the value of request in ? Also .readonly_fields when used in conjunction with a Foreign Key show the id of the object, not following the "link". Is there a way to change this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Admin site pages + display or hiding instance owner field
Thanks for your answer Tim. def get_form(self, request, obj=None, **kwargs): form = super(RowModelAdmin, self).get_form(request, obj, **kwargs) if not request.user.is_superuser: * **del form['compilatore']* return form It seems that the object returned by get_form does not behave like a dict(). It does not support .remove or iteration too. Here is the error I receive: *'ModelFormMetaclass' object does not support item deletion* Exception Type: TypeError Exception Value: 'ModelFormMetaclass' object does not support item deletion Python Version: 2.6.4 skype: masdero, icq: 473891447, yim: mas_dero, msn: mas_d...@hotmail.com Mi scriva in italiano; Write me in English; Skribu al mi Esperante! On Tue, Jan 19, 2010 at 18:31, Tim wrote: > I think it should be pretty easy to do. > > The get_form() method on ModelAdmin returns the form, and it knows > about the current request. So you could modify that to remove the > field after the form is generated. > > > class MyModelAdmin(admin.ModelAdmin): > >def get_form(self, request, obj=None, **kwargs): >form = super(MyModelAdmin,self).get_form(request, obj, > **kwargs) >if request.uesr.is_super_user: >del form.fields['whatever'] >return form > > admin.site.register(MyModel, MyModelAdmin) > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Admin site pages + display or hiding instance owner field
Ok I managed to remove the compilatore field from the form (this RowModelAdmin class is used by many Models, all having the compilatore field) def get_form(self, request, obj=None, **kwargs): form = super(RowModelAdmin, self).get_form(request, obj, **kwargs) if not request.user.is_superuser: del form.base_fields['compilatore'] return form Now the form validation sequence complains because the compilatore field is part of the model and thus may not be empty (it's a ForeignKey to auth.models.User). I'm trying to override or customize the form.is_valid() method, so then I will implement a def save_model(self, request, obj, form, change): obj = form.save(commit=False) if obj.compilatore == None: obj.compilatore = request.user.id obj.save() Another way I tried was defining a RowModelForm for the RowModelAdmin (adding "form = RowModelForm" in RowModelAdmin) class instead of impementing get_form: class RowModelForm(forms.ModelForm): class Meta: exclude = ('compilatore',) def validate(self): pass def clean(self): pass def clean_compilatore(self): return True But I still get the same error as above. How can I hook to the validation process to tell it "close an eye on compilatore being missing (when it is missing), I will add it later?" -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Admin site pages + display or hiding instance owner field
Solved. It seems this is due to the 1.2 alpha1 bug involving form.is_valid(): http://www.pubbs.net/django/201001/16447/ reverting to django 1.1 solved all my problems On Wed, Jan 20, 2010 at 10:25, Massimiliano della Rovere < massimiliano.dellarov...@gmail.com> wrote: > Ok I managed to remove the compilatore field from the form (this > RowModelAdmin class is used by many Models, all having the compilatore > field) > def get_form(self, request, obj=None, **kwargs): > form = super(RowModelAdmin, self).get_form(request, obj, **kwargs) > if not request.user.is_superuser: > del form.base_fields['compilatore'] > return form > > Now the form validation sequence complains because the compilatore field is > part of the model and thus may not be empty (it's a ForeignKey to > auth.models.User). > I'm trying to override or customize the form.is_valid() method, so then I > will implement a > def save_model(self, request, obj, form, change): > obj = form.save(commit=False) > if obj.compilatore == None: > obj.compilatore = request.user.id > obj.save() > > Another way I tried was defining a RowModelForm for the RowModelAdmin > (adding "form = RowModelForm" in RowModelAdmin) class instead of impementing > get_form: > class RowModelForm(forms.ModelForm): > class Meta: > exclude = ('compilatore',) > def validate(self): > pass > def clean(self): > pass > def clean_compilatore(self): > return True > > But I still get the same error as above. > How can I hook to the validation process to tell it "close an eye on > compilatore being missing (when it is missing), I will add it later?" > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
view_form for class ModelAdmin
Has anybody ever implemented an extension to class ModelAdmin to add "view_form" function and templates? I'm in a situation where the logged user can list both draft and published files. With ModelAdmin.queryset i filter the files the user is allowed to list in "change_list" view, but those files include also the published one that should only be viewed, not edited, by an editor user. I tried to use the .has_change_permission, but this is a shortcut to a Permission Denied exception, rather that a .view_"form" page. So I was planning to add this feature. I had two ways in my mind: - the cleaner one: modify / override some methods of the ModelAdmin class so that if the current user do not has_change_permission for a model instance and clicks the widget to edit the instance, he is presented with a simple view page, that has the same look of the other admin pages and simply shows all the fields of the instance (it could look for a class attribute "display_empty" to decide whether to output empty fields or not) - the dirty way: (which I think could be easier for a Django newbie like me) in urlconf "trap" the edit url with the admin prefix for each model. The view checks if the user is allowed to edit the instance (and thus the default admin view for change_form should be returned) or not, and in the latter case the user is presented with a view_form. Due to my newbieness I am thinking about going the dirty way, but I do not know how the change_form view is called and how url regexp splitting is performed (is it with ?P or just parenthesis?). Please, can anybody give me any hints? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Meta.widgets in ModelForm seems... ignored
I use django 1.1.1 and I defined: class Fondo(models.Model): denominazione = models.CharField(max_length=200) storia= models.TextField(blank=True) class FondoForm(forms.ModelForm): class Meta: model = Fondo widgets = {'storia': forms.TextInput} but the 'storia' field is still shown as TextArea. Can you tell me where do I err? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Meta.widgets in ModelForm seems... ignored
Thanks foy your replies. The class Fondo has in truth lots of Textfield to be displayed as CharField (I am using django.forms to implement a search mask); the one posted was only an excerpt. I solved this way: class FondoForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(FondoForm, self).__init__(*args, **kwargs) for nome, campo in self.fields.items(): self.fields[nome].required = False if type(campo.widget) == forms.Textarea: self.fields[nome].widget = forms.TextInput() class Meta: model = Fondo On Tue, Jan 26, 2010 at 16:05, KrcK --- wrote: > You can try this: > > class Fondo(models.Model): > denominazione = models.CharField(max_length=200) > storia= models.TextField(blank=True) > class FondoForm(forms.ModelForm): > storia = forms.CharField(widget=forms.Textarea) > > class Meta: > model = Fondo > > I am not sure if this works. > > > > 2010/1/26 Daniel Roseman >> >> On Jan 26, 11:45 am, Massimiliano della Rovere >> wrote: >> > I use django 1.1.1 and I defined: >> > >> > class Fondo(models.Model): >> > denominazione = models.CharField(max_length=200) >> > storia= models.TextField(blank=True) >> > >> > class FondoForm(forms.ModelForm): >> > class Meta: >> > model = Fondo >> > widgets = {'storia': forms.TextInput} >> > >> > but the 'storia' field is still shown as TextArea. Can you tell me where >> > do >> > I err? >> >> The 'widgets' Meta option on modelforms is only available in the >> development version. You seem to be using the wrong documentation - >> you should be looking at >> http://docs.djangoproject.com/en/1.1/topics/forms/modelforms/ >> >> (Also it seems that the dev docs are missing the 'new in development >> version' tag there.) >> -- >> DR. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-us...@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com . >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: "Pro Django" book still up to date
Hi Achim, the book, as many told you, is for Django 1.0 The book content is not outdated, at least with django 1.1 The meat of the book are insights about django structure, how components work together and hidden movements behind the scenes you could exploit or hook to. It'snot a beginner's book and it focuses also on details and djanguesque techniques (ajax backend for example) that are not written in thw two other books from apress (I own "The definitive guide to django 1.1", "Practcal Django Projects 1.1" and "Pro Django" (1.0). I really recommend Pro Django. On Wed, Jan 27, 2010 at 17:55, Achim Domma wrote: > Hi, > > I'm interested in buying the "Pro Django" book. I could not find any > hint about what version it's written for. As it covers mostly > internals and the ideas behind Django, it should not be outdated as > quickly as other books. Has anybody read that book and can give some > feedback about how useful it is for the current version of Django? > > cheers, > Achim > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Admin Search Engline
I'd like to modify the default search engine in the django admin interface so that is can search metadata too like values depending on sql COUNT() using google style prefixes in these cases. Can somebody help me telling which class/method in the admin files is responsible for the search engine so that I can extend it? 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-us...@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: Admin Search Engline
Yes that's my idea. Can you tell me which class/method in the admin files is responsible for the search engine so that I can extend it? On Mon, Jun 28, 2010 at 10:27, euan.godd...@googlemail.com wrote: > I think that would be quite an undertaking as you would need to write > an expression parser and monkey around with the search code in admin. > > If you succeed, I'd be interested to see the result. > > Euan > > On Jun 28, 8:36 am, Massimiliano della Rovere > wrote: >> I'd like to modify the default search engine in the django admin >> interface so that is can search metadata too like values depending on >> sql COUNT() using google style prefixes in these cases. >> Can somebody help me telling which class/method in the admin files is >> responsible for the search engine so that I can extend it? >> >> 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-us...@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: How To Create POST data without an actual POST?
or you can use python urllib2: http://docs.python.org/library/urllib2.html On Tue, Jun 29, 2010 at 02:15, Gabriel Gayan wrote: > Maybe trying with ajax? > jquery has some nice functions to deal with ajax post requests. > You can even send files via ajax. > From the server side, you could return JSON objects and parse them on the > client (for validation). > Cheers > > On Mon, Jun 28, 2010 at 4:22 PM, Margie Roginski > wrote: >> >> I'd like to find a way to let my users submit form data without >> submitting >> it via an actual web form. For example, I have users that would like >> to >> send their data via email, or perhaps provide it in an excel spread >> sheet, >> >> I'm trying to figure out how to do this and still leverage all the >> error >> checking associated with my forms (ie, via is_valid). >> >> I'm thinking that on the server side I could create a form with >> initial data, >> and then instead of rendering that form, I'd like to just convert it >> directly >> to a POST data dict, as if the user submitted the form without making >> any changes. Then I'd take that POST data, add a bit of additinal >> data >> that I've gotten from some other source (ie from email or excel), then >> run >> is_valid(), then do my standard save to my db object. >> >> Can anyone comment on if this seems like a good approach for doing >> this, >> and if so, if there is any django support for turning a form directly >> into a data dict? >> >> Thanks! >> Margie >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-us...@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > > > -- > Gabriel Gayan > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Beginner nead help
I do not know whether there is or not the complete tutorial, but you can write the errors you receive or the doubts you have. They could be useful for other beginners too :) On Tue, Jun 29, 2010 at 10:54, Eduan wrote: > Hi all. I am a old Delphi programmer and started to use Django. I > believe that it is the future of programming. I started at > Djangoprojects's tutorial and get stuck at places. Is there some > place > that I can download the full finished tutorial? or if anyone of you > have the complete tutorial that you can send me. > > Thanks allot > Eduan -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Composite primary key (unique_together?) and ForeignKeys
Greetings, I am creating an event logger; each event spans in time from datetime to datetime. Each event is uniquely identified with the couple event_start_date_time and event_id (ranging from 0 to ). The Hardware event trapper automatically wraps the event_id. I am the programmer of the event logger, external to django, so I can decide how to shape the DB table; the plan is using the admin interface to browse through the logged events. Now my problem is that there can be something like 25,000 events per day and that the default auto_increment field (technique) will sooner or later exhaust. So I thought that, even though the MySQL limit for SERIAL (=BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE) fields is 18,446,744,073,709,551,615, I could use a composite primary key in django but I was wondering if there are any ForeignKey and ManyToManyField vs unique_together issues in django. Another idea springing in my mind is using a string as primary key composed by the concatenation of event_start_date_time.isoformat() and event_id. Which solution is best in your opinion? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is Django admin's "delete confirmation" considered RESTful?
I did not read the sources of the admin module devoted to deleting an item, but I think the problem is not in the admin interface but in html forms. Html forms allow only GET and POST, but no DELETE and PUT. Given the REST common-sense rule "whenever you POST, ask the user" the admin interface - a web, html interface - behaves properly: a destructive post checks the user's will. On the other side, when we will have XForms 1.1 and Xhtml 2.0 we'll be able to issue PUT and DELETE without the need for AJAX support: var request = new XMLHttpRequest(); request.open("DELETE", "http://yoururl/page.html";, True); If you want to REST-ise your app, you could have a look at piston: http://bitbucket.org/jespern/django-piston/wiki/Home On Wed, Jul 7, 2010 at 17:10, Margie Roginski wrote: > Actually, the confirmation page is not accessed via a GET. Using the > admin's auth model as an example: the user does a GET to something > like www.example.com://admin/auth/user to get a list of users. Then > they checkmark the users they want to delete, select the "delete" > action, and then click on "go", which does a POST to ://admin/auth/ > user. The server code for the post does a render_to_response and > simply renders a delete confirmation page, resulting in the user > seeing the delete confirmation. The url that the user sees with this > delete confirmation is the same, //admin/auth/user. From the delete > confirmation page, the users clicks "Yes I'm Sure" and this does > another post to ://admin/auth/user. On the server side the code > detects the "Yes I'm Sure" input and does its thing (deletes the > selected uesrs), and then redirects back to ://admin/auth/user. This > redirect is a GET, so it now displays the list of users, again at :// > admin/auth/user. > > It seems that that url www.example.com://admin/auth/user is getting > used for one GET and two POSTS. My question is pretty much: Is this a > good way to do this? Is it ok to have different pages (ie the user > list and the user delete confirmation) all show up with the same url? > If there is some better way, what is it? Hypothesizing on other ways: > when the server side does the render_to_response to display the delete > confirmation, should it be replacing the url that the user sees? IE, > instead of showing ://admin/auth/user, show ://admin/auth/ > user_delete_confirmation? And if so, how does one do this? I don't > think you can replace the url with render_to_response, right? I could > do a redirect, but if I did that, I would have to save the ids of the > users being deleted (in the session I guess). > > Margie > > > > On Jul 7, 3:00 am, "euan.godd...@googlemail.com" > wrote: >> I'm not entirely sure whether you're asking one question or two here. >> >> Firstly, I think that in the RESTful sense, there's nothing wrong with >> having a confirmation page that uses the same URL to perform an action >> *providing* the HTTP verb is different. In this case the confirmation >> page is accessed via a GET (I assume) and the actual delete is >> performed via a POST. >> >> I guess that strictly speaking to be truly RESTful, the view should be >> using the DELETE verb. However, since some browsers don't support >> DELETE and PUT, most web apps use just GET and POST. >> >> I'm not sure whether that answers your question, but hopefully clears >> it up a bit. >> >> Euan >> >> On Jul 7, 2:49 am, Margie Roginski wrote: >> >> > I have an app that is modeled after the django admin app. In general >> > it seems to me that the admin app is RESTful. However, I am >> > encountering a situation that is similar to the admin apps delete >> > confirmation process, and I'm curious if anyone out there could >> > comment on whether this particular part is considered "RESTful", or if >> > not "RESful", I guess I'd just like opinions on if it's a good way to >> > do things. Let me describe my question more. >> >> > In the django admin, you can click on a bunch of objects and then >> > select the "delete" action, and then click "go". This takes you to a >> > delete confirmation page that asks if you are sure. You can click >> > "I'm sure" to proceed with your delete. This delete confirmation page >> > has the same url as the objects changelist page. And that's the core >> > of my question - is that a good thing? >> >> > I have a situation that is quite similar, but a bit more complex. To >> > give a hopefully simple analogy, suppose that the admin's delete >> > confirmation page had an input field associated with each object, >> > which required the user to put in a "reason" prior to clicking "I'm >> > sure". And if the user doesn't put in a reason, imagine they should >> > be presented with the same delete confirmation page, but with an error >> > on the fields where no reason was supplied. Should this page also be >> > at the same changlist url? >> >> > I *think* the answer to this question is yes (though perhaps it is not >> > RESTful). My reason behind t
Did anybody ever move the filter column (admin) on the left?
I know it's just messign with the css files, but there are a lot of lines marked with ".filter", not counting the grey border fo the main table when the filter list is taller than the "instances" box. I was wondering if anybody has a css files with the modified lines to include in the Media class of the Admin interface. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
ModelAdmin,get_form or Field._get_val_from_obj
I need to "decode" the value of the fields of ModelAdmin.form so that, for some fields, the int value is translated in a string showing its meaning. I do not want to implement this in the Model class (using Model.to_python or Model.formfield for example), because the information displayed in the columns of changelist_view page are enough for the 90% of the times, so I prefer to do the extra work necessary to generate the strings only when requested thus avoiding the overhead necessary to select the correct string to be wasted in most cases. So I was in doubt whether to override the ModelAdmin,get_form or some _get_val_from_obj for some fields from the ModelAdmin.form. Which one is more correct in your opinion? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: ModelAdmin,get_form or Field._get_val_from_obj
Hi Daniel, choices is how it is currently implemented, but it has 2 flaws: 1) this happens for all records, just when they are loaded; 2) the "translator" function, checks if the int can be used as a key to retrieve the meaning, else (KeyError) it returns 'currently unused'. 3) the choice solution forces me to list all the possible values (usually less than 20 out of 255 are meaningful). Now I am trying the ModelAdmin.render_change_form On Tue, Jul 13, 2010 at 10:34, Daniel Roseman wrote: > On Jul 13, 9:28 am, Massimiliano della Rovere > wrote: >> I need to "decode" the value of the fields of ModelAdmin.form so that, >> for some fields, the int value is translated in a string showing its >> meaning. >> I do not want to implement this in the Model class (using >> Model.to_python or Model.formfield for example), because the >> information displayed in the columns of changelist_view page are >> enough for the 90% of the times, so I prefer to do the extra work >> necessary to generate the strings only when requested thus avoiding >> the overhead necessary to select the correct string to be wasted in >> most cases. >> >> So I was in doubt whether to override the ModelAdmin,get_form or some >> _get_val_from_obj for some fields from the ModelAdmin.form. >> >> Which one is more correct in your opinion? > > Couldn't you just use `choices` for that? Specify the possible values > and their 'decoded' versions in a 2-tuple, set the field's choices > parameter to that constant, and you would automatically get a > `get_FOO_display()` method which would show the 'decoded' value > instead of the original one. > -- > DR. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: ModelAdmin,get_form or Field._get_val_from_obj
It seems that modifying context['adminform'].form.instance or obj in render_change_form has no impact on the rendered html. Where does the admin interface take the values to display from? On Tue, Jul 13, 2010 at 10:28, Massimiliano della Rovere wrote: > I need to "decode" the value of the fields of ModelAdmin.form so that, > for some fields, the int value is translated in a string showing its > meaning. > I do not want to implement this in the Model class (using > Model.to_python or Model.formfield for example), because the > information displayed in the columns of changelist_view page are > enough for the 90% of the times, so I prefer to do the extra work > necessary to generate the strings only when requested thus avoiding > the overhead necessary to select the correct string to be wasted in > most cases. > > So I was in doubt whether to override the ModelAdmin,get_form or some > _get_val_from_obj for some fields from the ModelAdmin.form. > > Which one is more correct in your opinion? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
OneToOneField in "Dynamic Model" referencing another dynamic model.
greetings. I am using the admin interface to show data retrieved by a collector process and put in a different table for each source; each source is identified by "cliente", "num1" and "num2". At run time django scans the db for tables with proper names and builds classes modeled from an abstract template. The code will make everything clearer: class Telefonate(models.Model): id = models.BigIntegerField(unique=True, primary_key=True) # some other fields here class Meta: abstract = True def telefonate_factory(cliente, num1, num2): if type(num1) != type(''): raise TypeError('parameter client1 must be of type %s insted of %s' % (type(''), type(cliente))) if type(num2) != type(''): raise TypeError('parameter client2 must be of type %s insted of %s' % (type(''), type(cliente))) if type(cliente) != type(''): raise TypeError('parameter num must be of type %s insted of %s' % (type(''), type(num))) cliente = str(cliente).lower() nome = 'Telefonate%s%s%s' % (cliente.capitalize(), num1, num2) ret = type(nome, (Telefonate,), {'__module__': Telefonate.__dict__['__module__']}) ret._meta.db_table= 'telefonate_%s_%s_%s' % (cliente, num1, num2) ret._meta.verbose_name= 'telefonate di %s-%s-%s' % (cliente.capitalize().replace('_', ' '), num1, num2) ret._meta.verbose_name_plural = 'telefonate di %s-%s-%s' % (cliente.capitalize().replace('_', ' '), num1, num2) return ret from django.db import connection, transaction, connections extractor = re.compile(r'^telefonate_([a-z_]+?)_(\d+)_(\d+)$') for db in settings.DATABASES.keys(): conn = connections[db] cursor = conn.cursor() cursor.execute('SHOW TABLES LIKE "telefonate_%%"') for t in cursor.fetchall(): vals = extractor.search(str(t[0])).groups() globals()['Telefonate' + vals[0].capitalize() + vals[1] + vals[2]] = telefonate_factory(vals[0], vals[1], vals[2]) Then my problem: class Blocks is an abstract class, being used as class telefonate. Each class Blocks/cliente/num1/num2 has a OneToOneField related to the corresponding class Telefonate/cliente/num1/num2: how to write class Blocks? in particular the OneToOneField? class Blocchi(models.Model): call = models.OneToOneField(Telefonate, unique=True, primary_key=True) block_start = models.IntegerField() block_end = models.IntegerField() class Meta: db_table = u'blocchi' verbose_name_plural = 'blocchi' abstract = True ordering = ['call'] -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
django, celery and mysql: Lost connection to MySQL server during query
Using django 1.2.3 with celery 2.0.3 and django-celery 2.0.3 and mysql 5.1.41 on kubuntu 10.04, I receive the following error: OperationalError(2013, 'Lost connection to MySQL server during query'). The error occurs every time the task is executed and seems to be related to the execution time, in fact when I process smaller files (let's say 8000 lines) everything is fine and task ends with success. The current files count about 242000 lines and execution started at 13:17:01 and failed at 16:08:47. I noticed using htop that cpu load is about 100% on both cores; (Intel(R) Xeon(R) CPU 3040 @ 1.86GHz). Could this cause the mysql error 2013? The python code is quite long, and I am not copying it here because the error is mysql related... Does anybody have any ideas? [2010-10-09 15:50:15,265: ERROR/MainProcess] Task igs.tasks.advanced_statistics[e886e849-cfcc-42b9-a171-0a2d56778f6b] raised exception: OperationalError(2013, 'Lost connection to MySQL server during query') Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/worker/job.py", line 86, in execute_safe return self.execute(*args, **kwargs) File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/worker/job.py", line 101, in execute return super(WorkerTaskTrace, self).execute() File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/execute/trace.py", line 62, in execute retval = self._trace() File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/execute/trace.py", line 76, in _trace return handler(trace.retval, trace.exc_type, trace.tb, trace.strtb) File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/worker/job.py", line 122, in handle_failure exc = self.task.backend.mark_as_failure(self.task_id, exc, strtb) File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/backends/base.py", line 46, in mark_as_failure traceback=traceback) File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/backends/base.py", line 152, in store_result return self._store_result(task_id, result, status, traceback) File "/usr/local/lib/python2.6/dist-packages/django_celery-2.0.3-py2.6.egg/djcelery/backends/database.py", line 12, in _store_result traceback=traceback) File "/usr/local/lib/python2.6/dist-packages/django_celery-2.0.3-py2.6.egg/djcelery/managers.py", line 42, in _inner transaction.rollback_unless_managed() File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/db/transaction.py", line 188, in rollback_unless_managed connection._rollback() File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/db/backends/mysql/base.py", line 306, in _rollback BaseDatabaseWrapper._rollback(self) File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/db/backends/__init__.py", line 36, in _rollback return self.connection.rollback() OperationalError: (2013, 'Lost connection to MySQL server during query') skype: masdero, icq: 473891447, yim: mas_dero, msn: mas_d...@hotmail.com Mi scriva in italiano; Write me in English; Skribu al mi Esperante! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django, celery and mysql: Lost connection to MySQL server during query
On Sun, Oct 10, 2010 at 17:12, Erik Cederstrand wrote: > > * Are you keeping a connection open to MySQL the whole time? I do not know what is the default behaviour of django, but I did not specify any custom option. > * What are the values of your timeout settings in the MySQL server configuration? Here is the my.cnf without comments for brevity's sake: [client] port= 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice= 0 [mysqld] user= mysql socket = /var/run/mysqld/mysqld.sock port= 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp skip-external-locking key_buffer = 16M max_allowed_packet = 16M thread_stack= 192K thread_cache_size = 8 myisam-recover = BACKUP query_cache_limit = 1M query_cache_size= 16M general_log_file= /var/log/mysql/mysql.log general_log = 1 log_error= /var/log/mysql/error.log log_slow_queries= /var/log/mysql/mysql-slow.log long_query_time = 2 log-queries-not-using-indexes expire_logs_days= 10 max_binlog_size = 100M binlog_do_db= include_database_name binlog_ignore_db= include_database_name [mysqldump] quick quote-names max_allowed_packet = 16M [isamchk] key_buffer = 16M !includedir /etc/mysql/conf.d/ > * Anything in the MySQL server error log? nothing unusual in the error log, just the log coming from the two /etc/init.d/mysql.d restart I issued today. > * Anything in the MySQL slow query log, if you have that set up? Yes I set it up. Lots of query issued by my program are in the query log, with no errors reported. the last one is at 16:08:34 and the error was returned at 16:08:47. > * Which process(es) on the server is using 100% CPU time? directly from htop: PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 544 mader 20 0 969M 953M 1444 R 96.0 47.4 50:09.85 python ./manage.py celeryd -l warning > I suspect that you're opening a connection to the server, > doing something in Django for a long time, and then > trying to use the connection. At this point MySQL has > lost patience and closed the connection. The db is queried by my code often: the maximum time between two successive queries is no more than 10 seconds, the source of this info is mysql-slow.log. Again, I do not know how django handles connections... The python function / task raising this error is part of a billing program. The task elaborates a csv file with the calls made by the customers: each call "searches" the db for info about the calling number owner and the cost of the called number and other things. Through empirical tests, I noticed that the error raises after about 165000 lines(=calls) are elaborated (the file usually contains about 245000), but everything is fine with fewer. One solution could be splitting the file in pieces and then unifying the results but it's not understanding and solving the problem, but just circumventing it... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django, celery and mysql: Lost connection to MySQL server during query
I raised the log level to debug: ./manage.py celeryd -l debug That's the new piece of information: Out of memory (Needed 24492 bytes) Out of memory (Needed 24492 bytes) Out of memory (Needed 24492 bytes) Out of memory (Needed 24492 bytes) Out of memory (Needed 24492 bytes) Out of memory (Needed 24492 bytes) Out of memory (Needed 16328 bytes) Out of memory (Needed 16328 bytes) Out of memory (Needed 16328 bytes) Out of memory (Needed 16328 bytes) Out of memory (Needed 16328 bytes) Out of memory (Needed 16328 bytes) Out of memory (Needed 8164 bytes) Out of memory (Needed 8164 bytes) Out of memory (Needed 8164 bytes) Out of memory (Needed 8164 bytes) Out of memory (Needed 8164 bytes) Looks suspiciously like a memory leak... On Sun, Oct 10, 2010 at 19:26, Erik Cederstrand wrote: > > Den 10/10/2010 kl. 17.55 skrev Massimiliano della Rovere: >> > * Which process(es) on the server is using 100% CPU time? >> directly from htop: >> PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command >> 544 mader 20 0 969M 953M 1444 R 96.0 47.4 50:09.85 python >> ./manage.py celeryd -l warning > > This, and the fact that you have no errors or seriously long queries in your > slow query log, indicates that the MySQL server is operating fine. > > Something seems to be timing out on the MySQL side. I'm not sure if you > mentioned it, but are these InnoDB tables? The stack trace you posted is in > the rollback of a transaction. It's possible that everything is running > within the same transaction which MySQL is shutting down at some point. Try > this: > > SQL> show variables where variable_name LIKE '%timeout%'; > > to see the values in your current server instance. > > If nothing suspicious turns up, I guess it's time to follow the stack trace > into the celery source code or where your own code calls celery and add some > debugging. Maybe it's a specific query that trips the code. Maybe it's a > specific number of queries. Maybe it's at a specific timespan after > connecting to MySQL. > > Thanks, > Erik -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: AJAX Autocompletion Field
I'd use http://dajaxproject.com/ On Sun, Feb 14, 2010 at 06:36, Margie Roginski wrote: > Hi Jon, > > I have used this very successfully: > > http://loopj.com/2009/04/25/jquery-plugin-tokenizing-autocomplete-text-entry/ > > The demo is here: > > http://loopj.com/tokeninput/demo.html > > One thing that differentiates it from the jquery autocomplete package > is that it allows you to specify multiple selections, which was > something I needed. It also comes with css that gives it a very nice > look and feel. > > I had almost no jquery experience at the time I started with it and > was able to get it to work very well. That said, there are a bunch of > people that continue to ask for help or report problems, and the > author doesn't really seem to respond, so it is not well supported and > if you need enhancements, you have to dive in and understand the code. > > Margie > > > > > On Feb 13, 2:46 pm, Jon Loeliger wrote: >> Folks, >> >> For likely the umpteenth time, can someone recommend a good >> AJAX auto completion tutorial or example that I might use >> to crib-together a text-field selection that would otherwise >> be a very large drop-down selection field? >> >> My use case would be essentially like having a table full >> of say, recipie ingredients, and letting the user select >> which one to add into a recipe. I'd like to have the user >> simply start typing a few first characters and then let an >> autocompleter search for matches and present them to the user. >> The source of the matches would be a "Name" TextField in >> some model. >> >> What is the current Best Practice or even Good Advice? :-) >> Pros and cons for jQuery or extjs or something else? >> A good "How To" or a pointer to a write up? >> >> Thanks, >> jdl > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Any CRM based on django?
At work we are planning move from Sugar CRM PRO to something else free. I'd love moving to something python based, but it seems the only free and reliable solution is VTiger 5 written in php. Does anybody here know any CRM based on django? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Looking for a wiki or cms created with django
no it is just at pre alpha status. if you are searching for something in python, head towards OpenErp else vtiger + media wiki us a solution or as soon as we will resolve our problems here with migration from sugar to vtiger, I will start writing a crm in django (or grok+zope3) tailored for our needs, but we could start a project :) On Tue, Feb 23, 2010 at 22:59, piz...@gmail.com wrote: > First google result for "django cms": > > http://www.django-cms.org/ > > Hope this is what you need :) > > El 23/02/2010, a las 22:53, Adrian Maier escribió: > >> Hello all, >> >> I am looking for a solution for creating a website that : >> - is a presentation for a company >> - the contents is editable in wiki-style >> - allows full control over the template used by each page >> - has search capabilities >> - is preferably implemented with django >> >> So I am basically looking for a content management system that >> works like a wiki : only a limited number of users that can authenticate >> and edit pages. The rest of the world should not be aware that the >> website is a wiki : no user registration, no editing, no page history, >> and not even 'edit' links for the non-authenticated users . >> >> Does anyone happen to know about a project similar to what >> i've described above ? >> >> >> Cheers, >> Adrian M. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-us...@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Row Level Permissions?
Row Level Permissions work perfectly: http://code.djangoproject.com/wiki/RowLevelPermissions On Thu, Mar 11, 2010 at 14:21, Rodrigo Cea wrote: > What's the current state of the art for Row Level Permissions? > > I need to set permissions for users on a MPTT-based page tree, where > each user will be allowed to edit only a specific branch, using the > admin. > > I found this: http://www.djangosnippets.org/snippets/1054/, which > might work, but wonder if there's a more standard way to do it. > > Rodrigo > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How to integrate a two step admin-action in the admin pages layout
I am writing a two step admin action: 1) select the items you want to mass-modify and click the action 2) enter the values that will be processed for each selected item 3) finally go back to the item list page with a user_message informing her/him about the outcome. I am trying to create a template so that the page in line #2 will have the same layout as admin pages, and I "took" the basic page code from %djangopath%/django/contrib/admin/templates/admin/change_form.html How can I pass my view the context text data for breadcrumbs, apply/cancel buttons and so on? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django SMTP and SPA
i think the python modules - smtplib - email will help. Have you already tried these ones? On Tue, Apr 13, 2010 at 14:58, Alex wrote: > Hi. > Can anybody suggest an idea how to deal with SMTP server with Secure > Password Authentication in Django? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django SMTP and SPA
http://docs.python.org/library/smtplib.html http://docs.python.org/library/email.html and probably something like (python 3 code): # msg, sender and receiver are unicode objects! import smtplib from email.mime.text import MIMEText MIME = MIMEText(msg.encode(CODEC)) MIME['From'] = sender.encode(CODEC) MIME['To'] = receiver.encode(CODEC) MIME.set_charset(CODEC) server = smtplib.SMTP(mail_server_ip) #server.set_debuglevel(True) server.sendmail(sender.encode(CODEC), receiver.encode(CODEC), MIME.as_string()) server.quit() On Wed, Apr 14, 2010 at 11:26, Alex wrote: > No. > I've just googled a bit for SPA, SPA+python. But I did not find > anything helpfull. > > On 13 апр, 18:44, Massimiliano della Rovere > wrote: >> i think the python modules >> - smtplib >> - email >> will help. Have you already tried these ones? >> >> On Tue, Apr 13, 2010 at 14:58, Alex wrote: >> > Hi. >> > Can anybody suggest an idea how to deal with SMTP server with Secure >> > Password Authentication in Django? >> >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "Django users" group. >> > To post to this group, send email to django-us...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > django-users+unsubscr...@googlegroups.com. >> > For more options, visit this group >> > athttp://groups.google.com/group/django-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
problems with FormWizard
My form wizard is initially composed of 2 forms. In form1 the users selects an event he wishes to attend to, enters his name and surname etc and how many guests he will bring form2 tells how to pay, but it is a template / dummy form, necessary because I do not want the form wizard to end after just 1 page (and it should contain the payment info for the event selected in form1) So, after submission of data in form1, the process_step function: - deletes form2, - inserts forms to enter data about each guest (so it is one form per guest) - inserts the form2 'rendered' with the details of the selected events. When the last page should be displayed (by the done method of FormWizard) I receive the following error: Step 2 does not exist I suppose that the operations I do on FormWizard.form_list are not allowed. Also it seems that the step variable from the FormWizard.process_step signature is 0 both at the 1st step and in the last one, but this could be an effct of my error. Does anybody know if I am doing anything forbidden with self.form_list? class WizardRegistrazione(FormWizard): def process_step(self, request, form, step): if step == 0: form.is_valid() self.form_list.pop() if (int(request.POST['0-num_invitati']) > 1) and (len(self.form_list) == 1): for i in range(int(request.POST['0-num_invitati']) - 1): self.form_list.append(generaPA()) self.form_list.append(generaFI(form.cleaned_data['evento'])) def done(self, request, form_list): return inserisci([form.cleaned_data for form in form_list]) Am I alloed to use self.form_list.append / pop? The generaPA and generaFI functions create a form class: def generaPA(): fields = SortedDict() fields.update(FormPersona().fields) del fields['azienda'] fields.update(FormAzienda().fields) return type('FormPA', (forms.BaseForm,), {'base_fields': fields}) def generaFI(evento_id): evento = Evento.objects.get(id=evento_id) fields = SortedDict() fields['istruzioni_per_il_pagamento'] = forms.CharField(widget=Readonly(), initial=mark_safe(settings.ISTRUZIONI.format(offerta_minima=evento.offerta_minima, evento=evento)), required=False) #fields['presa_visione'] = forms.BooleanField(initial=False, required=True) return type('FormFI', (forms.BaseForm,), {'base_fields': fields}) And here is the Readonly field: class Readonly(forms.Widget): def __init__(self, tag='div', attrs=None): tags = ('div', 'p', 'span') if tag not in tags: raise Exception('Unsupported tag %s. Tag should be one of %s' % (tag, tags)) self._tag = tag super(Readonly, self).__init__(attrs) def render(self, name, value, attrs=None): if value is None: value = '' final_attrs = self.build_attrs(attrs, name=name) del final_attrs['name'] return mark_safe(u'<%s%s>%s' % (self._tag, flatatt(final_attrs), conditional_escape(force_unicode(value)), self._tag)) Could the problem be caused by the fact of the Readonly field does not render an input field? (I need it to have a nice way to dispay payment info for the event) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: problems with FormWizard
I am resendin this email with dots instead of tabs in python code to overcome the automatic formatting of gmail sorry for the diuplication ;) My form wizard is initially composed of 2 forms. In form1 the users selects an event he wishes to attend to, enters his name and surname etc and how many guests he will bring form2 tells how to pay, but it is a template / dummy form, necessary because I do not want the form wizard to end after just 1 page (and it should contain the payment info for the event selected in form1) So, after submission of data in form1, the process_step function: - deletes form2, - inserts forms to enter data about each guest (so it is one form per guest) - inserts the form2 'rendered' with the details of the selected events. When the last page should be displayed (by the done method of FormWizard) I receive the following error: Step 2 does not exist I suppose that the operations I do on FormWizard.form_list are not allowed. Also it seems that the step variable from the FormWizard.process_step signature is 0 both at the 1st step and in the last one, but this could be an effct of my error. Does anybody know if I am doing anything forbidden with self.form_list? class WizardRegistrazione(FormWizard): ..def process_step(self, request, form, step): if step == 0: ..form.is_valid() ..self.form_list.pop() ..if (int(request.POST['0-num_invitati']) > 1) and (len(self.form_list) == 1): for i in range(int(request.POST['0-num_invitati']) - 1): ..self.form_list.append(generaPA()) ..self.form_list.append(generaFI(form.cleaned_data['evento'])) ..def done(self, request, form_list): return inserisci([form.cleaned_data for form in form_list]) Am I allowed to use self.form_list.append / pop? The generaPA and generaFI functions create a form class: def generaPA(): ..fields = SortedDict() ..fields.update(FormPersona().fields) ..del fields['azienda'] ..fields.update(FormAzienda().fields) ..return type('FormPA', (forms.BaseForm,), {'base_fields': fields}) def generaFI(evento_id): ..evento = Evento.objects.get(id=evento_id) ..fields = SortedDict() ..fields['istruzioni_per_il_pagamento'] = forms.CharField(widget=Readonly(), initial=mark_safe(settings.ISTRUZIONI.format(offerta_ minima=evento.offerta_minima, evento=evento)), required=False) ..return type('FormFI', (forms.BaseForm,), {'base_fields': fields}) And here is the Readonly field: class Readonly(forms.Widget): ..def __init__(self, tag='div', attrs=None): tags = ('div', 'p', 'span') if tag not in tags: ..raise Exception('Unsupported tag %s. Tag should be one of %s' % (tag, tags)) self._tag = tag super(Readonly, self).__init__(attrs) ..def render(self, name, value, attrs=None): if value is None: ..value = '' final_attrs = self.build_attrs(attrs, name=name) del final_attrs['name'] return mark_safe(u'<%s%s>%s' % (self._tag, flatatt(final_attrs), conditional_escape(force_unicode(value)), self._tag)) Could the problem be caused by the fact of the Readonly field does not render an input field? (I need it to have a nice way to dispay payment info for the event) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: problems with FormWizard
It seems like a threading problem. In fact if I comment out the two following lines in the apache VirtualHost file WSGIDaemonProcess dashboard.habble.it processes=5 threads=1 display-name=%{GROUP} WSGIProcessGroup dashboard.habble.it I receive no longer the error, but somehow the information about the number of forms in the FormWizard.form_list is "remembered" by apache: I mean after completing one booking for an event with one guest (so it is 3 forms), I close the browser. Then I launch a different browser, and my app show itself to me already with 3 steps instead of 2 as it should be! Could it be a server caching issue? On Fri, Apr 16, 2010 at 18:30, Massimiliano della Rovere < massimiliano.dellarov...@gmail.com> wrote: > I am resendin this email with dots instead of tabs in python code to > overcome the automatic formatting of gmail > sorry for the diuplication ;) > > > > > My form wizard is initially composed of 2 forms. > > In form1 the users selects an event he wishes to attend to, enters his > name and surname etc and how many guests he will bring > form2 tells how to pay, but it is a template / dummy form, necessary > because I do not want the form wizard to end after just 1 page (and it > should contain the payment info for the event selected in form1) > > So, after submission of data in form1, the process_step function: > - deletes form2, > - inserts forms to enter data about each guest (so it is one form per > guest) > - inserts the form2 'rendered' with the details of the selected events. > > When the last page should be displayed (by the done method of > FormWizard) I receive the following error: > Step 2 does not exist > > I suppose that the operations I do on FormWizard.form_list are not allowed. > > Also it seems that the step variable from the FormWizard.process_step > signature is 0 both at the 1st step and in the last one, but this > could be an effct of my error. > > Does anybody know if I am doing anything forbidden with self.form_list? > > class WizardRegistrazione(FormWizard): > ..def process_step(self, request, form, step): > if step == 0: > ..form.is_valid() > ..self.form_list.pop() > ..if (int(request.POST['0-num_invitati']) > 1) and > (len(self.form_list) == 1): > for i in range(int(request.POST['0-num_invitati']) - 1): > ..self.form_list.append(generaPA()) > ..self.form_list.append(generaFI(form.cleaned_data['evento'])) > > ..def done(self, request, form_list): > return inserisci([form.cleaned_data for form in form_list]) > > Am I allowed to use self.form_list.append / pop? > > > The generaPA and generaFI functions create a form class: > def generaPA(): > ..fields = SortedDict() > ..fields.update(FormPersona().fields) > ..del fields['azienda'] > ..fields.update(FormAzienda().fields) > ..return type('FormPA', (forms.BaseForm,), {'base_fields': fields}) > > > def generaFI(evento_id): > ..evento = Evento.objects.get(id=evento_id) > ..fields = SortedDict() > ..fields['istruzioni_per_il_pagamento'] = forms.CharField(widget=Readonly(), > initial=mark_safe(settings.ISTRUZIONI.format(offerta_ > minima=evento.offerta_minima, evento=evento)), required=False) > ..return type('FormFI', (forms.BaseForm,), {'base_fields': fields}) > > > And here is the Readonly field: > class Readonly(forms.Widget): > ..def __init__(self, tag='div', attrs=None): > tags = ('div', 'p', 'span') > if tag not in tags: > ..raise Exception('Unsupported tag %s. Tag should be one of %s' % > (tag, tags)) > self._tag = tag > super(Readonly, self).__init__(attrs) > > ..def render(self, name, value, attrs=None): > if value is None: > ..value = '' > final_attrs = self.build_attrs(attrs, name=name) > del final_attrs['name'] > return mark_safe(u'<%s%s>%s' % (self._tag, flatatt(final_attrs), > conditional_escape(force_unicode(value)), self._tag)) > > Could the problem be caused by the fact of the Readonly field does not > render an input field? (I need it to have a nice way to dispay payment info > for the event) > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Giving up PHP. ...Can't decide between Django & Rails
Grok + zope3 could be a choice too. On Sat, Apr 17, 2010 at 05:39, hcarvalhoalves wrote: > Why do you have to "make a choice"? Learn both. They can be useful in > many different ways. > > I learned Rails (and Ruby) before Django, because I saw some material > for Ruby that got me interested in hacking on it. Some time later, > Rails got really popular. Then lately I learned Python and Django, and > I've been working with it professionally for 2 years now. > > Now I don't have much more interest in Rails anymore, because Django > seems to cover all you can do with Rails, plus the benefits of Python > (you have a faster language, with more libraries and in a more mature > state). Syntax and all for more is close to irrelevant - what matters > is productivity. Some people will get you into religious wars about > blocks, or test driven frameworks, or whatever is the trend... skip > over those. > > I would recommend learning other frameworks too. Python got a big > share of web frameworks, that have their own focus on a particular > structure - some can be better for REST APIs than Django, for example. > [1] Ruby also got other frameworks than Rails, but they shine a little > less. > > Also, I would recommend you to learn *the language* first, and using > the framework to play with it. Make sure you don't use this mindset of > "I'm sick of PHP - let me find a magic framework", otherwise you won't > get much further the 15 minutes blog tutorials. Real web applications > will still require a lot of your own components and glue code for the > framework, in addition to your domain logic. > > Having said that, Rails is quite limiting, but still a good choice. > > [1] http://wiki.python.org/moin/WebFrameworks > > On 9 abr, 13:06, UnclaimedBaggage wrote: > > Hi folks, > > > > I'm a long-term (8 years) PHP developer who's recently started > > dabbling with Rails & Django. I REALLY like what I've seen from both > > frameworks and quite frankly, am a little miffed I didn't jump on the > > bandwagon earlier. > > > > I'm trying to decide between the two frameworks, but I'm > > struggling to get out of stalemate. If anyone can offer advice, I'd be > > very appreciative. Here are my current thoughts: > > > > WHAT I LIKE ABOUT DJANGO > > * I LOVE django-admin . For the sort of work I do, which is a lot of > > customised cart/cms stuff, this would save a lot of time. > > * Code reusability seems superior. Opinions? > > * Better perfomance? > > * I've half-built a shopping cart app in Django that I'm happy with. A > > quick dabble in Rails made this task seem a little more time- > > consuming, and I'm not comfortable with drop-in solutions > > * Server seems more stable. Using the rails dev server on a local > > linux box twice threw errors I couldn't trace, then worked fine again > > the next time I restarted my computer (having previously restarted the > > server with no result). Is this a common problem? > > > > WHAT I LIKE ABOUT RAILS > > * I prefer the syntax > > * There seems to be a lot more work for rails...with better pay > > * "Agile Rails" is a damn fantastic book. I haven't found much Django > > documentation I've enjoyed as much > > * Seems to be a little simpler > > * Seems to have a greater depth of features > > * Better AJAX integration from what I've seen > > > > Obviously I expect some django-tilted opinions here, but if anyone > > with > > experience in both can offer a balanced perspective on pros-n-cons of > > each it would be a big help. > > > > Cheers. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: I have a problem with the pagination with haystack and apache solr
What happens if you switch pagination off? On Mon, Apr 19, 2010 at 19:29, Ariel wrote: > Hi everybody: > I have a big problem with pagination using apache solr and haystack, this is > what it is happening: I have a site where the news are being indexing with > haystack and solr, but the problem is that when a I make the search the > pagination is showing me more match results that what really exists even > more results that total news in my database, for example I have only 20 news > in the database but when I make a search the pagination said 40 matching > results are found then when I navigate with the "next" link to see the other > results any result is showed. > > I hope I have made a good explanation of my problem. > Could you help me please ??? > I don't know why it is happening that > Regards. > Ariel -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Is South 0.7.1 ready for django1.2?
I found nowhere information about compliancy of South 0.7.1 to the multiDB support of django 1.2 Did I overlook anything? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Using external dbs... is django 1.2 the best solution?
I am developing a web site that has some of its models in a private database (the one specified in settings.py, populated by the admin interface) but, it has to fetch and filter (etc) data from 2 different databases that are populated (data is added but never modified or deleted) in real-time by external daemons, not parts of django. I was thinking to use the MySQLdb module, but it do not know if the result will be a mess considering: apache process and threads (deployment), the mod_wsgi, any parts of the threading module I could use. Furthermore, using querysets et similia would be really useful. So what is you opinion, should I switch to 1.2 trunk? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Using external dbs... is django 1.2 the best solution?
My deadline is 26th, May Anyway the program will constantly grow so, yes I've just finished adding some modifications to make it run on Dj1.2 On Wed, Apr 21, 2010 at 12:49, David De La Harpe Golden wrote: > On 21/04/10 11:21, Massimiliano della Rovere wrote: >> >> I am developing a web site that has some of its models in a private >> database (the one specified in settings.py, populated by the admin >> interface) but, it has to fetch and filter (etc) data from 2 different >> databases > >> So what is you opinion, should I switch to 1.2 trunk? >> > > IMO yes, basically. You can bodge some basic access to multiple databases > into django 1.1 as in e.g. [1], but it becomes terribly messy and isn't > worth it at this stage, so, um, don't look at [1]. Of course I don't know > what your timeframe is, but I'd guess 1.2 will be out by the time you're > ready to go to production anyway. > > [1] > http://groups.google.com/group/django-users/browse_thread/thread/da81fdee7b6b897a/c4da236c457e42e8 > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Dynamic Model and ModelAdmin based on tables in db
An external process creates tables whose names follow the pattern "collector_XYZ"; all the tables will have the very same structure. For each table I need to create a matching django.db.models.Model and django.admin.models.ModelAdmin, dynamically, because over time new tables will be created and I do not want to restart apache after the program is deployed. How can I hook this generation process to the login function of the admin interface so that each time a user logs in django checks if all the tables have a corresponding model? Is there a better mount point? Is there a more django-nic way to accomplish this? from django.db import connection, transaction, connections cursor = connections['collector'].cursor() cursor.execute('SHOW TABLES LIKE "collector_%%"') # table name: collector_identifier_nn # identitifer is unique among all the tables # nn is a two digit number models = {} for t in cursore.fetchall(): ..values = str(t).split('_')[1:] ..models[values[0]] = generaCollector(values[0], values[1]) ..admin.site.register(models[-1]) def generaCollector(cliente, num): ..if type(num) != type(''): raise TypeError('parameter client must be of type %s insted of %s' % (type(''), type(cliente))) ..if type(cliente) != type(''): raise TypeError('parameter num must be of type %s insted of %s' % (type(''), type(num))) ..cliente = str(cliente).lower() ..nome = 'Collector%s%s' % (cliente.capitalize(), num) ..ret = type(nome, (Collector,), {'__module__': Collector.__dict__['__module__']}) ..ret._meta.db_table = 'collector_%s_%s' % (cliente, num) ..return ret class Collector(models.Model): ..id = models.IntegerField(primary_key=True) ..unique_check = models.CharField(unique=True, max_length=240, blank=True) ..collector = models.CharField(max_length=96, blank=True) ..agent_host = models.CharField(max_length=384, blank=True) ..insert_time = models.DateTimeField(null=True, blank=True) ..# etc etc ..def __unicode__(self): return self.insert_time.isoformat() class Meta: ..db_table = u'collector' ..abstract = True -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: problem with apache and wsgi
does apache have the rights to open the file and enter the directories smedia and images? On Fri, Apr 23, 2010 at 10:45, Kenneth Gonsalves wrote: > hi, > > using django trunk on svn and the latest ubuntu with python 2.6. The setup is > this: > > MEDIA_ROOT = /home/user/media/ > MEDIA_URL = http://mysite/smedia/ > apache has: > Alias /smedia/ /home/user/media/ > > the uloaded file is in /home/user/media/images/pic.jpg > > apache cannot find the file. Page source shows the file as > http://mysite/smedia/images/pic.jpg > > but the apache error log shows: > /home/user/mediaimages/pic.jpg not found - note that the '/' between 'media' > and 'images' is missing. What can be the cause of this error? > > -- > regards > Kenneth Gonsalves > Senior Associate > NRC-FOSS > http://certificate.nrcfoss.au-kbc.org.in > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Admin custom filters
The filters are not documented. You can learn how they works, looking at the file DJANGO_PATH/contrib/admin/filterspecs.py I found DateFieldFilterSpec to be useful whenever you need to filter something that is in a range, not just for calendar matters. On Mon, May 3, 2010 at 23:23, Thales wrote: > Good evening, > > I am trying to create a custom filter in my admin. It should be in the > general page Modify. > > If a put in the filter_list the content 'project__year', it shows me > the years avaiable on the right menu and filters well. > > But I want to define the default value (the default year selected) and > the avaiable options (maybe I dont want to show all the years there). > > I am sorry it sounds very easy, but I couldn't find inside the > documentation how can I do it. > > Thanks > Thales > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How to alter the value of a field in admin pages and turn off-autoescaping
1st question) I am trying to change the way some of DateTimeField are displayed in the change_list page of the admin site (django 1.2 svn): how to do it? Not knowing which method to define or override in the ModelAdmin class, I opted for a different solution: I added a string in the list_display tuple and then I defined a homonimous method: list_display = ('x',) def x(self, row): return mark_safe(row.call_start.strftime(u'%Y-%m-%d%H:%M:%S')) 2nd question) why the "<>" signs in the strings are escaped in the change_list page even though they are marked safe? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to alter the value of a field in admin pages and turn off-autoescaping
I wanted the date in this format: %A %d %B %Y %H:%M:%S I found a solution to point #2: format_data = re.compile(r'(?<=\d)\s(?=[A-Za-z])|(?<=[A-Za-z])\s(?=\d)', re.LOCALE | re.UNICODE) list_display = ('x',) def x(self, row): return mark_safe(format_data.sub(' ', formats.localize(row.call_start))) x.allow_tags = True I still have to find out the solution to #1... On Wed, May 5, 2010 at 12:48, Massimiliano della Rovere wrote: > 1st question) I am trying to change the way some of DateTimeField are > displayed in the change_list page of the admin site (django 1.2 svn): > how to do it? > > Not knowing which method to define or override in the ModelAdmin > class, I opted for a different solution: > I added a string in the list_display tuple and then I defined a > homonimous method: > > list_display = ('x',) > > def x(self, row): > return mark_safe(row.call_start.strftime(u'%Y-%m-%d%H:%M:%S')) > > 2nd question) why the "<>" signs in the strings are escaped in the > change_list page even though they are marked safe? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Override widget for one specific field in admin change_list page
I'm trying to override the widget used in the changelist page for one field of a model. The field is updated by an external daemon and is defined as: ping_status = models.CharField(blank=True, max_length=1, editable=False) The field will contains one letter: G = OK, R = KO, O = Suspect I created and image corresponding to each letter (G => green.png etc) because I want the image be displayed in the changelist page instead of the letter. Can anybody tell me which method in ModelAdmin to override to have a hook to chang the used widget? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
problem with admin tools 2.0 when dashboard.columns > 2
When I set Dashboard.columns to a value greater than 2, custom dashboardmodules are rendered narrower than they should appear and with lots of icons superimpressed. I am adding 1 DashboardModule and 2 LinkListDashboardModule-s to the CustomIndexDashboard using init_with_context. class CustomIndexDashboard(Dashboard): """ Custom index dashboard for cruscotto. """ def __init__(self, **kwargs): kwargs['columns'] = 4 kwargs['title'] = 'Habble' Dashboard.__init__(self, **kwargs) # append an app list module for "Applications" self.children.append(AppListDashboardModule( title=_('Applications'), exclude_list=('django.contrib',), )) # append an app list module for "Administration" self.children.append(AppListDashboardModule( title=_('Administration'), include_list=('django.contrib',), )) def init_with_context(self, context): """ Use this method if you need to access the request context. """ utente = context['request'].user if utente.username in allowed_users: # code commented out [...] self.children.append(DashboardModule( title='block #1', children=children_1 )) self.children.append(LinkListDashboardModule( title='block 2', children=children_2 )) self.children.append(LinkListDashboardModule( title='block 3', children=children_3 )) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django 1.2.1 install in Ubuntu 10.04 via Synaptic?
or you can do the following tric: 1) install django sudo apt-get -y install python-django 2) now you have all the dependencies you need 3) sudo apt-get -y install python-setuptools 4) sudo apt-get remove python-django 5) sudo easy_install -Z django repeat step 5 after each release of django On Mon, May 31, 2010 at 16:20, Leonel Nunez wrote: > > I agree with you, Shawn. I just didn't want to push ahead with a manual > uninstall and install if more-experienced Ubuntu users thought I'd be > seeing Django 1.2.1 show up in the repository quickly. > > > > I'll give it a go. Thanks, > > > > > Ubuntu is a stable linux distribution. This means once a release is made, > NO new package versions will be included except for those microreleases : > > https://wiki.ubuntu.com/StableReleaseUpdates/MicroReleaseExceptions > > Django is in main section for Karmic,Lucid this means that you will have > official SECURITY updates as long as the ubuntu version does not get its > EOL ( karmic 18 months from release date and lucid 5 years) > > So you can deploy today with django 1.1.1 in lucid and your app will run > without changes for 5 years. > > If you want 1.2.1 wait for it gets into Maveric ( current devel version ) > and a backport can be done but this will not have oficial support. > > Or wait for someone to make a backport and keep it updated on launchpad PPA > > > Saludos > > Leonel > > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Error
Greetings Bruxo, I do not speak Portuguese but being Italian I understood more or less your post. It seems you included "django.contrib.blog" in settings.py, but there is no "blog" module inside django.contrib. If "blog" is the name of the module you are developing, just add 'blog' (not django.contrib.blog) inside the INSTALLED_APPS tuple in settings.py. I try in Italian too. Salve Bruxo, non parlo portogese ma essendo italiano ho più o meno capito il tuo post. Sembra che tu abbia incluso "django.contrib.blog" in settings.py, ma non esiste un modulo "blog" all'interno di django.contrib. Se "blog" è il nome del modulo che stai sviluppando, aggiungi "blog" (e non "django.contrib.blog) nella tupla INSTALLED_APPS in settings.py. 2010/5/31 Bruxo_Mor Juca : > Senhores, > > Preciso de ajuda no que se diz respeito a configuração do MANAGE.PY > estou com o seguinte erro: > > Error execute_manage.py(settings) > > Estou criando uma pagina, criei no arquivo de Setting.py a seguinte > definição: > > > 'django.contrib.blog'; inclui esta linha logo abaixo da linha > 'django.contrib.admin'; > > Sem a minha linha o site local funciona, quando coloco a minha linha > aparece o erro que citei acima. > > Se alguem puder me ajudar..agradeço. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there a way to add operations to an entity admin form?
well you can do it with a minimal overhead... copy the django/contrib/admin/templates/change_form.html file to your project/templates/admin/ folder. The line with {% submit_row %} is what your are searching for: add whatever you need. Unisng the context parameter, pass to render_change_form whatever you want to find in the change_form template. Remember to use mark_safe() Then in your model admin.py you can do also some dirty (well I advised you they are dirty) hacks like (in my case they works easily because I know that my app will run in Italian only: class ABCAdmin(admin.modelAdmin): def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None): ret = super(ABCAdmin, self).render_change_form(request, context, add, change, form_url, obj) # remove "add another" ret.content = ret.content.replace('', '') # remove "add and continue" ret.content = ret.content.replace('', '') # change the save button text to "send" ret.content = ret.content.replace('Salva', 'Invia') # add a link to import data using a csv (the link will point to a url that is mapped to a custom view) ret.content = ret.content.replace('Aggiungi messaggio inviato', 'Invia messaggio') return ret On Tue, Jun 1, 2010 at 11:07, gderazon wrote: > I would like to add my own custom operations in addition to standard > "save and add another", "save" etc' > Is it supported? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there a way to add operations to an entity admin form?
here is how I added the action to create new items in the Addressbook (Rubrica) to the normal change list existing admin page: in admin.py class RubricaAdmin(admin.ModelAdmin): list_display = ('cognome', 'nome', 'numero_cellulare',) list_filter = ('cognome', 'nome', 'numero_cellulare',) search_fields = ('cognome', 'nome',) @csrf_protect_m def changelist_view(self, request, extra_context=None): import re ret = super(RubricaAdmin, self).changelist_view(request, extra_context) ret.content = re.sub('(?<=\d )rubrìca', 'voci', ret.content) #note it is "importa_csv/" and not "/importa_csv/" ret.content = ret.content.replace('', 'Importa csv') return ret def importa_csv(self, request, queryset): pass class Media: css = {'all': ('habble-admin.css',)} in view.py # -*- coding: utf-8 -*- from django.http import HttpResponse from django.shortcuts import render_to_response from cruscotto.sms.models import Rubrica from cruscotto.sms.forms import * from django.utils.translation import ugettext_lazy as _ from django.utils.safestring import mark_safe from django.utils.encoding import force_unicode from django import template # Create your views here. def importa_csv(request): opts = Rubrica._meta app_label = opts.app_label queryset = Rubrica.objects.all() form = FormCSV_0() #modifiable_objects = [] #perms_needed = set() #i = 0 #for obj in queryset: #if request.user.has_perm('sms.change_rubrica'): #modifiable_objects.append(obj) #else: #perms_needed += 'sms.change_rubrica' context = { "title": _("Importa CSV"), "object_name": force_unicode(opts.verbose_name), #"deletable_objects": modifiable_objects, 'queryset': queryset, #"perms_lacking": perms_needed, 'has_change_permission': request.user.has_perm('sms.change_rubrica'), "opts": opts, #"root_path": self.admin_site.root_path, "app_label": app_label, #'action_checkbox_name': admin.ACTION_CHECKBOX_NAME, 'form': form.as_table(), 'form_url': '{url_scheme}://{h_p}/chpwd/'.format(url_scheme=request.META['wsgi.url_scheme'], h_p=request.META['HTTP_HOST']), } return render_to_response('importa_csv.html', context, context_instance=template.RequestContext(request)) in urls.py before the admin row: (r'^admin/sms/rubrica/importa_csv/', 'sms.views.importa_csv'), # nest inside admin interface! this is important for the ../ links in the template to work the template: {% extends "admin/base_site.html" %} {% load i18n admin_modify adminmedia %} {% block extrahead %}{{ block.super }} {{ media }} {% endblock %} {% block extrastyle %}{{ block.super }}{% endblock %} {% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %} {% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %} {% block breadcrumbs %}{% if not is_popup %} {% trans "Home" %} › {{ app_label|capfirst|escape }} › {% if has_change_permission %}{{ opts.verbose_name_plural|capfirst }}{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} {% endif %}{% endblock %} {% block content %} {{ form }} {% endblock %} On Tue, Jun 1, 2010 at 11:07, gderazon wrote: > I would like to add my own custom operations in addition to standard > "save and add another", "save" etc' > Is it supported? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How to dynamically set limit_choices_to for ManyToManyField using values from an instance?
When displayed in the Admin interfaces, I'd like to filter the values of n, so that instances of N already linked to other instances of A sharing the same instance of o are not shown: so when you edit an instance of A (let's call it "a"), you see only the instances of n in use by a and the unsed ones (in the context of o). The problem is that I am not allowd to write self.choices_for_n() Does anybody know any solution for this? class A(models.Model): o = models.ForeignKey(O) p = models.ManyToManyField(P) n = models.ManyToManyField(N, limit_choices_to=self.choices_for_n()) def choices_for_n(self): unwanted = [] for z in self.o.z_set.all(): if z.id == self.id: continue unwanted += [z.id for z in z.n] for n in N.objects.exclude(id__in=unwanted): yield n.id -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to dynamically set limit_choices_to for ManyToManyField using values from an instance?
Thanks Scott, I have one doubt though: I need a bound form to properly set the queryset. Using your method I'd use an unbound form, am I wrong? On Fri, Jun 4, 2010 at 14:33, Scott Gould wrote: > Create a ModelForm for your model (A), set the queryset to what you > want on the appropriate field (n), and then register that ModelForm > for admin use in your admins.py. > > Regards > Scott > > > On Jun 4, 6:14 am, Massimiliano della Rovere > wrote: >> When displayed in the Admin interfaces, I'd like to filter the values >> of n, so that instances of N already linked to other instances of A >> sharing the same instance of o are not shown: >> so when you edit an instance of A (let's call it "a"), you see only >> the instances of n in use by a and the unsed ones (in the context of >> o). >> >> The problem is that I am not allowd to write self.choices_for_n() >> >> Does anybody know any solution for this? >> >> class A(models.Model): >> o = models.ForeignKey(O) >> p = models.ManyToManyField(P) >> n = models.ManyToManyField(N, limit_choices_to=self.choices_for_n()) >> >> def choices_for_n(self): >> unwanted = [] >> for z in self.o.z_set.all(): >> if z.id == self.id: >> continue >> unwanted += [z.id for z in z.n] >> for n in N.objects.exclude(id__in=unwanted): >> yield n.id > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django + Ajax + Jquery
This is useful too: http://www.dajaxproject.com/ On Mon, Jun 7, 2010 at 07:57, Dmitry Dulepov wrote: > Hi! > > tazimk wrote: >> I want to use ajax in my templates using jquery. >> Can someone provide me some sample examples /links related to >> this. > > http://www.google.com/ may be? The question is too broad. > > -- > Dmitry Dulepov > Twitter: http://twitter.com/dmitryd/ > Web: http://dmitry-dulepov.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-us...@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. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Is there any kind of verbose_name for apps?
And if not how can I emulate 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-us...@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: Is there any kind of verbose_name for apps?
That's how I solved it, but I was wondering if there were something more official :) On Wed, Jun 16, 2010 at 20:27, patrickk wrote: > I don´t think there is (although this issue has already been discussed > years ago) - no ability to change apps-name and/or app-translations. > > you could use a 3rd-party-app like admin-tools to customize your index- > page and change appnames (see > http://bitbucket.org/izi/django-admin-tools/overview/). > > regards, > patrick > > On 16 Jun., 16:31, Massimiliano della Rovere > wrote: >> And if not how can I emulate 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-us...@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. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Queryset using group_by on different fields than the ones in the aggregation function
We have this model in module X: class A(models.Model): when = models.DateTimeField() type = models.CharField(max_length=10) subtype = models.CharField(max_length=10) data = models.CharField(max_length=100) I am trying to do something like: SELECT MAX(when), type, subtype, data FROM x_a GROUP_BY type, subtype That is the most recent record for each (type, subtype) pair. As far as I understood there is no way (maybe some undocumented feature...?) to specify a different set of fields for GROUP BY than the ones used in aggregation I need something like: A.objects.group_by('type', 'subtype').aggregate(Max(when)) Is there a way to solve this problem without using extra() ? -- 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.
AttributeError on _strptime_time
The error was trapped by django-sentry and does *not* occur in python interpreter, thus I can't understand it! Please can anybody enlighten me? Here the details: Exception Type: AttributeError Exception Value: _strptime_time The error is raised by line #698 in /usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/db/models/fields/__init__.py in to_python using django 1.2.5: 698. return datetime.datetime(*time.strptime(value, '%Y-%m-%d %H:%M:%S')[:6], 699. **kwargs) With local variables: kwargs = {'microsecond': 0} self = u'' usecs = 0 value = u'2011-02-24 00:00:00' -- 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: Creating REST APIs in Django...advice
https://bitbucket.org/jespern/django-piston/wiki/Home skype: masdero, icq: 473891447, yim: mas_dero, msn: mas_d...@hotmail.com Mi scriva in italiano; Write me in English; Skribu al mi Esperante! On Tue, Apr 12, 2011 at 10:07, Mazery Smith wrote: > Hello, > So can anyone here recommend some REST packages/tools you use with > Django and have a good experience with? > > I'm interested to know b/c it seems like most of the popular RESTful > Django projects really stopped being very active around mid-2008. > > I'm wondering if that's because most people just build their own. > > -- > 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. > > -- 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: Using Q objects vs explicit filters
what about Parent.objects.filter(~q) ? On Thu, Apr 14, 2011 at 11:08, Gianluca Sforna wrote: > On Wed, Apr 13, 2011 at 3:43 PM, Brian Bouterse wrote: >> Could you include the output to highlight the differences? > > I've just created a simpler test case. I've a couple models like: > > class Parent(models.Model): > name = models.CharField(max_length=200, db_index=True) > > class Child(models.Model): > parent = models.ForeignKey('Parent') > gender = models.CharField(max_length=1) > > Now let's filter them (I'm doing this in the ipython shell): > > In [11]: f1 = Parent.objects.filter(child__gender='f') > In [12]: print f1.query > SELECT "molserv_parent"."id", "molserv_parent"."name" FROM > "molserv_parent" INNER JOIN "molserv_child" ON ("molserv_parent"."id" > = "molserv_child"."parent_id") WHERE "molserv_child"."gender" = f > > Now the same with a Q object: > > In [13]: q = Q(child__gender='f') > In [14]: f2 = Parent.objects.filter(q) > In [15]: print f2.query > SELECT "molserv_parent"."id", "molserv_parent"."name" FROM > "molserv_parent" INNER JOIN "molserv_child" ON ("molserv_parent"."id" > = "molserv_child"."parent_id") WHERE "molserv_child"."gender" = f > > So far, so good, they are the same. Now I'll replace filter with exclude: > > In [16]: f1 = Parent.objects.exclude(child__gender='f') > In [17]: print f1.query > SELECT "molserv_parent"."id", "molserv_parent"."name" FROM > "molserv_parent" WHERE NOT ("molserv_parent"."id" IN (SELECT > U1."parent_id" FROM "molserv_child" U1 WHERE (U1."gender" = f AND > U1."parent_id" IS NOT NULL))) > > In [18]: f2 = Parent.objects.exclude(q) > In [19]: print f2.query > SELECT "molserv_parent"."id", "molserv_parent"."name" FROM > "molserv_parent" INNER JOIN "molserv_child" ON ("molserv_parent"."id" > = "molserv_child"."parent_id") WHERE NOT ("molserv_child"."gender" = f > ) > > So only the second (Q based) filter in this case works for me. For the > records, this is with Django 1.2.5 in Fedora 14 > > -- > Gianluca Sforna > > http://morefedora.blogspot.com > http://identi.ca/giallu - http://twitter.com/giallu > > -- > 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. > > -- 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: urls
I think your case is #2 in https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#redirect skype: masdero, icq: 473891447, yim: mas_dero, msn: mas_d...@hotmail.com Mi scriva in italiano; Write me in English; Skribu al mi Esperante! On Thu, Jul 14, 2011 at 10:13, NISA BALAKRISHNAN wrote: > i am new to django. > > i have a very simple question. > wht is the url i need to give to httpresponseredirect() to load my > home page with url http://127.0.0.1:8000/ > my urls.py looks like dis: > > urlpatterns = patterns('', > # Examples: > url(r'^$', 'person.views.home', name='home'), > url(r'^edit/$', 'person.views.edit', name='edit'), > > #url(r'^persons/$', 'person.views.index', name='index'), > # url(r'^mysite/', include('mysite.foo.urls')), > > # Uncomment the admin/doc line below to enable admin > documentation: > # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), > > # Uncomment the next line to enable the admin: > url(r'^admin/', include(admin.site.urls)), > > > ) > > -- > 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. > > -- 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.