Re: Integrating GeoDjango with Esri API
Not looking for a general intro to geodjango, but rather what I asked. Thanks anyway. Saludos, *Rodrigo Culagovski* Director +569 7667 0402 H98R+8C Santiago On Fri, 20 Nov 2020 at 17:55, Dhruvil Shah wrote: > I don't think. so, it's basic project on how to use it and also find > distance from your current location to what u write in text box. > > On Sat, 21 Nov 2020, 01:58 Rodrigo Culagovski, wrote: > >> Does it connect to ESRI services? I can't find any reference to that in >> the video, and that's what I specifically need. >> >> Saludos, >> *Rodrigo Culagovski* >> Director >> +569 7667 0402 >> H98R+8C Santiago >> >> >> >> On Fri, 20 Nov 2020 at 15:43, Dhruvil Shah wrote: >> >>> You can follow this YouTuber he has made a project on GeoDjango. >>> >>> https://youtu.be/_KIMevaubfQ >>> >>> >>> On Fri, 20 Nov 2020, 18:29 Rodrigo Cea, wrote: >>> >>>> I'm developing a mapping website. I will be consuming map layers from >>>> ESRI Online. I see they have a fairly sophisticated Python API. The site >>>> will be django based. I wonder how easy it would be to use GeoDjango for >>>> local storage and editing of geographical data as well as other, not >>>> geolocated info, and using the ESRI api to sync it to ESRI's servers and >>>> generate maps? >>>> >>>> Using ESRI maps and interacting with other ESRI based sites is a client >>>> requirement, and non-negotiable. >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Django users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to django-users+unsubscr...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/django-users/1a346478-d46a-43d7-9621-3a1859133774n%40googlegroups.com >>>> <https://groups.google.com/d/msgid/django-users/1a346478-d46a-43d7-9621-3a1859133774n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Django users" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/django-users/W4ps2dL4er0/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> django-users+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/CADsP_izDws3Msb0uRdvkt1zi0FFPvKN8h8A8RHnE_PfXbBq_MQ%40mail.gmail.com >>> <https://groups.google.com/d/msgid/django-users/CADsP_izDws3Msb0uRdvkt1zi0FFPvKN8h8A8RHnE_PfXbBq_MQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CALU%3DqNN3o9ojR5AuVrp%3DoAFpOUkS2%2Bh%2B9get_3%2B2U54Qkpk2Ug%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CALU%3DqNN3o9ojR5AuVrp%3DoAFpOUkS2%2Bh%2B9get_3%2B2U54Qkpk2Ug%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/W4ps2dL4er0/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CADsP_iy%2BX3Ye08yVR22PaFoRNv-QL%2BfegBr9ieAZkWQWCWD67Q%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CADsP_iy%2BX3Ye08yVR22PaFoRNv-QL%2BfegBr9ieAZkWQWCWD67Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALU%3DqNOkhg_yqtXtJ_eTTvKtcFNfmOYMXQDGH13N6LmzdGfdEw%40mail.gmail.com.
Re: Integrating GeoDjango with Esri API
Great, thanks. Saludos, *Rodrigo Culagovski* Director +569 7667 0402 H98R+8C Santiago On Fri, 20 Nov 2020 at 18:26, Mohammed Alnajdi wrote: > Yes it does. It connects to the Esri WMS. if you actually read the docs > enough you will find it. > > On Fri, Nov 20, 2020 at 9:33 PM Rodrigo Culagovski > wrote: > >> Does it connect to ESRI services? I can't find any reference to that on >> their site, and that's what I specifically need. >> >> Saludos, >> *Rodrigo Culagovski* >> Director >> +569 7667 0402 >> H98R+8C Santiago >> >> >> >> On Fri, 20 Nov 2020 at 14:37, Mohammed Alnajdi >> wrote: >> >>> You might want to check out the GeoNode project. >>> >>> Sent from my iPhone >>> >>> On 20 Nov 2020, at 3:58 PM, Rodrigo Cea wrote: >>> >>> I'm developing a mapping website. I will be consuming map layers from >>> ESRI Online. I see they have a fairly sophisticated Python API. The site >>> will be django based. I wonder how easy it would be to use GeoDjango for >>> local storage and editing of geographical data as well as other, not >>> geolocated info, and using the ESRI api to sync it to ESRI's servers and >>> generate maps? >>> >>> Using ESRI maps and interacting with other ESRI based sites is a client >>> requirement, and non-negotiable. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-users+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/1a346478-d46a-43d7-9621-3a1859133774n%40googlegroups.com >>> <https://groups.google.com/d/msgid/django-users/1a346478-d46a-43d7-9621-3a1859133774n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Django users" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/django-users/W4ps2dL4er0/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> django-users+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/649D465B-F799-4D4E-BACB-F3D165A7BA0A%40gmail.com >>> <https://groups.google.com/d/msgid/django-users/649D465B-F799-4D4E-BACB-F3D165A7BA0A%40gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CALU%3DqNMf9SJPYObpj5fbGmnfG2hfr_Yg8kEfZzPdn7nQ9oFyhQ%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CALU%3DqNMf9SJPYObpj5fbGmnfG2hfr_Yg8kEfZzPdn7nQ9oFyhQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/W4ps2dL4er0/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAOu2D2s%3DYxCDH94cjwk-CZ02WMhwsTz_MvXCrNJiubqP_z677Q%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAOu2D2s%3DYxCDH94cjwk-CZ02WMhwsTz_MvXCrNJiubqP_z677Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALU%3DqNNC1%2B1HnYS_5ZkJNgYvKV0BnZVj6FR1LoTZpVtuwabsHQ%40mail.gmail.com.
Re: Integrating GeoDjango with Esri API
Does it connect to ESRI services? I can't find any reference to that in the video, and that's what I specifically need. Saludos, *Rodrigo Culagovski* Director +569 7667 0402 H98R+8C Santiago On Fri, 20 Nov 2020 at 15:43, Dhruvil Shah wrote: > You can follow this YouTuber he has made a project on GeoDjango. > > https://youtu.be/_KIMevaubfQ > > > On Fri, 20 Nov 2020, 18:29 Rodrigo Cea, wrote: > >> I'm developing a mapping website. I will be consuming map layers from >> ESRI Online. I see they have a fairly sophisticated Python API. The site >> will be django based. I wonder how easy it would be to use GeoDjango for >> local storage and editing of geographical data as well as other, not >> geolocated info, and using the ESRI api to sync it to ESRI's servers and >> generate maps? >> >> Using ESRI maps and interacting with other ESRI based sites is a client >> requirement, and non-negotiable. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/1a346478-d46a-43d7-9621-3a1859133774n%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/1a346478-d46a-43d7-9621-3a1859133774n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/W4ps2dL4er0/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CADsP_izDws3Msb0uRdvkt1zi0FFPvKN8h8A8RHnE_PfXbBq_MQ%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CADsP_izDws3Msb0uRdvkt1zi0FFPvKN8h8A8RHnE_PfXbBq_MQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALU%3DqNN3o9ojR5AuVrp%3DoAFpOUkS2%2Bh%2B9get_3%2B2U54Qkpk2Ug%40mail.gmail.com.
Re: Integrating GeoDjango with Esri API
Does it connect to ESRI services? I can't find any reference to that on their site, and that's what I specifically need. Saludos, *Rodrigo Culagovski* Director +569 7667 0402 H98R+8C Santiago On Fri, 20 Nov 2020 at 14:37, Mohammed Alnajdi wrote: > You might want to check out the GeoNode project. > > Sent from my iPhone > > On 20 Nov 2020, at 3:58 PM, Rodrigo Cea wrote: > > I'm developing a mapping website. I will be consuming map layers from > ESRI Online. I see they have a fairly sophisticated Python API. The site > will be django based. I wonder how easy it would be to use GeoDjango for > local storage and editing of geographical data as well as other, not > geolocated info, and using the ESRI api to sync it to ESRI's servers and > generate maps? > > Using ESRI maps and interacting with other ESRI based sites is a client > requirement, and non-negotiable. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/1a346478-d46a-43d7-9621-3a1859133774n%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/1a346478-d46a-43d7-9621-3a1859133774n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/W4ps2dL4er0/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/649D465B-F799-4D4E-BACB-F3D165A7BA0A%40gmail.com > <https://groups.google.com/d/msgid/django-users/649D465B-F799-4D4E-BACB-F3D165A7BA0A%40gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALU%3DqNMf9SJPYObpj5fbGmnfG2hfr_Yg8kEfZzPdn7nQ9oFyhQ%40mail.gmail.com.
Related articles based on keywords.
I am developing a site for an academic publication that contains a few thousand articles. Each Article has a ManyToMany relationship with one or more Keywords from a controlled vocabulary. In the view for a single article, I would like to be able to pull up related articles based on shared keywords. Just pulling up all the articles that share at least one keyword would be to imprecise. What I'd like to do is use some sort of weighting algorithm, so that if there are articles that share 5 keywords they get pulled up while ones that only share 1 do not. I've been thinking over ways to do this, but they all seem to be fairly slow and processor intensive. Using trunk and MySQL (I'd be willing to change to PostgreSQL if there was an advantage, however I've never used it before). Any suggestions or experience is much appreciated. --~--~-~--~~~---~--~~ 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: Whither Validators?
Ok, so if I raiseValidationError in the save() methods, will this just give a big fat ugly general error, or a cute "You have to provide your complete credit card number" error? Thanks for the clarification. Rodrigo On Sep 24, 7:41 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Thu, Sep 25, 2008 at 12:30 AM, Rodrigo Culagovski > > <[EMAIL PROTECTED]> wrote: > > > Validators (django.core.validators) seem to have been removed from > > 1.0. What replaces them? > > Well... validators weren't ever really there to begin with. There was > some initial stub code, but it wasn't fully integrated into models. > > Model validation (Ticket #6845) was on the list of possible v1.0 > features, but got bumped from the feature list because the > implementation wasn't quite ready. It's certainly on the list of > features intended for v1.1. > > In the meantime, there is form-level validation; you can also override > the save() method to ensure that invalid models aren't saved. It's not > particularly pretty, but a better solution is on the way. If you're > feeling adventurous, you can try out the patch on #6845 and let us > know about any problems you have. > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Whither Validators?
So, do you have to override the model's save method and do your validation there? On Sep 24, 3:20 pm, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 24 sep, 18:30, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > > > Validators (django.core.validators) seem to have been removed from > > 1.0. What replaces them? > > Nothing yet AFAICT. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Whither Validators?
Validators (django.core.validators) seem to have been removed from 1.0. What replaces them? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django-recommender 0.2, with content based recs
Looks nice. Which of the algorithms in Programming Collective Intelligence are you using, specifically? Thanks, Rodrigo On Sep 24, 11:36 am, bcurtu <[EMAIL PROTECTED]> wrote: > Hi, > > I have just updated my django-recommender to 0.2, including Content > Based Recommendations using django tagging. > > Have a look athttp://code.google.com/p/django-recommender/ > > 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Unsaved object when passing a callable to "upload_path"
D'oh. This was trivial. >Is there a way to > save the rest of the object before calling "file_path"? Yes, putting it after the other fields in the model definition. This works: class File(models.Model): article= models.ForeignKey(Article) type= models.IntegerField(choices=choices((0,"Text"),(1,"Figure"), (2,"Table"))) number= models.IntegerField() file= models.FileField(upload_to=file_path) On Sep 24, 11:51 am, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > I'm trying to use the new ability to pass a callable to "upload_to" in > fieldfields. I'm having problems with the object not being saved > before the callable is called. > > Model: > > def file_path(instance, filename): > return "uploads/files/%s/%s/%s_%s%s" % ( > slugify(instance.article.author.lastname > +"_"+instance.article.author.firstname), > slugify(instance.article.title), > instance.get_type_display(), > instance.number, > os.path.splitext(filename)[1]) > > class File(models.Model): > article= models.ForeignKey(Article) > file= models.FileField(upload_to=file_path) > type= models.IntegerField(choices=choices((0,"Text"),(1,"Figure"), > (2,"Table"))) > number= models.IntegerField() > > File is being edited inline in "Article". This should create a path > like > > "uploads/files/peter_parker/webs_i_have_known/Figure_1.jpg", > > however, what I actually get is: > > "uploads/files/parker_peter/webs_i_have_known/None_None.jpg". > > So "instance.get_type_display()" and "instance.number" are returning > "None". > If I change the file and save it again the name is assigned > correctly. > This is clearly because the object has not been saved the first time > when the filepath is calculated. How to fix this? Is there a way to > save the rest of the object before calling "file_path"? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: An academic journal's site
> However, you might also wish to consider whether storing the text in the > database is really necessary or useful. Maybe just storing the files on > disk and storing the filenames in the database is a simpler approach. > That way people can download/upload as they have always done and you > don't end with megabyte-sized rows in the database. Django's FileField > field is going to make this relatively straightforwards. > > Good point. Thanks, 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Unsaved object when passing a callable to "upload_path"
I'm trying to use the new ability to pass a callable to "upload_to" in fieldfields. I'm having problems with the object not being saved before the callable is called. Model: def file_path(instance, filename): return "uploads/files/%s/%s/%s_%s%s" % ( slugify(instance.article.author.lastname +"_"+instance.article.author.firstname), slugify(instance.article.title), instance.get_type_display(), instance.number, os.path.splitext(filename)[1]) class File(models.Model): article= models.ForeignKey(Article) file= models.FileField(upload_to=file_path) type= models.IntegerField(choices=choices((0,"Text"),(1,"Figure"), (2,"Table"))) number= models.IntegerField() File is being edited inline in "Article". This should create a path like "uploads/files/peter_parker/webs_i_have_known/Figure_1.jpg", however, what I actually get is: "uploads/files/parker_peter/webs_i_have_known/None_None.jpg". So "instance.get_type_display()" and "instance.number" are returning "None". If I change the file and save it again the name is assigned correctly. This is clearly because the object has not been saved the first time when the filepath is calculated. How to fix this? Is there a way to save the rest of the object before calling "file_path"? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
An academic journal's site
I'm starting work on a site for an academic journal that will both publish the articles from the paper version and also allow authors to submit new articles for review and publication. Looking for specific advice as well as general experience with this kind of site. Question 1 The articles' text has been traditionally submitted in .doc format, but I'm planning on changing it to RTF, for simplicity and openness' sake. How hard would it be to read these RTF files' contents into the database so the articles can be displayed on the site? The files will have minimal formatting, just Bold and Italic. Have you done this in Django, and if so, how? Question 2 There's a some fairly basic functionality that I'm sure could be done via 3rd party apps such as: 1) Letting authors create accounts, confirm them via email. 2) Workflow (submission -> initial review -> peer review -> corrections -> final approval -> publication). I would appreciate recommendations for 3rd party applications or your experience with these topics, as well as any general experience / advice from similar projects. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Using model instances as dictionary keys
I have a weird dictionary key issue: I have an 'Article' model, with textfields for Year and Country and foreignkeys for Magazine and Author. I generate a frequency list for each criteria (e.g.: Year=2005) which I use to keep the count. To do this, I subclassed dictionary like so: class dictinc(dict): """dictionary with a 'set or increment' method""" def inc(self,key): self[key]=self.get(key,0)+1 so I create yeardict=dictinc() and if I want to add 1 to the count for Year=2005, I use: yeardict.inc(2005) This works fine whenever I use text or integers as keys. However, if I try to use a model instance (e.g.:a Magazine instance), it works fine on my development (Vista) machine, but not on my production machine (Linux, on webfaction). Locally, if I have two articles that reference "magazine1", and call for each one: magazine = article.magazine magazinedict.inc(magazine) magazinedict becomes {: 2} however, on the production server, magazinedict is: {: 1, : 1} If I try to check whether the keys are equal: a,b = magazinedict.keys() a == b True So, I guess the problem is using a model instance as a dictionary key. What's weird is the development/production server discrepancy. Development is running 0.97, production 0.96, which I guess might account for the difference, no? Any ideas on how to fix 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django 1.0 and Textmate
Has anybody taken a crack at updating the Textmate Django bundles (python and template) for version 1.0? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to have both newforms-admin and previous version on the same machine?
Great, thanks for the advice. So, using virtualenv, I basically install two separate environments, one for each django version, and manually call "\path\to\djangoversion \bin\activate.bat" depending on which version I need? Or is there a way to activate the correct version directly from the project itself? Using Windows for development, Linux for production. Thanks! Rodrigo On Jul 19, 9:43 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Do not install django as part of site-packges. > Treat it as a python package like any other. > Create two directories: > django-0.96/ > django-pre-1.0/ > > put the old django in 0.96 (as a sub directory 'django') > put the new svn in pre-1.0 > > Then for your projects have your PYTHONPATH set appropriatly. > > because you need django for settings.py, you can not set it in > settings. > custom env scripts work well (and I recommend virtualenv) > > hope this helps. > > -Doug > > On Jul 19, 9:26 pm, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > > > I'm looking foward to trying out the merged newforms-admin on my > > upcoming projects. However, I have a few ongoing projects already > > developed using pre-newforms-admin django. > > I make changes to the projects on my local machine and test them > > before comitting them to the remote production sites, so, unless I > > want to refactor all these sites, I need to keep the current django > > version on my development machine. > > Question: Is it possible to have two django versions on a single > > machine? Is there a way to tell each project which one to use, maybe > > in settings.py? > > I realize that it might make sense to refactor the existing projects > > to work with newforms-admin, just not sure how much time this would > > take for some already considerably complex and extended model > > definitions, plus testing, etc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How to have both newforms-admin and previous version on the same machine?
I'm looking foward to trying out the merged newforms-admin on my upcoming projects. However, I have a few ongoing projects already developed using pre-newforms-admin django. I make changes to the projects on my local machine and test them before comitting them to the remote production sites, so, unless I want to refactor all these sites, I need to keep the current django version on my development machine. Question: Is it possible to have two django versions on a single machine? Is there a way to tell each project which one to use, maybe in settings.py? I realize that it might make sense to refactor the existing projects to work with newforms-admin, just not sure how much time this would take for some already considerably complex and extended model definitions, plus testing, etc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Great work with newforms-admin
Thanks! Super fast, too. On Jul 19, 8:54 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Sat, Jul 19, 2008 at 8:50 PM, Rodrigo Culagovski <[EMAIL PROTECTED]> > wrote: > > > > > Is there a complete reference for newforms-admin (not a FAQ, tutorial > > or changelist) other than the code itself? > > http://www.djangoproject.com/documentation/admin/ > > Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Great work with newforms-admin
Is there a complete reference for newforms-admin (not a FAQ, tutorial or changelist) other than the code itself? On Jul 19, 4:46 pm, "Tom Badran" <[EMAIL PROTECTED]> wrote: > Yes the first link is the one i used. > > Tom > > On Sat, Jul 19, 2008 at 6:21 PM, James Punteney <[EMAIL PROTECTED]> wrote: > > I believe this is the page he is referring to: > >http://code.djangoproject.com/wiki/NewformsAdminBranch > > > Another one that might be helpful: > >http://code.djangoproject.com/wiki/NewformsHOWTO > > > --James > > > On Sat, Jul 19, 2008 at 1:04 PM, Ramdas S <[EMAIL PROTECTED]> wrote: > > >> Tom, > > >> Can you just share the wiki page link please. I need some place to start > > >> Ramdas > > >> On Sat, Jul 19, 2008 at 10:28 PM, Tom Badran <[EMAIL PROTECTED]> wrote: > > >>> I've just updated 2 of my sites to use newforms-admin today following the > >>> changes on the django wiki. I've not been paying attention to the > >>> development of newforms-admin, so i was going into this completely blind > >>> as > >>> it were. > > >>> Just wanted to say everyone who worked on this has done a wonderful job. > >>> Within about an hour i had both sites completely converted and working > >>> brilliantly, and all in all it was a simple process. I'm really happy to > >>> have pulled all the admin meta stuff out of the models too, makes > >>> everything > >>> much cleaner now. > > >>> Thanks for the great work > > >>> Tom > > >>> -- > > >>> Tom Badran > > >>> Freelance Software Developer:http://badrunner.net > >>> Internet/LAN Gaming Centre:http://www.vertical-sync.com > > >> -- > >> Ramdas S > >> +91 9342 583 065 > >> My Personal Blog:http://ramdas.diqtech.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ProgrammingError: (2014, "Commands out of sync; you can't run this command now")
In a production site, all of a sudden while trying to edit the site via the admin interface I get: ProgrammingError: (2014, "Commands out of sync; you can't run this command now") This is when trying to access the record list: "/admin/core/pagina/" This is only while trying to edit this one specific model ('pagina'), I can edit the others without errors. I dumped the database to my development server, and I get the same error. It was working fine right before importing the DB from the production server, so I'm thinking there's a problem in the actual DB. I ran Optimize, Check and Repair on the DB in MySQL Administrator. No dice. I haven't updated or changed anything on either server. Development's running XP, production Linux. Full traceback: Traceback (most recent call last): File "C:\django\djtrunk\django\core\servers\basehttp.py", line 277, in run self.result = application(self.environ, self.start_response) File "C:\django\djtrunk\django\core\servers\basehttp.py", line 631, in __call__ return self.application(environ, start_response) File "C:\django\djtrunk\django\core\handlers\wsgi.py", line 205, in __call__ response = self.get_response(request) File "C:\django\djtrunk\django\core\handlers\base.py", line 117, in get_response receivers = dispatcher.send(signal=signals.got_request_exception, request=request) File "C:\django\djtrunk\django\dispatch\dispatcher.py", line 360, in send **named File "C:\django\djtrunk\django\dispatch\robustapply.py", line 47, in robustApply return receiver(*arguments, **named) File "C:\django\djtrunk\django\db\__init__.py", line 73, in _rollback_on_exception transaction.rollback_unless_managed() File "C:\django\djtrunk\django\db\transaction.py", line 149, in rollback_unless_managed connection._rollback() File "C:\django\djtrunk\django\db\backends\mysql\base.py", line 195, in _rollback BaseDatabaseWrapper._rollback(self) File "C:\django\djtrunk\django\db\backends\__init__.py", line 24, in _rollback return self.connection.rollback() ProgrammingError: (2014, "Commands out of sync; you can't run this command now") --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: FileField not working, however ImageField is.
Nope, just disabled the validator and moved on to other projects. Non-ideal, but hey, that's what we get from using a pre 1.0 framework, I guess. Rodrigo On Jun 10, 4:38 pm, diggs <[EMAIL PROTECTED]> wrote: > Did you ever figure out what the problem was? I'm having the exact > same issue. Using the RequiredIfOtherFieldEquals validator with an > ImageField. > > On May 19, 10:16 am, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > > > I commented out the validator_list = [is_archivo] , and it'sworking > > now, albeit sans validation, of course. This seems odd, as the other 2 > > validator lists (is_texto & is_link) work fine. > > > > Have you tried uploading files with more than one browser? Is the html > > > code in the forms set up properly? Does it work in the development > > > server? apache? > > > It fails with IE, FF and Opera. This is in the admin site, so I > > haven't written any forms. It failed in both the dev (using 'manage.py > > runserver') and production servers. > > > > Maybe it doesn't like Spanglish, and is expecting [es_archivo]. ::shrug:: > > > Nah, the whole application is in Spanglish :) > > > Thanks, > > > 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Different time zone for server and editors screwing up show_from__lte = datetime.now()
Forgot: timezone is set correctly: TIME_ZONE = 'America/Santiago' The server is in Houston, USA: On Jun 3, 9:16 pm, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > I have a Banner model with a show_from DateTimeField, which I filter > to make sure I'm only showing them after they're due, like so: > > from datetime import datetime > > current_banners = Banner.objects.filter(show_from__lte = > datetime.now()) > > However, the server is not in the same time zone as the people editing > the site, so the timing's off by the time delta between the two. > Is there a way to automatically adjust the time, or have everything > expressed in UTC, for example? Or should I just add the time delta to > datetime.now()? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Different time zone for server and editors screwing up show_from__lte = datetime.now()
I have a Banner model with a show_from DateTimeField, which I filter to make sure I'm only showing them after they're due, like so: from datetime import datetime current_banners = Banner.objects.filter(show_from__lte = datetime.now()) However, the server is not in the same time zone as the people editing the site, so the timing's off by the time delta between the two. Is there a way to automatically adjust the time, or have everything expressed in UTC, for example? Or should I just add the time delta to datetime.now()? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: A for B C as D in templates
I see. Is "as" used outside of this tag? I think I've seen it in other contexts. Thanks, Rodrigo On Jun 1, 12:38 am, Julien <[EMAIL PROTECTED]> wrote: > This is not a standard syntax but the particular syntax for the tag > get_free_comment_count. Check its code in > django.contrib.comments.templatetags.DoCommentCount > > In your example, 'blog' is the application name, 'entry' the model > name to which comments are attached, 'object.id' is the id of the > particular object you're retrieving the comments for. > > What it does is it retrieves the comments and stores the number of > comments in the variable 'comment_count', which you can then use as > follows: > > There are {{ comment_count }} comment{{ comment_count|pluralize }} for > this entry. > > On Jun 1, 12:02 pm, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > > > Looking through documentation for the FreeComment app, I came across > > this template syntax: > > > {% get_free_comment_count for blog.entry object.id as comment_count %} > > > Where can I find documentation for use of the "A for B C as D" syntax > > in Django templates? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
A for B C as D in templates
Looking through documentation for the FreeComment app, I came across this template syntax: {% get_free_comment_count for blog.entry object.id as comment_count %} Where can I find documentation for use of the "A for B C as D" syntax in Django templates? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Really, realy strange MySQLdb problem, cycling through error messages.
For future reference: fixed, it stabilized to the 3rd error message. I added this to __init.py__ in the application's directory: import os os.environ['PYTHON_EGG_CACHE'] = '/tmp' Apparently there was some permission error on '/root/.python-eggs' --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Really, realy strange MySQLdb problem, cycling through error messages.
I'm setting up a django site on the production server and ran into a MySQLdb problem. The server is cycling through a series of error messages: 1) ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb 2) ImproperlyConfigured: Error loading MySQLdb module: bad local file header in /usr/local/lib/python2.5/site-packages/MySQL_python-1.2.2- py2.5-linux-i686.egg 3) ExtractionError: Can't extract file(s) to egg cache The following error occurred while trying to extract file(s) to the Python egg cache: [Errno 13] Permission denied: '/root/.python-eggs' The Python egg cache directory is currently set to: /root/.python-eggs Perhaps your account does not have write access to this directory? You can change the cache directory by setting the PYTHON_EGG_CACHE environment variable to point to an accessible directory. 4) the "It worked! Congratulations on your first Django-powered page." This cycling happens just by refreshing the same page, making NO changes to the server at all. It's always in the same order. The first 2 text errors change after just 1 refresh, the last one takes 3 or 4 and the "It worked" message takes a bit longer before going back to error 1. I svn'ed the application into the appropriate directory, with urls.py, etc., so I shouldn't be getting the "It worked" message at all. I recently installed MySQLdb, and it installed setuptools automatically. Usiing trunk on Red Hat 4.1.2-14 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: FileField not working, however ImageField is.
I commented out the validator_list = [is_archivo] , and it's working now, albeit sans validation, of course. This seems odd, as the other 2 validator lists (is_texto & is_link) work fine. > Have you tried uploading files with more than one browser? Is the html > code in the forms set up properly? Does it work in the development > server? apache? It fails with IE, FF and Opera. This is in the admin site, so I haven't written any forms. It failed in both the dev (using 'manage.py runserver') and production servers. > > Maybe it doesn't like Spanglish, and is expecting [es_archivo]. ::shrug:: > Nah, the whole application is in Spanglish :) Thanks, 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
FileField not working, however ImageField is.
I have a FileField in a model that's not working. When I try to upload a file via the admin site, nothing is uploaded and I get a validation error (as if I hadn't filled in the field). In the same application but different model, I have ImageFields that work fine. I changed the 'upload_to' parameter to be the same as the ImageFields', in case there was a permission or other file system problem with the directory I was uploading to, but it still doesn't work. Here's the model, the relevant field is "archivo". Using trunk. is_texto = validators.RequiredIfOtherFieldEquals('tipo','Texto') is_link = validators.RequiredIfOtherFieldEquals('tipo','Link') is_archivo = validators.RequiredIfOtherFieldEquals('tipo','Archivo') class Pagina(models.Model): titulo = models.CharField(max_length=200) bajada = models.TextField(blank=True) cuerpo = models.TextField(validator_list=[is_texto], blank=True, help_text="""necesario para tipo = 'Texto'""") fecha_creacion = models.DateTimeField(auto_now_add=True) fecha_modificacion = models.DateTimeField(auto_now=True) tipo = models.CharField(max_length=200, choices = pagina_choices, default = "Texto") padre = models.ForeignKey('self', verbose_name="Subpágina de", blank = True, null = True, related_name = 'subpaginas') link = models.URLField(validator_list = [is_link], blank=True, help_text = """necesario para tipo = 'Link'""") archivo = models.FileField(upload_to = "articulos", validator_list = [is_archivo], blank=True, help_text="""necesario para tipo = 'Archivo'""") orden = models.IntegerField() ruta = models.CharField(max_length=1000, editable = False) color = models.CharField(max_length=100, choices = color_choices, blank=True, validator_list=[is_root], help_text="Sólo para páginas de nivel 1") menu_principal = models.BooleanField( blank=True, help_text="Sólo para páginas de nivel 1") def save(self): super(Pagina, self).save() self.ruta = self.root() for subpage in self.subpaginas.all(): subpage.save() super(Pagina, self).save() def root(self): if self.padre: return self.padre.root() + "/" + slugger(self.titulo) return slugger(self.titulo) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: New to django and python. error following tutorial w/ the shell
Can you post the code 5 lines before and after the one that's giving you the error? Many times python will report a syntax error in one line that's actually caused by a missing parenthesis, semicolon, etc., in a line before. On May 6, 9:58 am, Jason Ourscene <[EMAIL PROTECTED]> wrote: > I tried with the space and without the space and i am still getting > that error. > what do you think? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Row-level permissions, recommendations?
What's the state of the art for row-level permissions in Django? I'm working on an application where I need to allow users to edit their own personal info but nobody else's. What app, hack, patch or branch should I use in order to be able to do this via the admin site? Thanks, 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Page-trees in admin system
Matthias, that looks like what I'm looking for. Does it work in trunk? thanks! Rodrigo On Apr 28, 3:13 pm, Matthias Kestenholz <[EMAIL PROTECTED]> wrote: > Hi, > > > > On Mon, 2008-04-28 at 12:03 -0700, Rodrigo Culagovski wrote: > > I am starting to develop a site with Django. I will need to implement > > a 'pagetree' that serves static pages, (similar to the > > contrib.flatpages), with 3 or 4 levels of depth. I have already done > > this for previous Django driven sites, but wonder if there is a better > > way. > > > My model looks like: > > > class Page(models.Model): > > slug= models.SlugField(unique=True) > > title= models.CharField(max_length=200, blank=True,null=True) > > content= models.TextField() > > create_date = models.DateTimeField(auto_now_add=True) > > modify_date = models.DateTimeField(auto_now=True) > > order= models.IntegerField() > > subpages = models.ManyToManyField('self', symmetrical = False, > > blank=True) > > > So I can add as many subpages (or sub-sub-, etc.) as I need. The order > > of the pages in a sub-branch is specified the 'order' field, which > > again is not super intuitive, and clumsy if you decide that the first > > page is now the 7th one. It works, just not as smoothly as you'd like. > > The way this is expressed in the admin, however, is not very intuitive > > or useful, as you can't visualize the whole tree or make changes at > > the tree level (such as drag a subbranch from one top-level page to > > another). You can of course make changes in each individual page or > > subpage, but not with a broader more general perspective. > > It would be nice, for example, to be able to see (within the admin > > view) a page's whole n-level sub-tree, and add or edit pages within > > that tree. Or move up 1 level to the page's parent. Or change the > > order of subpages. > > > Has anybody implemented a better system for page-trees? > > Yes, indeed, but it's not finished nor very clean yet. (And > documentation is lacking, as always...) I've used django-mptt[1] and the > jquery nestedsortablewidget[2] to create a page tree for a simple CMS. > The code can be found in my git repository[3]. > > Mabye you'll find something interesting there. > > [1]:http://code.google.com/p/django-mptt/ > [2]:http://code.google.com/p/nestedsortables/ > [3]:http://spinlock.ch/pub/git/?p=django/tusk.git;a=summary > > screenshot1.png > 63KViewDownload --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Page-trees in admin system
I am starting to develop a site with Django. I will need to implement a 'pagetree' that serves static pages, (similar to the contrib.flatpages), with 3 or 4 levels of depth. I have already done this for previous Django driven sites, but wonder if there is a better way. My model looks like: class Page(models.Model): slug= models.SlugField(unique=True) title= models.CharField(max_length=200, blank=True,null=True) content= models.TextField() create_date = models.DateTimeField(auto_now_add=True) modify_date = models.DateTimeField(auto_now=True) order= models.IntegerField() subpages = models.ManyToManyField('self', symmetrical = False, blank=True) So I can add as many subpages (or sub-sub-, etc.) as I need. The order of the pages in a sub-branch is specified the 'order' field, which again is not super intuitive, and clumsy if you decide that the first page is now the 7th one. It works, just not as smoothly as you'd like. The way this is expressed in the admin, however, is not very intuitive or useful, as you can't visualize the whole tree or make changes at the tree level (such as drag a subbranch from one top-level page to another). You can of course make changes in each individual page or subpage, but not with a broader more general perspective. It would be nice, for example, to be able to see (within the admin view) a page's whole n-level sub-tree, and add or edit pages within that tree. Or move up 1 level to the page's parent. Or change the order of subpages. Has anybody implemented a better system for page-trees? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Search with Stemming, Accents and Entities
Jarek, it looks like Solr has its own database. The application is in Django, so it wouldn't make any sense to replicate the database in the search engine. Thanks, Rodrigo On Apr 24, 5:37 am, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Rodrigo Culagovski napisał(a): > > > I am implementing an academic publications database, and am looking > > for a search solution. > > I need at the very least Stemming and Accented Characters support > > (i.e.: searching for "alvarez" returns "álvarez" and v.v.). > > Some of the fields have a tinymce editor, so the data is stored with > > html entities. It would be very nice to be able to also search in > > these fields (i.e.: searching for 'alvarez' returns a record that > > contains 'álvarez'). > > Recommendations for apps or 3rd party engines or personal experience > > implementing something like this is very welcome. > > Solr (http://lucene.apache.org/solr/) has this all. Of course, you can > build your own machinery using Java + Lucene or Python + PyLucene, but I > can guarantee it will be pointless (in case of Java) or PITA (in case of > PyLucene). > > > Using trunk + MySQL. > > Solr talks over HTTP, so it has nothing to do with your platform. > > -- > Jarek Zgoda > Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101 > > "We read Knuth so you don't have to." (Tim Peters) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Search with Stemming, Accents and Entities
I am implementing an academic publications database, and am looking for a search solution. I need at the very least Stemming and Accented Characters support (i.e.: searching for "alvarez" returns "álvarez" and v.v.). Some of the fields have a tinymce editor, so the data is stored with html entities. It would be very nice to be able to also search in these fields (i.e.: searching for 'alvarez' returns a record that contains 'álvarez'). Recommendations for apps or 3rd party engines or personal experience implementing something like this is very welcome. Using trunk + MySQL. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Missing help_text for ManyToManyFields with filter_interface
Thanks, I tried it and it didn't work (the filter_interface stopped showing). I removed the filter_interface from now, as the help_text is mandatory. Will wait for a solution in trunk, I guess. Thanks, Rodrigo On Apr 14, 5:50 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Mon, Apr 14, 2008 at 4:07 PM, Rodrigo Culagovski <[EMAIL PROTECTED]> > wrote: > > > The help_text for my ManyToManyFields dissapears when I use > > "filter_interface=models.HORIZONTAL" (or "=models.VERTICAL"). > > I figure that it's the JavaScript in the filter_interface, as the > > help_text is there before the JavaScript modifies the field. Using > > trunk. > > I doubt this will be fixed on trunk, but there's an open ticket for it > against newforms-admin: > > http://code.djangoproject.com/ticket/6183 > > It's got a patch you could try out if you'd like a fix before the ticket > gets resolved (+ newforms-admin merged to trunk). Not sure if the patch > will need modification to work on trunk. > > Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Dynamically limiting choices in admin.
Richard, I see your point, but there could be many, many issues for each magazine, and over a hundred magazines total, so I don't want to make the users wade through a few thousand issues each time. I'd like to be able to drill down, first pick a magazine, then one of its issues. What I'm thinking is do it backwards: give Magazine a ManyToManyField(Issue), and Issue a ManyToManyField(Article), so you create or select a Magazine, add an Issue, and then add Articles to it. Thanks! Rodrigo On Apr 14, 4:19 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote: > This is where I would suggest you rethink your data model. Is there a > reason to link Article to both Issues and Magazine? > > Why not something like: > > Issues has FK (magazine) to Magazine > Articles has FK (issue) to Issues > > Issues could be configured to return its magazine.title and > self.issue_number (or whatever) in its __unicode__() function so when you > created an article, you would make one selection: the issue the article was > in. If the articles could be in multiple issues, make the Article.issues a > [EMAIL PROTECTED] > hth, > -richard > > On 4/14/08, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > > > > > I have 3 models: Magazine, Issue and Article. > > Each Magazine has 1 or more Issues and each Issue has 1 or more > > Articles. > > Article has models.ForeignKey(Issue) and models.ForeignKey(Magazine). > > Issue has models.ForeignKey(Magazine)). > > In the admin, when creating a new article, I choose which Magazine it > > belongs to and then which Issue of that Magazine. > > > Is there a way to limit the Issues to only those that belong to the > > chosen Magazine? > > > Could this be done by dynamically updating the list of Issues when you > > select a Magazine, without needing to save the record first? > > JavaScript, AJAX maybe? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Missing help_text for ManyToManyFields with filter_interface
The help_text for my ManyToManyFields dissapears when I use "filter_interface=models.HORIZONTAL" (or "=models.VERTICAL"). I figure that it's the JavaScript in the filter_interface, as the help_text is there before the JavaScript modifies the field. Using 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Dynamically limiting choices in admin.
I have 3 models: Magazine, Issue and Article. Each Magazine has 1 or more Issues and each Issue has 1 or more Articles. Article has models.ForeignKey(Issue) and models.ForeignKey(Magazine). Issue has models.ForeignKey(Magazine)). In the admin, when creating a new article, I choose which Magazine it belongs to and then which Issue of that Magazine. Is there a way to limit the Issues to only those that belong to the chosen Magazine? Could this be done by dynamically updating the list of Issues when you select a Magazine, without needing to save the record first? JavaScript, AJAX maybe? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Cleaning up Word's mess in text areas using tiny_mce
Thanks for the answers. I ended up using Pilgrim & Swartz's 'sanitize.py' [1], and adding a custom 'save' function to the classes where I need it, like so: def save(self): self.summary=util.SomeTags(self.summary,'utf8') self.body=util.SomeTags(self.body,'utf8') super(Entry, self).save() # Call the "real" save() method. "util.SomeTags" calls the sanitize code and returns the original text with everything except some tags, like , , etc., stripped out. This works fine, whether on bad formatting coming from word, or unwanted formatting done in TinyMCE (BGColor, etc.). 1: http://www.gnome.org/~jdub/bzr/planet/2.0/planet/sanitize.py --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Cleaning up Word's mess in text areas using tiny_mce
I am using tiny_mce to help the editors on a site edit text areas[1]. However, I worry that they will paste in text from Word and make a mess. Is there a way to strip out all the Word-generated crap (font tags, colors, etc.) while maintaining basic html tags like p, br, ul, etc? 1: http://code.djangoproject.com/wiki/AddWYSIWYGEditor --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Counting over a ManyToManyField of a ManyToManyField, a question of style.
On Mar 27, 3:43 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Well, books can be redefined as: > > def books(self): > progs = self.programs.all() > return sum([prog.publications.all().filter(type=u'Book').count() > for prog in progs]) > > and likewise for the other methods. Nice. Would this also be faster? Thanks, 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Counting over a ManyToManyField of a ManyToManyField, a question of style.
My application has the following models: Researcher, Program and Publication. Each Researcher has 0 or more Programs as a ManyToManyField, and each Program has 0 or more Publications also as a ManyToManyField. Publication has a 'type' attribute which is a CharField, and has choices: Book, Article or Other. I need to retrieve the number of Publications of each type for each Program of a given Researcher. Within the Researcher class I define: def books(self): count = 0 for progs in self.programs.all(): for pub in progs.publications.all(): if pub.type== u"Book": count += 1 return count def articles(self): count = 0 for progs in self.programs.all(): for pub in progs.publications.all(): if pub.type== u"Article": count += 1 return count def others(self): count = 0 for progs in self.programs.all(): for pub in progs.publications.all(): if pub.type== u"Other": count += 1 return count This lets me get {{ researcher_instance.books }} etc. in my templates. However, this seems excessively verbose and repeating oneself, and it seems like this problem would already have come up many times. Is there a more idiomatic, pythonic and djangoic way to do this? Thanks, 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error accessing "'/media" directory
Thanks, that did the trick! Cheers, Rodrigo On Jan 17, 8:35 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Jan 17, 2008 6:24 PM, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > > > > > > > I am using the following in my urls.py: > > > (r'^media_/(?P.*)$', 'django.views.static.serve', > > {'document_root': > > os.path.join(os.path.dirname(__file__), 'media').replace('\\','/')}), > > > Notice the '_' after 'media. > > > This allows me to access my media folder using for example: > > >http://127.0.0.1:8000/media_/css/css2.css > > > However, if i change it to: > > > (r'^media/(?P.*)$', 'django.views.static.serve', > > {'document_root': > > os.path.join(os.path.dirname(__file__), 'media').replace('\\','/')}), > > > Notice no '_' after 'media'. > > > I get the following error, trying to access 'http://127.0.0.1:8000/ > > media/css/css2.css' I get: > > > Page not found: C:\Python24\lib\site-packages\django/contrib/admin/ > > media\css/css2.css > > > So apparently when accessing 'media' it gets sent to '/contrib/admin/ > > media' instead of my media folder. > > When using the development server, any urls that start with the setting's > ADMIN_MEDIA_PREFIX (which defaults to /media/) are intercepted and served up > by the AdminMediaHandler out of the contrib/admin/media tree under the > Django install directory. So if you want to put you own media under urls > that start with /media/, you need to change ADMIN_MEDIA_PREFIX to something > else. > > Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Error accessing "'/media" directory
I am using the following in my urls.py: (r'^media_/(?P.*)$', 'django.views.static.serve', {'document_root': os.path.join(os.path.dirname(__file__), 'media').replace('\\','/')}), Notice the '_' after 'media. This allows me to access my media folder using for example: http://127.0.0.1:8000/media_/css/css2.css However, if i change it to: (r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': os.path.join(os.path.dirname(__file__), 'media').replace('\\','/')}), Notice no '_' after 'media'. I get the following error, trying to access 'http://127.0.0.1:8000/ media/css/css2.css' I get: Page not found: C:\Python24\lib\site-packages\django/contrib/admin/ media\css/css2.css So apparently when accessing 'media' it gets sent to '/contrib/admin/ media' instead of my media folder. I also hace this in urls.py: (r'^admin/', include('django.contrib.admin.urls')), thanks, 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django shared hosting
Can anybody recomend a shared-hosting that: a) is Django ready, with the svn-version installed or installable b) is as good or better and as cheap or cheaper then Webfaction c) gives you an insane amount of space (like Dreamhost) Basically, I need a host for a new project, and am thinking of Webfaction, but would like the ton of space some hosts give you. 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Maximum ImageFIeld width
How can you validate that an ImageField's width is <= a maximum in pixels? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: (1241, 'Operand should contain 1 column(s)')
Malcolm, you're right, of course. That did the trick! Thanks, Rodrigo On Jan 7, 9:23 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sun, 2008-01-06 at 17:24 -0800, Rodrigo Culagovski wrote: > > I am getting the following error: > > > OperationalError at /lista/ > > (1241, 'Operand should contain 1 column(s)') > > Request Method:POST > > Request URL: http://127.0.0.1:8000/lista/ > > Exception Type:OperationalError > > Exception Value: (1241, 'Operand should contain 1 column(s)') > > Exception Location:C:\Python24\Lib\site-packages\MySQLdb > > \connections.py in defaulterrorhandler, line 35 > > > Looking through the traceback, the error seems to happen in line 18 > > here: > > > C:\Python24\lib\site-packages\django\db\backends\util.py in execute > > > 12. self.cursor = cursor > > 13. self.db = db # Instance of a BaseDatabaseWrapper subclass > > 14. > > 15. def execute(self, sql, params=()): > > 16. start = time() > > 17. try: > > > 18. return self.cursor.execute(sql, params) ... > > > 19. finally: > > 20. stop = time() > > 21. sql = self.db.ops.last_executed_query(self.cursor, sql, params) > > 22. self.db.queries.append({ > > 23. 'sql': sql, > > 24. 'time': "%.3f" % (stop - start), > > > with: > > > sql= > > > u"SELECT DISTINCT > > `revistas_articulo`.`id`,`revistas_articulo`.`visible`,`revistas_articulo`.`revista_id`,`revistas_articulo`.`pais`,`revistas_articulo`.`ciudad`,`revistas_articulo`.`titulo`,`revistas_articulo`.`volumen`,`revistas_articulo`.`numero`,`revistas_articulo`.`mes`,`revistas_articulo`.`ano`,`revistas_articulo`.`paginas`,`revistas_articulo`.`categoria`,`revistas_articulo`.`contenido`,`revistas_articulo`.`notas`,`revistas_articulo`.`idioma`,`revistas_articulo`.`descripcion`,`revistas_articulo`.`foto`,`revistas_articulo`.`ilustracion`,`revistas_articulo`.`link`,`revistas_articulo`.`fecha_creacion`,`revistas_articulo`.`fecha_modificacion`,`revistas_articulo`.`imagen` > > FROM `revistas_articulo` LEFT OUTER JOIN `revistas_articulo_autores` > > AS `m2m_revistas_articulo__autores` ON `revistas_articulo`.`id` = > > `m2m_revistas_articulo__autores`.`articulo_id` INNER JOIN > > `revistas_autor` AS `revistas_articulo__autores` ON > > `m2m_revistas_articulo__autores`.`autor_id` = > > `revistas_articulo__autores`.`id` INNER JOIN `revistas_revista` AS > > `revistas_articulo__revista` ON `revistas_articulo`.`revista_id` = > > `revistas_articulo__revista`.`id` WHERE ((`revistas_articulo`.`titulo` > > LIKE %del% OR `revistas_articulo__autores`.`nombre` LIKE %del% OR > > `revistas_articulo__autores`.`apellido` LIKE %del% OR > > `revistas_articulo__revista`.`nombre` LIKE %del%) AND > > `revistas_articulo`.`pais` = [u'Bolivia', u'Chile', u'Colombia', > > u'Costa Rica', u'Cuba', u'Ecuador', u'El Salvador', u'Espa\\xf1a', > > u'Guatemala', u'Honduras', u'M\\xe9xico', u'Nicaragua', u'Panam\\xe1'] > > AND `revistas_articulo`.`revista_id` = [u'Arquitectura', > > u'Arquitectura y construccion', u'ARQUITECTURA- Colegio Nacional de > > Arquitectos CUBA'] AND `revistas_articulo`.`categoria` = [u'Articulo - > > noticia', u'Catalogo de materiales', u'Critica', u'Nota biografica', > > u'Nota necrologica', u'Noticia', u'Reportaje fotografico', u'Resena > > bibliografica', u'Resena de obra'])" > > So you can see here that the problem is you're passing a list where the > SQL is expecting a value. Thus, checking your code for places where you > are using a list and exact ("=") matching, rather than "__in", will show > the problem. > > [...] > > > if categoria: > > results = results.filter(categoria=categoria) > > Since, apparently, categoria is a list at this point, you should be > doing > > results = results.filter(categoria__in=categoria) > > The version you have written tries to do exact comparison, which only > makes sense if the right-hand side is a single value. > > Regards, > Malcolm > > -- > Atheism is a non-prophet organization.http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Passing a form via a generic view
Ramiro, got it, thanks! Rodrigo On Jan 7, 3:20 pm, "Ramiro Morales" <[EMAIL PROTECTED]> wrote: > Rodrigo, > > On Jan 7, 2008 4:05 PM, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > > > [...] > > > Since this parameter is not passed from the generic view, the form > > doesn't show. The form is defined in views.py and works for my other, > > non-generic views. Is there a way to pass the form via a generic view? > > Remember views are Python functions. Take a look > athttp://www.b-list.org/weblog/2006/nov/16/django-tips-get-most-out-gen... > ("Getting more out of a generic view"section). > andhttp://www.pointy-stick.com/blog/2006/06/29/django-tips-extending-gen... > > The key word is the "extra_context" argument of the generic views. > > HTH, > > -- > Ramiro Morales --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Passing a form via a generic view
I am using a generic view to view an individual item ('articulo') like so: urlpatterns = patterns('', (r'^articulos/(?P\d+)/$', list_detail.object_detail, articulo_detail_info) The 'articulo_detail.html' template imports a "base.html" template, which expects a 'form' parameter, like so: {% block search %} {{ form.as_table }} Borrar {% endblock %} Since this parameter is not passed from the generic view, the form doesn't show. The form is defined in views.py and works for my other, non-generic views. Is there a way to pass the form via a generic view? Thanks, 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Error: (1241, 'Operand should contain 1 column(s)')
I am getting the following error: OperationalError at /lista/ (1241, 'Operand should contain 1 column(s)') Request Method: POST Request URL:http://127.0.0.1:8000/lista/ Exception Type: OperationalError Exception Value:(1241, 'Operand should contain 1 column(s)') Exception Location: C:\Python24\Lib\site-packages\MySQLdb \connections.py in defaulterrorhandler, line 35 Looking through the traceback, the error seems to happen in line 18 here: C:\Python24\lib\site-packages\django\db\backends\util.py in execute 12. self.cursor = cursor 13. self.db = db # Instance of a BaseDatabaseWrapper subclass 14. 15. def execute(self, sql, params=()): 16. start = time() 17. try: 18. return self.cursor.execute(sql, params) ... 19. finally: 20. stop = time() 21. sql = self.db.ops.last_executed_query(self.cursor, sql, params) 22. self.db.queries.append({ 23. 'sql': sql, 24. 'time': "%.3f" % (stop - start), with: sql = u"SELECT DISTINCT `revistas_articulo`.`id`,`revistas_articulo`.`visible`,`revistas_articulo`.`revista_id`,`revistas_articulo`.`pais`,`revistas_articulo`.`ciudad`,`revistas_articulo`.`titulo`,`revistas_articulo`.`volumen`,`revistas_articulo`.`numero`,`revistas_articulo`.`mes`,`revistas_articulo`.`ano`,`revistas_articulo`.`paginas`,`revistas_articulo`.`categoria`,`revistas_articulo`.`contenido`,`revistas_articulo`.`notas`,`revistas_articulo`.`idioma`,`revistas_articulo`.`descripcion`,`revistas_articulo`.`foto`,`revistas_articulo`.`ilustracion`,`revistas_articulo`.`link`,`revistas_articulo`.`fecha_creacion`,`revistas_articulo`.`fecha_modificacion`,`revistas_articulo`.`imagen` FROM `revistas_articulo` LEFT OUTER JOIN `revistas_articulo_autores` AS `m2m_revistas_articulo__autores` ON `revistas_articulo`.`id` = `m2m_revistas_articulo__autores`.`articulo_id` INNER JOIN `revistas_autor` AS `revistas_articulo__autores` ON `m2m_revistas_articulo__autores`.`autor_id` = `revistas_articulo__autores`.`id` INNER JOIN `revistas_revista` AS `revistas_articulo__revista` ON `revistas_articulo`.`revista_id` = `revistas_articulo__revista`.`id` WHERE ((`revistas_articulo`.`titulo` LIKE %del% OR `revistas_articulo__autores`.`nombre` LIKE %del% OR `revistas_articulo__autores`.`apellido` LIKE %del% OR `revistas_articulo__revista`.`nombre` LIKE %del%) AND `revistas_articulo`.`pais` = [u'Bolivia', u'Chile', u'Colombia', u'Costa Rica', u'Cuba', u'Ecuador', u'El Salvador', u'Espa\\xf1a', u'Guatemala', u'Honduras', u'M\\xe9xico', u'Nicaragua', u'Panam\\xe1'] AND `revistas_articulo`.`revista_id` = [u'Arquitectura', u'Arquitectura y construccion', u'ARQUITECTURA- Colegio Nacional de Arquitectos CUBA'] AND `revistas_articulo`.`categoria` = [u'Articulo - noticia', u'Catalogo de materiales', u'Critica', u'Nota biografica', u'Nota necrologica', u'Noticia', u'Reportaje fotografico', u'Resena bibliografica', u'Resena de obra'])" and params = [u'%del%', u'%del%', u'%del%', u'%del%', [u'Bolivia', u'Chile', u'Colombia', u'Costa Rica', u'Cuba', u'Ecuador', u'El Salvador', u'Espa\xf1a', u'Guatemala', u'Honduras', u'M\xe9xico', u'Nicaragua', u'Panam\xe1'], [u'Arquitectura', u'Arquitectura y construccion', u'ARQUITECTURA- Colegio Nacional de Arquitectos CUBA'], [u'Articulo - noticia', u'Catalogo de materiales', u'Critica', u'Nota biografica', u'Nota necrologica', u'Noticia', u'Reportaje fotografico', u'Resena bibliografica', u'Resena de obra']] The error is triggered by the second-to-last 'if results:" line in my views.py: from django.db.models import Q from django.shortcuts import render_to_response from models import Articulo, Revista, choice_categoria from forms import ListForm def lista(request): if request.method == 'POST': form = ListForm(request.POST) if form.is_valid(): data = form.cleaned_data query = data['query'] ano_min = data['ano_min'] ano_max = data['ano_max'] pais = data['pais'] revista = data['revista'] categoria = data['categoria'] orderby = data['orderby'] results = Articulo.objects.all() if query: qset = ( Q(titulo__icontains=query) | Q(autores__nombre__icontains=query) | Q(autores__apellido__icontains=query) | Q(revista__nombre__icontains=query) ) results = results.filter(qset).distinct() if ano_min: results = results.filter(ano__gte=ano_min) if ano_max: results = results.filter(ano__lte=ano_max) if pais: results = results.filter(pais=pais) if revista: results = results.filter(revista=revista) if categoria: results = results.filter(categoria=categoria) #if orderby: #results = results.order_by(orderby) #count = results.co
Re: Replicating admin behavior in front end
> If I am understanding your requirement correctly you are looking for > databrowse. I actually tried that, but it doesn't really have the structure I need, and too many options. Basically, I want what the admin interface has: a paginated grid with various fields across the top allowing you to sort forwards or backwards by any field, and a list of filters. Thanks, Rodriog --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Replicating admin behavior in front end
I am making a site that will handle and display a magazine article database. I would like for front end (anonymous, not logged in) users to be able to use some of the same functionality the admin interface offers, namely the ability to sort by column (and reverse the order), and filter by year, publication, etc. Ideally, it should be as easy as adding the 'Admin' subclass is to a class in models.py: class Admin: list_display = ('titulo', 'revista', 'ano','visible') list_filter = ('revista', 'pais','categoria','ano') ordering = ('-ano',) search_fields = ('titulo','autores','revista') date_hierarchy = 'fecha_modificacion' save_on_top = True Basically, I wonder if there's some read-only, public version of the admin interface. Thanks, 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Rendering ManyToManyField in template
Rajesh, I was missing the ".all" attribute in my previous attempts. Thanks, Rodrigo On Jan 3, 7:17 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > Hi, > > > > > {% block content %} > > {{articulo}} > > > > identificadores:{{articulo.identificadores}} > > > > {% endblock %} > > Since you can have many identificadores, you need to do something like > this in your template: > > > {% for ix in articulo.identificadores.all %} > {{ ix.identificador }} > {% endfor %} > > > -Rajesh D --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Rendering ManyToManyField in template
Fixed it, in the class definition: @property def ids(self): return ' - '.join([a['identificador'] for a in self.identificadores.values()]) On Jan 3, 6:36 pm, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > I forgot to show the identificadores class: > > --- > class Identificador(models.Model): > identificador = models.CharField(max_length=200,unique=True) > > def __unicode__ (self): > return self.identificador > > class Admin: > pass > > class Meta: > verbose_name_plural = "identificadores" > --- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Rendering ManyToManyField in template
I forgot to show the identificadores class: --- class Identificador(models.Model): identificador = models.CharField(max_length=200,unique=True) def __unicode__ (self): return self.identificador class Admin: pass class Meta: verbose_name_plural = "identificadores" --- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Rendering ManyToManyField in template
Hi, I am trying to render the contents of a ManyToManyField in a template. However, when viewing the page, instead of the contents, it shows: "" I understand why this is happening, sort of, but haven't been able to fix it. The field is called "identificadores", deifned in the class "Articulo" as: class Articulo(models.Model): identificadores = models.ManyToManyField('Identificador',filter_interface=models.HORIZONTAL) The template looks like: --- {% extends "revistas/base.html" %} {% block content %} {{articulo}} identificadores:{{articulo.identificadores}} {% endblock %} --- and urls.py: --- from django.conf.urls.defaults import * from django.views.generic import list_detail from bdrevista01.revistas.models import Articulo articulo_info = { "queryset" : Articulo.objects.all(), } articulo_detail_info = { "queryset" : Articulo.objects.all(), "template_object_name" : "articulo", } urlpatterns = patterns('', # Example: # (r'^bdrevista01/', include('bdrevista01.foo.urls')), # Uncomment this for admin: (r'^admin/', include('django.contrib.admin.urls')), (r'^articulos/$', list_detail.object_list, articulo_info), (r'^articulos/(?P\d+)/$', list_detail.object_detail, articulo_detail_info), ) --- The last line is the relevant one, the URL is of the form: http://127.0.0.1:8000/articulos/1/ I tried to define a method within the Articulo class that would return the contents of 'identificadores', but got an 'iteration over non- sequence' error. Thanks, 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: UnicodeEncodeError
Thanks so much, that did the trick. Rodrigo On Dec 26, 3:05 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Dec 26, 2007 12:47 PM, rodrigo <[EMAIL PROTECTED]> wrote: > > > > > > > I am getting a "UnicodeEncodeError" when trying to add data containing > > accented characters (or 'ñ') via the admin interface. > > I am using the latest revision of Django via svn, and a mysql database > > with "DEFAULT CHARACTER SET utf8". > > Here's the odd part: The data does get added to the database, the > > error seems to be related to the admin interface's forms. > > In this case, I created an 'author' named : Niño Niñó. This gives me > > the error reproduced below. However, if I go into the list view for > > Authors, it shows up.If I try to modify Niño, I get a > > UnicodeEncodeError. I also get the same error if I try to create a new > > Publication (that has Author as a ManyToManyField) I also get the > > UnicodeEncodeError. > > If I delete the offending entry in the DB, the errors go away. > > > Any help is of course appreciated, > > > Rodrigo > > > -- > > The error: > > [details snipped] > > Does your author model have an __str__ method instead of a __unicode__ > method? That would cause the error you are reporting. Changing it to > __unicode__ will fix the problem. > > Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---