Re: robots.txt?
You can always put a urlconf that will match "robots.txt" and return a simple http response... On Jun 5, 6:24 pm, "Deryck Hodge" <[EMAIL PROTECTED]> wrote: > On 6/5/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > > > > > SetHandler None > > > > > Can you do the same for single files? > > You can, and probably would be better than the mod_rewrite overhead in > this case. > > Cheers, > deryck --~--~-~--~~~---~--~~ 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: DBMigrations - an library/tool for database evolution
There's no limitation - one could always create a contrib app that uses your framework behind the scenes... On Jun 8, 3:53 am, "Marinho Brandao" <[EMAIL PROTECTED]> wrote: > > Sounds great Marinho, thanks for contributing this! *bookmarked* > > thanks for the considerations :) > > next days I will have news, that I'll publish in website. > > @Russel: > > I have seen this wiki, and I've followed the discussions, but the > point that I've percepted is that the ActiveRecord Migrations is very > limited, cos it only supports RoR. My goal is provide a solution more > flexible, and independent of ORMs, platforms or languages. > > Example: I'll use DBMigrations to solve a problem that I've with a > Delphi app, and the evolutions of a Django-powered-website case. Two > cases very different, but the DBMigrations will support both. > > I think this is a better solution than create a Django contrib or > another dependent sollution. > > thanks for all :) > > 2007/6/6, Kelvin Nicholson <[EMAIL PROTECTED]>: > > > > > > > Sounds great Marinho, thanks for contributing this! *bookmarked* > > > Kelvin > > > -- > > Kelvin Nicholson > > Voice: +886 9 52152 336 > > Voice: +1 503 715 5535 > > GPG Keyid: 289090AC > > Data: [EMAIL PROTECTED] > > Skype: yj_kelvin > > Site:http://www.kelvinism.com > > -- > José Mário, Mário ou Marinho > > http://del.icio.us/marinhohttp://www.flickr.com/photos/marinho/http://marinho.wordpress.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: override get_next_by_FOO() / get_previous_by_FOO()
I have defined a dictionary of lookup arguments in my manages so I can reuse them everywhere I want the same behavior... On Jun 10, 3:12 am, Jonathan Stockdill <[EMAIL PROTECTED]> wrote: > I found myself in a similar position and used the following: > def get_next_pub(self): >return self.get_next_by_pub_date(pub_date__lt=datetime.now > (),is_draft=False) > def get_previous_pub(self): >return self.get_previous_by_pub_date(pub_date__lt=datetime.now > (),is_draft=False) > > but already have these filters in a Manager and was wondering, is > there a way to specify the methods to use a different manager than > the default? > > Thank you, > > --jon > > On May 8, 2007, at 8:51 PM, Malcolm Tredinnick wrote: > > > > > On Mon, 2007-05-07 at 22:32 +, roderikk wrote: > >> Hi all, > > >> I have recently started with django and have been able to do good > >> work > >> with the excellent documentation. Thank you. > > >> However, now I am a little baffled. I have created a gallery app. The > >> model exists of a Gallery and Photo which has a foreign key to the > >> Gallery. > > >> Now if I want to use the function photo.get_next_by_date in a > >> template > >> and there is a photo in another gallery which has that next date it > >> will return that photo instead of the next one in the gallery. > > >> In my view there are a number of things I could do but I would > >> like to > >> hear from you which is best... > > >> First of all, if possible can I overwrite the get_next_by_FOO() > >> function so it checks that the gallery is the same, but how? > > > I wouldn't override this function. Just write your own function with > > whatever name you like that does the work you want. The > > get_next_by_FOO() auto-functions are useful in the case of a > > particular > > ordered type of field. If they don't do what you want, just write > > another method that does the "right thing". The name is not important, > > but I would avoid overriding and automatically created function so > > that > > you don't have to always think about whether the automatically created > > thing is being called or your version (it's harder to debug). > > >> Second, I could create a page function in my Photo model as such: > > >> def page(self): > >> photo_list = [x for x in self.gallery.photo_set.all()] > >> ind = photo_list.index(self) > >> return ind + 1 > > >> And create a new template tag 'get_next_by_page' which checks for the > >> page/index. > > > Would also work. > > >> Finally, in the template, which is fed with and object_list, I could > >> also try to go back in the for loop (again, don't know how) and just > >> get the previous/next objects in the list like so: > > >> {% for photo in object_list %} > >> {% if has_next %} > >> {# nextPhoto is object_list[currentCounter + 1 ] ? #} > >> {% endif %} > >> {% endfor %} > > > You can't do complex processing like this in templates. It's a sign > > that > > you should be making things easier for yourself back in the view or in > > the model, as in one of your previous suggestions. > > > Regards, > > Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: TypeError when accessing a RelatedManager?
OK, I got it. I was defining my own managers on Episode, and there was no default manager. Adding an objects=models.Manager() solved it. Maybe this should be added to the documentation? Should I create a ticket? On Jan 28, 1:56 am, orestis <[EMAIL PROTECTED]> wrote: > This is VERY WEIRD: > > In [2]: import django > In [3]: django.get_version() > Out[3]: u'0.97-pre-SVN-7031' > In [4]: from leach.models import Category > In [5]: a = Category.objects.all()[0] > In [6]: a.episodes > --- > TypeError Traceback (most recent call > last) > > /Users/orestis/Developer/skai/skai/ > > /opt/local/lib/python2.4/site-packages/django/db/models/fields/ > related.py in __get__(self, instance, instance_type) > 246 clear.alters_data = True > 247 > --> 248 manager = RelatedManager() > 249 manager.core_filters = {'%s__pk' % rel_field.name: > getattr(instance, rel_field.rel.get_related_field().attname)} > 250 manager.model = self.related.model > > TypeError: __init__() takes at least 2 arguments (1 given) > > > > Here is the code: > > class Kind(models.Model): > title = models.CharField(max_length=100) > description = models.TextField() > extension_final = models.CharField(max_length=10) > extension_temp = models.CharField(max_length=10) > command = models.TextField() > > class Category(models.Model): > title= models.CharField(max_length=100) > description = models.TextField(blank=True) > kind = models.ForeignKey(Kind, radio_admin=True ) > skai_id = models.IntegerField(unique=True) > list_url = models.URLField(max_length=500) > #the episode url uses placeholders so it can't be verified > episode_url = models.URLField(max_length=500, verify_exists=False) > episode_skai_id_regexp = models.CharField(max_length=200) > episode_file_url_regexp = models.CharField(max_length=200) > > class EpisodeManager(models.Manager): > def __init__(self, status, *args, **kwargs): > self.status = status > super(models.Manager, self).__init__(*args,**kwargs) > > def get_query_set(self): > return super(EpisodeManager, > self).get_query_set().filter(status=self.status) > > class Episode(models.Model): > category = models.ForeignKey(Category, related_name='episodes') > skai_id = models.IntegerField(unique=True) > file_url = models.URLField(max_length=500) > filename = models.CharField(max_length=500, editable=False) > #autopopulate this from id > published = models.DateField(editable=False) > ready = models.DateField(null=True, editable=False) > status = > models.CharField(max_length=30,choices=( ('pending','Pending'), > ('downloading','Downloading'),('waiting', 'Waiting'), > ('converting','Converting'), ('finished','Finished') )) > > pending = EpisodeManager('pending') > downloading = EpisodeManager('downloading') > waiting = EpisodeManager('waiting') > converting = EpisodeManager('converting') > finished = EpisodeManager('finished') > > > > Everything works in admin, I have added some sample data. When some > code tries to access 'categoty.episodes' it blows up. Beats me why... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
TypeError when accessing a RelatedManager?
This is VERY WEIRD: In [2]: import django In [3]: django.get_version() Out[3]: u'0.97-pre-SVN-7031' In [4]: from leach.models import Category In [5]: a = Category.objects.all()[0] In [6]: a.episodes --- TypeError Traceback (most recent call last) /Users/orestis/Developer/skai/skai/ /opt/local/lib/python2.4/site-packages/django/db/models/fields/ related.py in __get__(self, instance, instance_type) 246 clear.alters_data = True 247 --> 248 manager = RelatedManager() 249 manager.core_filters = {'%s__pk' % rel_field.name: getattr(instance, rel_field.rel.get_related_field().attname)} 250 manager.model = self.related.model TypeError: __init__() takes at least 2 arguments (1 given) Here is the code: class Kind(models.Model): title = models.CharField(max_length=100) description = models.TextField() extension_final = models.CharField(max_length=10) extension_temp = models.CharField(max_length=10) command = models.TextField() class Category(models.Model): title= models.CharField(max_length=100) description = models.TextField(blank=True) kind = models.ForeignKey(Kind, radio_admin=True ) skai_id = models.IntegerField(unique=True) list_url = models.URLField(max_length=500) #the episode url uses placeholders so it can't be verified episode_url = models.URLField(max_length=500, verify_exists=False) episode_skai_id_regexp = models.CharField(max_length=200) episode_file_url_regexp = models.CharField(max_length=200) class EpisodeManager(models.Manager): def __init__(self, status, *args, **kwargs): self.status = status super(models.Manager, self).__init__(*args,**kwargs) def get_query_set(self): return super(EpisodeManager, self).get_query_set().filter(status=self.status) class Episode(models.Model): category = models.ForeignKey(Category, related_name='episodes') skai_id = models.IntegerField(unique=True) file_url = models.URLField(max_length=500) filename = models.CharField(max_length=500, editable=False) #autopopulate this from id published = models.DateField(editable=False) ready = models.DateField(null=True, editable=False) status = models.CharField(max_length=30,choices=( ('pending','Pending'), ('downloading','Downloading'),('waiting', 'Waiting'), ('converting','Converting'), ('finished','Finished') )) pending = EpisodeManager('pending') downloading = EpisodeManager('downloading') waiting = EpisodeManager('waiting') converting = EpisodeManager('converting') finished = EpisodeManager('finished') Everything works in admin, I have added some sample data. When some code tries to access 'categoty.episodes' it blows up. Beats me why... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: newforms and FileInput
I think (I'm not sure that it does nothing, and you have to manually use request.FILES to get the file you want, and manually upload it to wherever you want. Please someone correct me if I'm wrong. It's a kludge for now, but I think (hope) Adrian is working on it... If it worked automatically (the simplest case is to access the file via the form field) it would save a lot of manual work... On Mar 3, 8:49 pm, "sansmojo" <[EMAIL PROTECTED]> wrote: > Stupid question, but I've not had to handle this so far with Django. > I'm getting used tonewforms, but I'm not sure how much it handles > when you use a FileInput widget. Does ituploadthefileto the > upload_to directory you specify in the model on form.save()? If not, > what is the recommended process to use for this? > > Thanks! > > Branton --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
newforms - filling a custom form with data from a model instance
Since form_for_model isn't nearly finished yet (regarding with FileFields and customization - or I just can't find how it works), I have decided to just repeat myself and create my own forms. I thought that it'd be very intuitive if a form instance gets bound to the data from a model instance, but it seems it doesn't. To clarify things: def MyForm(newforms.Form): field1=newforms.CharField() field2=newforms.CharField() def MyModel(models.Model): field1=models.TextField() field2=models.TextField() m = MyModel.objects.get(pk=1) f = MyForm(f) # this should pre-populate the form with the data from the model, but it doesn't. #In fact, nothing even gets displayed on the screen... Am I assuming something wrong ? I'd love to use form_for_model, but I'm using compound models (it's a user profile, really) and it's not very useful, as I'll still have to customize it extensively. Or should I just display more than one form on a page ? Meaning: def myview(request): form1 = MyForm1(request.POST) # some fields are here form2 = MyForm2(request.POST) # some other fields are here #save the forms. The user will see just one form, but it'll be split behind the scenes to map to different Forms and Models... Do I make sense ? Thanks :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: newforms - filling a custom form with data from a model instance
What I have done is this: @classmethod def load_from_model(clazz, model): data = {} fields = clazz.base_fields for field in fields.keys(): try: data[field]=getattr(model,field) except AttributeError: print field, "is not present in", model #add non-simple mappings here. eg: data['esso']=model.child.esso form = clazz(data) return form def save_to_model(self, model): model.user.first_name = self.clean_data['first_name'] model.user.last_name = self.clean_data['last_name'] # more here... model.save() model.user.save() it's violating the DRY principle, but at least it's only in one place, the form Declaration, so it's easy to change. For more trivial use cases (no compound models etc), I think that the form_for_model will generate the same results. On Mar 6, 11:10 pm, [EMAIL PROTECTED] wrote: > I had similar problems, trying to tie the form and model too closely.>From > what I understand the form needs to be aware of the model(s), but > > there isn't anything forcing you to a 1:1 relationship (form_for_model > does that for convenience, but isn't the only way). You just have to > override __init__() and save() for the form, and handle the model > specific stuff there. I'm just starting with Django though, so > hopefully someone more knowledgeable will chime in and either confirm > or show us the right way! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
newforms - outputting dates in the same format as input
As it stands, the when using a newforms.DateField with specified input formats, it gets parsed alright, but when rendering the form there is no way to specify the output format, it gets printed as -MM-DD. This not only is a bad localization practice, it makes _using_ the input formats impossible, since when re-submitting a populated form without changes, you get validation errors. I can't find a ticket for this... Surely I'm not the first to bump into 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 -~--~~~~--~~--~--~---
Re: newforms - filling a custom form with data from a model instance
Duh! I didn't know there was a __dict__ available on a model :) Maybe this code can be made simpler. On Mar 7, 10:32 am, "orestis" <[EMAIL PROTECTED]> wrote: > What I have done is this: > > @classmethod > def load_from_model(clazz, model): > data = {} > fields = clazz.base_fields > for field in fields.keys(): > try: > data[field]=getattr(model,field) > except AttributeError: > print field, "is not present in", model > #add non-simple mappings here. eg: > data['esso']=model.child.esso > form = clazz(data) > return form > > def save_to_model(self, model): > model.user.first_name = self.clean_data['first_name'] > model.user.last_name = self.clean_data['last_name'] > # more here... > model.save() > model.user.save() > > it's violating the DRY principle, but at least it's only in one place, > the form Declaration, so it's easy to change. For more trivial use > cases (no compound models etc), I think that the form_for_model will > generate the same results. > > On Mar 6, 11:10 pm, [EMAIL PROTECTED] wrote: > > > I had similar problems, trying to tie the form and model too closely.>From > > what I understand the form needs to be aware of the model(s), but > > > there isn't anything forcing you to a 1:1 relationship (form_for_model > > does that for convenience, but isn't the only way). You just have to > > override __init__() and save() for the form, and handle the model > > specific stuff there. I'm just starting with Django though, so > > hopefully someone more knowledgeable will chime in and either confirm > > or show us the right way! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: newforms - outputting dates in the same format as input
Here it is: http://code.djangoproject.com/ticket/3672 On Mar 7, 12:42 pm, "Frankie Robertson" <[EMAIL PROTECTED]> wrote: > On 07/03/07, orestis <[EMAIL PROTECTED]> wrote: > > > > > As it stands, the when using a newforms.DateField with specified input > > formats, it gets parsed alright, but when rendering the form there is > > no way to specify the output format, it gets printed as -MM-DD. > > > This not only is a bad localization practice, it makes _using_ the > > input formats impossible, since when re-submitting a populated form > > without changes, you get validation errors. > > > I can't find a ticket for this... Surely I'm not the first to bump > > into this ? > > I think you are. I've done a quick search. Go ahead and file a ticket. > The worst that can happen is that it gets marked as a dupe and at > least you looked first. > > > > --http://grimboy.co.uk --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Calling all translators - handling international date display
I'll give you a short description here: The date filter doesn't have any internationalization or localization knowledge built-in. This plays havoc with languages that have genders, cases etc (Greek, German, French and many more) and use them in displaying dates. There is a discussion at http://groups.google.com/group/Django-I18N/browse_thread/thread/3f5dfb2a9a10f904 and a ticket at http://code.djangoproject.com/ticket/4147 that aim to correct this. I have a proposition for my own language (Greek) but we have to see the big picture here, and make as unobtrusive changes as possible, per Malcolm's request. So please come to the discussion and share your thoughts on 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 -~--~~~~--~~--~--~---
Alternative ForeignKey selection interface in admin
Hello, I've searched and I didn't find any good answers on this: When you use the admin interface to specify a foreign key on a model, you get a nice little drop-down with a cool plus button to add more. This is manageable for about 10-20 entries. For more, there are issues: a) Usability goes down as it is hard to find and click and make sure that you've selected the right instance b) The text representation of the ForeignKey model may not be enough. A notable example of this are images. The solution is very simple: Make an option so that the user can use a popup, using something like the list display of the admin (which should have search fields set), so he can filter down the options he has. He should be able to view the whole object (not just the __str__ output), issue search queries etc. Is there a way to hook up something like this ? I don't mind writing my own list display for this (in fact I think it should be an option) but how can I override the widget the admin produces ? I think this is common enough to be addressed centrally. BTW, is this about to be implemented on newforms-admin ? The documentation is a bit cryptic. PS. As I typed this, an idea struck: Use raw_id_admin, then use some JS functionality to open the pop-up, display a normal view of objects etc, and use a callback to set the id in the admin. Good for a quick hack, but ultimately the raw_id_admin doesn't cut it. A good example is again images: When an image is selected, you should be able to see the image - or the thumbnail. A text string or an id tells very little. I'd appreciate any feedback on 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 -~--~~~~--~~--~--~---
Re: Random features in sidebar
Put in a simple, hard coded python list and use random on this ? You can put callables in the list that return the right info, so you can automate the stuff... On May 11, 10:44 pm, Mordy Ovits <[EMAIL PROTECTED]> wrote: > I have a sidebar in my page design. I have 7 or so features that can > go in a sidebar (links, quote of the day, infostat, on this day in > history, etc.). I have models for each of those features. > > I can easily use django to have the template fill those out for every > page, but what I want is to choose 3 features of the seven at random. > The point is to have 3 feaures in the sidebar of every page, but the > specific three are chosen at random. > > I understand how to choose a random quote (using count and rand the > slice of the queryset). I can't figure out how to have the features > themselves be random. What's a sensible way to have n of m features, > chosen at random, on the page? > > Thanks, > Mordy --~--~-~--~~~---~--~~ 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: Alternative ForeignKey selection interface in admin
OK I'm stupid :) It seems that raw_id_admin actually does this already. I didn't notice that before... So never mind :) On May 11, 4:45 am, orestis <[EMAIL PROTECTED]> wrote: > Hello, > > I've searched and I didn't find any good answers on this: > > When you use the admin interface to specify a foreign key on a model, > you get a nice little drop-down with a cool plus button to add more. > This is manageable for about 10-20 entries. For more, there are > issues: > > a) Usability goes down as it is hard to find and click and make sure > that you've selected the right instance > b) The text representation of the ForeignKey model may not be enough. > A notable example of this are images. > > The solution is very simple: Make an option so that the user can use a > popup, using something like the list display of the admin (which > should have search fields set), so he can filter down the options he > has. He should be able to view the whole object (not just the __str__ > output), issue search queries etc. > > Is there a way to hook up something like this ? I don't mind writing > my own list display for this (in fact I think it should be an option) > but how can I override the widget the admin produces ? > > I think this is common enough to be addressed centrally. > > BTW, is this about to be implemented on newforms-admin ? The > documentation is a bit cryptic. > > PS. As I typed this, an idea struck: Use raw_id_admin, then use some > JS functionality to open the pop-up, display a normal view of objects > etc, and use a callback to set the id in the admin. Good for a quick > hack, but ultimately the raw_id_admin doesn't cut it. A good example > is again images: When an image is selected, you should be able to see > the image - or the thumbnail. A text string or an id tells very > little. > > I'd appreciate any feedback on 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 -~--~~~~--~~--~--~---
Help on custom edit_inline admin template
I've created my own edit_inline class so I can override the template. This was easy. However, due to lack of documentation, I'm busting my head trying to figure out how to do this: I have an Article that is connected to a Photos model using the ArticleImage model like this: class ArticleImages(models.Model): article = models.ForeignKey(Article, edit_inline=ArticleImageRelatedObject, num_in_admin=5, max_num_in_admin=99, num_extra_on_change=3, related_name='article_images') photo = models.ForeignKey(Photo, raw_id_admin=True) number = models.IntegerField(core=True, help_text='Delete this to delete the image') I have copied the ArticleImageRelatedObject from the TabularRelatedObject: class ArticleImageRelatedObject(BoundRelatedObject): def __init__(self, related_object, field_mapping, original): super(ArticleImageRelatedObject, self).__init__(related_object, field_mapping, original) self.field_wrapper_list = [FieldWrapper(field) for field in self.relation.editable_fields()] fields = self.relation.editable_fields() self.form_field_collection_wrappers = [FormFieldCollectionWrapper(field_mapping, fields, i) for (i,field_mapping) in self.field_mappings.items() ] self.original_row_needed = max([fw.use_raw_id_admin() for fw in self.field_wrapper_list]) self.show_url = original and hasattr(self.relation.opts, 'get_absolute_url') def template_name(self): return "admin/articles/articleimages/ edit_inline_tabular.html" I've just extended the template. What I would like to do, is to display another link next to the 'show_url', which has value related to the ArticleImage object. I can't for the life of me figure out how to access the original ArticleImage instance from the ArticleImageRelatedObject. Please help! --~--~-~--~~~---~--~~ 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: Grabbing a list of years, months, etc.
You ca use: Entry.objects.all().dates('pub_date','month','DESC') lookup the dates function of the QuerySet. On May 12, 7:18 pm, Peter Sanchez <[EMAIL PROTECTED]> wrote: > I am working on my first "real" django project which includes a weblog. > > I would like to create an Archives page that lists each year and > month of that year, dynamically. > > ie, > > May, 2007 > April, 2007 > > November, 2006 > etc.. > > Is this possible to generate quickly from a model containing a > DateTimeField? I know I could do it myself, using lists + sort, but I > was hoping there was a quick django way to generate the data. Any ideas? > > Thanks, > > Peter --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
My django-related blog
I've sent this to Jacob to be included in the blog roll, but since he hasn't responded still, maybe the email somehow went missing. So, drop by my blog: http://orestis.gr/ and leave a comment. I plan to have a lot of write-ups about the making of it, and as I discover more features of Django I'll post them. I'd appreciate a comment! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Difficulties with thread locals
Hello, I'm having a weird python error, and I can't seem to find out what's wrong. I wanted to extend the site framework, so I can use it for multilingual content. The way to do this is to override the SITE_ID with a function: import threadlocals def SITE_ID(): lang = threadlocals.get_current_lang() if lang=='en': return 1 else: return 2 I've also added the ThreadLocals middleware discussed in the CookBook [0]. The problem is, I think, the funky code path of django settings. I see the ThreadLocals middleware imported 4 times, and, all in all, there are different threadlocal objects that of course return different results. Is there any way to troubleshoot this ? Am I missing something big here ? I know the sites framework wasn't designed to do this, but it seemed a natural extension for me. To rephrase: Is there a way I can guarantee that the threadlocal object I create in the middleware will be the same that the SITE_ID function in the settings file will get ? [0] http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser --~--~-~--~~~---~--~~ 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: Difficulties with thread locals
OK, after digging around the django source, it seems that the database cursors, where the SITE_ID is read runs at a different thread. I also looked into the translation framework, it uses "currentThread" to fetch the current active translation. So what should I do ? This is tricky stuff... On May 14, 3:52 am, orestis <[EMAIL PROTECTED]> wrote: > Hello, > > I'm having a weird python error, and I can't seem to find out what's > wrong. > > I wanted to extend the site framework, so I can use it for > multilingual content. The way to do this is to override the SITE_ID > with a function: > > import threadlocals > def SITE_ID(): > lang = threadlocals.get_current_lang() > if lang=='en': return 1 > else: return 2 > > I've also added the ThreadLocals middleware discussed in the CookBook > [0]. The problem is, I think, the funky code path of django settings. > I see the ThreadLocals middleware imported 4 times, and, all in all, > there are different threadlocal objects that of course return > different results. > > Is there any way to troubleshoot this ? Am I missing something big > here ? I know the sites framework wasn't designed to do this, but it > seemed a natural extension for me. > > To rephrase: Is there a way I can guarantee that the threadlocal > object I create in the middleware will be the same that the SITE_ID > function in the settings file will get ? > > [0]http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser --~--~-~--~~~---~--~~ 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: Difficulties with thread locals
I see. I noticed this was tricky stuff. I guess that setting the SITE_ID each time will lead to race conditions etc, right ? So it's back to the drawing board. Using sites for multilingual content was cool because it allowed me to use the built in functionality of django.contrib very easily... So if this could be changed it'd be nice! Any ideas ? Thanks Malcolm Tredinnick wrote: > On Mon, 2007-05-14 at 00:52 +, orestis wrote: > > Hello, > > > > I'm having a weird python error, and I can't seem to find out what's > > wrong. > > > > I wanted to extend the site framework, so I can use it for > > multilingual content. The way to do this is to override the SITE_ID > > with a function: > > > > import threadlocals > > def SITE_ID(): > > lang = threadlocals.get_current_lang() > > if lang=='en': return 1 > > else: return 2 > > > > I've also added the ThreadLocals middleware discussed in the CookBook > > [0]. The problem is, I think, the funky code path of django settings. > > I see the ThreadLocals middleware imported 4 times, and, all in all, > > there are different threadlocal objects that of course return > > different results. > > > > Is there any way to troubleshoot this ? Am I missing something big > > here ? I know the sites framework wasn't designed to do this, but it > > seemed a natural extension for me. > > > > To rephrase: Is there a way I can guarantee that the threadlocal > > object I create in the middleware will be the same that the SITE_ID > > function in the settings file will get ? > > I think you are confusing import time with execution time. Your code > will be imported once per process and then reused lots of times. So > trying to do anything related to "the current thread" at import time is > a losing game. > > There is also a fair bit of code outside of settings that reads SITE_ID > at import time, so expecting it to be dynamically evaluated is not going > to work. > > Regards, > Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Different django versions on same host
Hello, I think this will be easy to do, but I just want to check: Is it possible to have different Django versions on the same host, and point my sites to different versions ? I'd like to use bleeding edge for personal stuff (yay for experimentation) but for any work-related material, I want stability, so I'd use 0.96 or whatever version is out and stable at the time, to minimize headaches... I think it'd be as easy as putting two different django versions like this: django96 django-trunk under site packages and use in my settings file: import django96 as django right ? Or should I just use the PYTHONPATH env variable to point to the right django installation ? Has anybody done 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 -~--~~~~--~~--~--~---
Re: View (maybe middleware?) question
I've done something similar to this, putting the site language in the url. Basically you create a middleware process_request, that will take request.path and set it to something else. For example you might do: request.path = "/app/theme/view/" parts = request.path.split("/") request.path = "/"+parts[0]+"/"+parts[2] theme = parts[1] #do something with the theme... return None Then your urlconfs will go on without knowing about the theme logic. Beware, though: This can lead to many strange errors when this catches paths you don't want to be processed. You also have to worry about search engines. It might be better to apply the same middleware to extract something from the session/query parameters. On May 31, 1:23 am, Robert Coup <[EMAIL PROTECTED]> wrote: > Chris Kelly wrote: > > I am in the process of writing an app that will have a "theme" based > > on if a subdirectory is specified e.g.: > > >http://somesite.com/app/(theme)/abunchofviews/ > > > basically, if they go to /app/bluetheme/register, it'll give them a > > registration page with a blue theme header and footer (it looks up a > > theme object based on the value specifed in the url, and gets header > > images, etc from said object). Likewise, if "greentheme" is specified, > > they would get a green-themed registration page. This way, someone can > > later just go into the django admin section and create a new "theme" > > by specifying a new header and footer image. > > I know it doesn't answer your question, but search engines will see a > different page for each different theme (eg. /red/mypage1 will be seen > as a different page from /green/mypage1). > > Maybe storing the theme in a user preference/session might be easier? A > user could visit /theme/green/ to set the 'green' theme, then redirect > to any of your normal application pages, which use the preference to > decide . > > Rob :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Problem with flatpages and absolute urls
I have a problem with flatpages. When putting links in my templates, I use absolute URLs without prepending http://hostname.com/ For example, Home gets interpreted by the browser as a link to http://hostname.com/, and all is correct. However, when a flatpage is being served, those links get interpreted literally, so the link now is http:/// which is of course useless. I suspect this is something to do with the 404 response that triggers something in firefox. So what am I supposed to do ? Should I prepend everything with the hostname ? How can I get the current site (so I won't couple the template to the site) ? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem with flatpages and absolute urls
OK never mind about this. It was my error, I was creating some URLs like this: /{{var}}/path1/path2/ and sometimes var wasn't set so the url becomes: //path1/path2/ which replaces everything in the browser... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Weird 404 errors
Hello, I have recently published my humble blog on http://orestis.gr I get a stream of weird 404 errors in my email inbox, but for the life of me I can't figure out what's wrong. Here are some examples: >Referrer: http://orestis.gr/en/blog/2007/05/06/international-part1/ >Requested URL: /blog/2007/05/06/international-part1/feed2.png >User agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20061= >201 Firefox/2.0.0.3 (Ubuntu-feisty) However, the feed2.png icon is referenced normally at /static/images/ feed2.png, and I can't figure out how this request is made (short of typing it into by hand, but I don't think this is happening) Also: >Referrer: http://orestis.gr/en/blog/2007/05/07/adding-preview/ >Requested URL: /blog/2007/05/07/adding-preview/en/comments/postfree/ >User agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv:1.8.1b2) >Gecko/20060821 Firefox/2.0b2 You can recognize the /comments/postfree/ part, as part of the comment form, I add the /en/ part for my multilingual implementation. The form action is correctly set as "/en/comments/postfree/". The puzzling issue is that when I navigate to my site (using both my and other people's computers) I get no errors, no 404, nothing. I suspect that these are just broken spiders that don't know how to manage relative urls, but I'm not sure. Any ideas ? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Deployment using cpanel
Hello, I need some help on deploying django on a cpanel shared server. I follow the last section in the documentation on using fastcgi, but I get the following error when hitting the URL: [Sun Oct 1 18:19:00 2006] [error] [client xx.xx.xx.xx] FastCGI: incomplete headers (0 bytes) received from server "/home/pinetree/public_html/django/mysite.fcgi" [Sun Oct 1 18:19:00 2006] [warn] FastCGI: (dynamic) server "/home/pinetree/public_html/django/mysite.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds [Sun Oct 1 18:19:00 2006] [error] [client xx.xx.xx.xx] FastCGI: comm with (dynamic) server "/home/pinetree/public_html/django/mysite.fcgi" aborted: (first read) idle timeout (30 sec) [Sun Oct 1 18:18:57 2006] [warn] FastCGI: (dynamic) server "/home/pinetree/public_html/django/mysite.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds [Sun Oct 1 18:17:20 2006] [warn] FastCGI: (dynamic) server "/home/pinetree/public_html/django/mysite.fcgi" (pid 30001) terminated by calling exit with status '255' FastCGI: can't start server "/home/pinetree/public_html/django/mysite.fcgi" (pid 30001), execle() failed: No such file or directory I have copied the django dir from site-packages to /home/[username]/django ,also flup to /home/[username]/flup I have pointed the os.path to /home/[username]/django, I have chmoded (via ftp) the mysite.fcgi. I don't know what else to do... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Shared hosting - FastCGI problems
The docs aren't quite clear on this. I follow the last section in the documentation http://www.djangoproject.com/documentation/fastcgi/ But when accessing the url, I get the following in the error log: [Sun Oct 1 18:07:38 2006] [error] [client xx.xx.xx.xx] File does not exist: /home/[username]/public_html/500.shtml [Sun Oct 1 18:07:38 2006] [error] [client xx.xx.xx.xx] FastCGI: incomplete headers (0 bytes) received from server "/home/[username]/public_html/django/mysite.fcgi" [Sun Oct 1 18:07:38 2006] [error] [client xx.xx.xx.xx] FastCGI: comm with (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" aborted: (first read) idle timeout (30 sec) [Sun Oct 1 18:07:35 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds [Sun Oct 1 18:07:32 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds [Sun Oct 1 18:07:29 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds [Sun Oct 1 18:07:26 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds [Sun Oct 1 18:07:23 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds [Sun Oct 1 18:07:21 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds [Sun Oct 1 18:07:20 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds [Sun Oct 1 18:07:20 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" (pid 25302) terminated by calling exit with status '255' FastCGI: can't start server "/home/[username]/public_html/django/mysite.fcgi" (pid 25302), execle() failed: No such file or directory [Sun Oct 1 18:07:20 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" restarted (pid 25302) [Sun Oct 1 18:07:15 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" (pid 25279) terminated by calling exit with status '255' FastCGI: can't start server "/home/[username]/public_html/django/mysite.fcgi" (pid 25279), execle() failed: No such file or directory [Sun Oct 1 18:07:15 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" restarted (pid 25279) [Sun Oct 1 18:07:10 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" (pid 25276) terminated by calling exit with status '255' FastCGI: can't start server "/home/[username]/public_html/django/mysite.fcgi" (pid 25276), execle() failed: No such file or directory [Sun Oct 1 18:07:10 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" restarted (pid 25276) [Sun Oct 1 18:07:05 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" (pid 25272) terminated by calling exit with status '255' FastCGI: can't start server "/home/[username]/public_html/django/mysite.fcgi" (pid 25272), execle() failed: No such file or directory [Sun Oct 1 18:07:05 2006] [warn] FastCGI: (dynamic) server "/home/[username]/public_html/django/mysite.fcgi" started (pid 25272) Any pointers ? I haven't installed django or anything yet, trying to get this up step by step. I also don't have shell access, but I can chmod files. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Shared hosting - FastCGI problems
Sorry for the double post, this message didn't show up for 12 hours or so. Please continue here: http://groups.google.com/group/django-users/browse_frm/thread/ca36e7f1ce71c577/93ec9ceebf4bbd5e#93ec9ceebf4bbd5e --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Unicode and django/db/backends/util.py
usually encode('utf-8') is needed only when printing the strings. You can pass them aroung without problem. BTW, unicode chars should appear like '\u0345' ... I'm not so sure about that though. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Displaying number of visitors
Following this thread: http://groups.google.com/group/django-users/browse_frm/thread/f11c67142c7dd71a/2bdeb945f7bf2232?lnk=gst&q=visitors&rnum=2#2bdeb945f7bf2232 It is mentioned that to display a list of visitors (anonymous and logged in) I have to use the session framework. However, in the docs, I can't find anything that does what I want. So I ask: How can access from the session object ALL visitors so I can display in my site: "7 visitors currently browsing the site, 5 of them are already registered" Or something like that ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Display related foreign key values in Admin - but not inline
Hello, I have a model of EnglishWords and GreekWords. EnglishWords are referenced as a ForeignKey in GreekWords, ie one EnglishWord may have more than one GreekWords referencing it. I would like when going in admin to edit an EnglishWord to see what Greek words are referencing it, and be able to click on each GreekWord and go to its edit page. If I use edit_inline, I suppose I'll get a huge select box of all the GreekWords there, and I don't want that. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Display related foreign key values in Admin - but not inline
Thanks! I'll try that and get back here... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Displaying number of visitors
Thanks! I'll try that! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
FastCGI on Dreamhost: Multiple processes ?
Hello, I was having periodical troubles with the FastCGI approach on DreamHost. I was following the documentation regarding FastCGI on a shared host. I contacted support and they replied with this: Oct 11 16:49:01 smithers Procwatch: killed naughty pid 10811 - orestis with /usr/bin/python2.4 django.fcgi [user over proc limit] Oct 11 16:49:01 smithers Procwatch: killed naughty pid 17736 - orestis with /usr/bin/python2.4 django.fcgi [user over proc limit] Oct 11 16:49:01 smithers Procwatch: killed naughty pid 13671 - orestis with /usr/bin/python2.4 django.fcgi [user over proc limit] Oct 11 16:49:01 smithers Procwatch: killed naughty pid 30852 - orestis with /usr/bin/python2.4 django.fcgi [user over proc limit] Oct 11 16:49:01 smithers Procwatch: killed naughty pid 1063 - orestis with /usr/bin/python2.4 django.fcgi [user over proc limit] Oct 11 16:49:01 smithers Procwatch: killed naughty pid 6372 - orestis with /usr/bin/python2.4 django.fcgi [user over proc limit] Oct 11 16:49:01 smithers Procwatch: killed naughty pid 27255 - orestis with /usr/bin/python2.4 django.fcgi [user over proc limit] Oct 11 16:49:01 smithers Procwatch: killed naughty pid 9826 - orestis with /usr/bin/python2.4 django.fcgi [user over proc limit] Oct 11 16:49:01 smithers Procwatch: killed naughty pid 10161 - orestis with /usr/bin/python2.4 django.fcgi [user over proc limit] Oct 11 16:49:01 smithers Procwatch: killed naughty pid 23107 - orestis with /usr/bin/python2.4 django.fcgi [user over proc limit] Oct 11 16:49:01 smithers Procwatch: killed naughty pid 27476 - orestis with /usr/bin/python2.4 django.fcgi [user over proc limit] Oct 11 16:49:01 smithers Procwatch: killed naughty pid 935 - orestis with /usr/bin/python2.4 django.fcgi [user over proc limit] Oct 11 18:46:02 smithers Procwatch: killed naughty pid 7957 - orestis with /usr/bin/python2.4 django.fcgi [user over proc limit] (smithers is the server, orestis the username) And I wonder: Won't the django.fcgi file described in the docs create 5 processes each time a user hits it ? Shouldn't I just run it from the command-line to spawn 5 instances of a server, then change the django.fcgi to route requests/responses to the already created instances ? Please help! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Flup error log
I've been browsing the rails mailing lists for a while, they seem to have a fastcgi.crash.log that gets all the fastcgi problems, instead of passing them to the apache error.log Is there any way to do this with flup ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Flup error log
Here is the responsible handler in Rails: http://dev.rubyonrails.org/browser/trunk/railties/lib/fcgi_handler.rb --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Django + views like a threads
Why do you sleep(10) ? I can't think of any possible reason... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Displaying number of visitors
OK, I did it. Unfortunately, the session table is using pickled data, so the processing has to be done in django. Here it goes: In views that you would like to refresh the active state of a user, add: request.session['last_seen']= datetime.datetime.now() Then, in a util.py : from django.contrib.sessions.models import Session from django.contrib.auth.models import User import datetime time_limit = datetime.timedelta(minutes=10) def get_active(): sessions = Session.objects.all() active = [] now = datetime.datetime.now() for s in sessions: s_dict = s.get_decoded() if 'last_seen' in s_dict: last_seen = s_dict['last_seen'] if now - last_seen < time_limit: user = User.objects.get(pk=s_dict['_auth_user_id']) active.append(user) return active Then, just create a template tag that prints out the users. Maybe this should be moved in the docs/wiki ? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How the @$$#% can I debug FastCGI errors ?
This is driving me CRAZY! The FastCGI logs show nothing (the stupid incomplete headers message). However, I get my custom FastCGI error page. (internal_error.html). My site is on and off every 5 minutes, I can't stand it. I've contacted the host (dreamhost) but I've yet to get an answer. PLEASE PLEASE someone if you know how to deal with this stuff drop a line here. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: How the @$$#% can I debug FastCGI errors ?
Nope, unfortunately this doesn't help with fastcgi internal errors. Even if debug = True or debug = False, if there is an internal fastcgi error, you won't get either the django error page, or the flup error page. Instead you get a standard 500 server error (in Firefox at least) which I can replace with an html page named internal_error.html. Sorry if that was confusing. My app is working fine, I suspect this is a host issue, but I have no data to back-up my claim... And it is driving me crazy. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
extending the auth model to display more fields in admin
Hello, I have a simple need: I'd like to view/sort in the admin the signup date of my users. How can I add a field in the User Admin list_display ? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Order of request - sessions processing ?
OK, I'm having a silly problem: In one view I set a property in the user's session. Then, in the template returned by the same view, a custom template tag queries the database Session objects and displays a message depending on the property set before. However, this doesn't work the first time. Only after the second time does the template tag "get" the modified session. I would like the processing to happen in the following order: request -> my view modifies session -> session is saved in the db -> my template tag reads sessions -> render response However, I imagine that the order is like this: request -> my view modifies session -> my template tag reads sessions -> render response -> session is saved in the db And this is why it works the second time round. Is there any way I can call save() on the session explicitly ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Custom administration interfaces
I'm not sure about that, but I remember reading that to display checkboxes in the admin interface lists you have to do some hacking, this is not provided out of the box. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Order of request - sessions processing ?
Ah, I tried to call the session middleware directly, but now I see that the render_to_response actually calls the tag processing code. So here is what I did: def save_session(request): session_key = request.session.session_key or Session.objects.get_new_session_key() Session.objects.save(session_key, request.session._session, datetime.datetime.now() + datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE)) and I call this function if I want to prematurely end the session. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: some problems that make my work hard or force me to use AntiPatterns
I have created a middleware for dealing with inactivity in sessions. See the related documentation page. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: ANN: Chesspark - A django based online chess community.
Very nice indeed! Maybe you can make a write up describing some design/implementation issues? I'm particularly interested in the Jabber integration and the cool DHTML in the web client... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: URL generation, symbolic referencing possible?
ed chan wrote: > Thanks Don, I looked at urlresolvers.py and it is exactly the type of thing > i'm looking for. This thread was posted, as you said, several months ago. > Are there any plans to standardize this feature / implementation? > > Ed. > It is already in trunk http://code.djangoproject.com/browser/django/trunk/django/core/urlresolvers.py?rev= - I can't find any documentation on this or a template tag that uses it. It shouldn't be that hard to implement though... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: fcgi and shared hosting
Well, my experience is: You should totally make sure that there are no errors in your application. Even small ones that normally wouldn't cause django to hiccup may cause strange things with FastCGI. Also you should add the needed 404 and 500 pages needed for FastCGI. Check about 404 errors from the CSS, favicon etc. There should be no errors about these things on apache's error log. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: extending the auth model to display more fields in admin
Anyone ? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Saving arbitrary data without database
Hello, I would like to save some arbitrary data that there's no point in keeping in a database. It's just a float number really, that some of my models will use, and it will be updated using a cron job. It will not presented in a template, just within some methods of a model. What the heck, here's the full description: I have defined a next() method that returns the next entry to be updated. I want this to have a different behavior according to the state of the data already present in the database. So I have made some code that analyzes the current data and produces a threshold between 0 and 1, then I generate random numbers and decide what behavior to choose depending random()>THRESHOLD. The THRESHOLD will be calculated via a cron job - that's not a big issue. The issue is, how can I store the new value somewhere so everyone can just import and use it ? Instead of pickling and unpickling, I was wondering if Django has some datastore for this kind of thing... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: extending the auth model to display more fields in admin
Thanks, but that will not do. I want the fields to show up in the admin list display. I don't want to add any new fields. I just want to view more fields in the list, and be allowed to sort on them (eg. to sort by date of creation 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 -~--~~~~--~~--~--~---
Re: Help with List_display in Admin class
AFAIK, to create instance variables, you have to define them in the __init__(self) function of your class. Defining them in other methods will not do. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Help with List_display in Admin class
try this: def _get_full_name(self): "Returns the person's full name." return '%s %s' % (self.first_name, self.last_name) full_name = property(_get_full_name) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: extending the auth model to display more fields in admin
Sorry to cause misunderstanding. Anyway, thanks to the great #django channel, I figured this out: def hack_user(sender, args , kwargs): sender._meta.admin.list_display=('username', 'email', 'first_name', 'last_name', 'is_staff', 'date_joined') pass from django.db.models import signals from django.dispatch import dispatcher dispatcher.connect(hack_user, sender=User, signal=signals.pre_init) This is called on the creation of every User instance, I hope it won't cause too much overhead... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Best configuration for small VPS
Hello, I got a trial server at budgetdedicated.com, seems very nice. The price is comparable to shared hosting, everything seems fine. Anyway, I'm interested in minimizing memory usage. What kind of configuration is preferred for that ? lighttpd or apache2 ? mysql or postgres ? I'll have to figure out why I have 10 mysqld instances eating 45M out of 64M of memory. Each apache2 process eats about 7M of memory. I sure will add memory if the load is too big, but I'd like to make sure I use the most efficient tools. BTW the distro is ubuntu dapper. Thanks everyone! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Django Host Provider
http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: media files with django dev-server
You mention dev-server, yet you talk about apache and lighttpd. If running the dev-server, you shouldn't do anything, since it figures out itself how to serve files. If you're running apache, either with mod_python or with mod_fcgi, you should just create a link to the /foo/bar/admin/media directory in your www directory. You then have to edit settings.py to tell the admin where to look for its media. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: media files with django dev-server
I think you have confused some concepts. /django/contrib/admin/media/ hosts the admin media files. You mention content uploaded by users... In what directory is this put under ? Static files are documented here: http://www.djangoproject.com/documentation/static_files/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Saving arbitrary data without database
Thanks all for the recommendations! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Best configuration for small VPS
Sqlite ? In a production site ? Does anyone use this ? I sincerely never heard of 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: media files with django dev-server
Look, there are two distinct things here: a) The admin media, which physically resides on django/contrib/admin/media and which the dev-server serves automagically and b) Your own media, which you are responsible of serving, either in production or development mode Here's what I do: For admin media: ADMIN_MEDIA_PREFIX = '/media/' this results in the following url in admin (generated): For my own media, I use the following url (hand coded): href="/static/a/b/c/style.css" Then, for the development server: Admin media: Do nothing My media: add the following line to the main urls.py urlpatterns += patterns('', (r'^static/(?P.*)$', 'django.views.static.serve', {'document_root': 'D:/orestis/django/static/'}), ) Where 'D:/orestis/django/static/' is the directory which holds the media. For the production server: Admin media: Create a link named "media" under the root www directory that points to django/contrib/admin/media My media: copy the static directory mentioned above to the root www directory. Comment the above added line in urls.py So your www directory should have: media (symlink) static (directory with your media) Then you have to instruct your webserver to deal with those two directories as it would, ie. without any django processing. ... I hope this clears things up. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Best configuration for small VPS
Interesting. How much memory does each apache process consume ? Have you tested this under load ? Can you post the ps aux results ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: How to make tables generated by Django be utf8 encoded by default?
Here is a proposal: Why don't these SQL files generated by default by the django-admin.py startproject utility ? They would start empty, with just a comment: --place initial data commands here, alter tables, whatever Also, since django uses utf-8 from top to bottom, it makes sense to make utf-8 an option for the database, or at least be able to specify it in a Meta directive in a model class... Should I post this in a ticket ? Hey, maybe I'll even write a patch about it! I'm so excited about django, I want to give back! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: media files with django dev-server
> > (1) to use the dev server > > (2) no changes when moving to production > > (3) to have core and non-core content served out of the > > ADMIN_MEDIA_PREFIX prefix. > > 1 and 2 is true (especially 2). > 3 not ... I don´t care serving admin_media with a different prefix. > Why don't you follow my advice then ? It works 100% for your case. you can change the admin_media_prefix to /admin_media/, and you can have your media files under /media/ (as it is now) You have been presented several solutions that work. It's up to you 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 -~--~~~~--~~--~--~---
Re: Creating a decoration for the views
I think that a context processor is better suited for 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 -~--~~~~--~~--~--~---
Automatically starting the FastCGI server
Hello, I'm new to linux administration, but I try to learn :) I have managed to make lighttpd and postgresql start automatically upon reboot, now I need a way to make manage.py runfcgi to start automatically. I tried to put this in my lighttpd.conf: fastcgi.server = ( "/django.fcgi" => ( "main" => ( # Use host / port instead of socket for TCP fastcgi "host" => "127.0.0.1", "port" => 3033, #"socket" => "/home/user/mysite.sock", "check-local" => "disable", "bin-path" => "/usr/bin/python /path/to/project/manage.py runfcgi method=threaded host=127.0.0.1 port=3033", "min-procs" => 1, "max-procs" => 32, "max-load-per-proc" => 4, "idle-timeout" => 60 ) ), ) but it didn't work. Has anyone made this work ? An init.d script would be nice too, as I'd like to run the django fcgi server under a different user. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Hi, i have been having trouble with django encoding...help, please!
Make sure that the page is actually encoded in UTF-8. Open it in notepad, then save it again chooding UTF-8 in the encoding drop down. Then open it again and see if it is displayed correctly: a) In notepad b) In a browser (statically served) I had zero problems with django and encodings, I had to make sure I saved all my pages as UTF-8. Using Pydev in Eclipse made me "set and forget" this kind of stuff. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Ticket Rejected] Random ProgrammingErrors when using PostgreSQL
I got this ticket rejected from Akismet: This is not related to #852, as the errors are thrown when running the application normally, not the shell. The errors I get are: {{{ File "/usr/lib/python2.4/site-packages/django/db/models/base.py", line 166, in save cursor = connection.cursor() File "/usr/lib/python2.4/site-packages/django/db/backends/postgresql/base.py", line 46, in cursor cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) ProgrammingError: ERROR: current transaction is aborted, commands ignored until end of transaction block SET TIME ZONE 'Europe/Athens' }}} I have tried issuing the statement SET TIME ZONE 'Europe/Athens' using psql and it runs fine. So, it seems that the problem isn't related to the time zone, rather the statement before the SET TIME ZONE is to blame. However, this is completely random. Most of the time everything runs fine, then this will pop-up. hit refresh and everything is OK. I can't track this down. This has happened on a project using mostly flat pages, on requests that didn't save to the database, and on projects using save. I'm running postgres 7.4.13 psycopg 1.1.21, Centos 4.4 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Random ProgrammingErrors when using PostgreSQL
I get this back: [{'sql': 'SELECT "django_session"."session_key","django_session"."session_data","django_session"."expire_date" FROM "django_session" WHERE ("django_session"."session_key" = d3b9c68e8d397b3fc0809ce5102e0299 AND "django_session"."expire_date" > 2006-11-05 13:39:36.338000)', 'time': '0.010'}, {'sql': 'SELECT 1 FROM "django_session" WHERE "session_key"=d3b9c68e8d397b3fc0809ce5102e0299 LIMIT 1', 'time': '0.000'}, {'sql': 'UPDATE "django_session" SET "session_data"=KGRwMQpTJ2xhc3RfdHJhbnMnCnAyCmNkYXRldGltZQpkYXRldGltZQpwMwooUydceDA3XHhkNlx4\nMGJceDA0XHgxNTggXHgwNFF4Jwp0UnA0CnNTJ19hdXRoX3VzZXJfaWQnCnA1CkkxCnNTJ19hdXRo\nX3VzZXJfYmFja2VuZCcKcDYKUydkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFj\na2VuZCcKcDcKc1MnbGFzdF9zZWVuJwpwOApnMwooUyJceDA3XHhkNlx4MGJceDA1XHInJFx4MDUo\nUCIKdFJwOQpzLmY4MTk1ZTU1ZjI4MGIwZTgyNTE1ZjUxZjhjMTMwNGE0\n,"expire_date"=2006-11-19 13:39:36.368000 WHERE "session_key"=d3b9c68e8d397b3fc0809ce5102e0299', 'time': '0.000'}, {'sql': 'SELECT "auth_user"."id","auth_user"."username","auth_user"."first_name","auth_user"."last_name","auth_user"."email","auth_user"."password","auth_user"."is_staff","auth_user"."is_active","auth_user"."is_superuser","auth_user"."last_login","auth_user"."date_joined" FROM "auth_user" WHERE ("auth_user"."id" = 1)', 'time': '0.000'}] I tried running it on my local PostGres, and it seems that the date and session key should be quoted... or maybe not ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Random ProgrammingErrors when using PostgreSQL
HURRAY I fixed it. For the record, this was my problem - no bug in Django. I have imported semi-automatically some values from a previous version of my app. I had to use the same Primary keys in order to keep all the relations. However, I didn't adjusted the postgres sequences, so they tried to insert primary keys which already existed. It's strange I didn't get the error though. I had to use the python shell to find that out. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Random ProgrammingErrors when using PostgreSQL
And for anyone searching this: http://www.djangoproject.com/documentation/django_admin/#sqlsequencereset-appname-appname --~--~-~--~~~---~--~~ 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: Automatically starting the FastCGI server
I'm using CentOS, it's like RedHat AFAIK... --~--~-~--~~~---~--~~ 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: Bugtracker sucks?
If there is an option of signing up, why don't we close the non-logged-in user ticket submission ? Anyway, Akismet still leaves a lot of spam 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-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: Automatically starting the FastCGI server
Thanks! I am trying to make lighttpd spawn the fcgi django processes using bin-path but there seems to be a problem. Here is my setup: fastcgi.server = ( "/myproject.fcgi" => ( "main" => ( # Use host / port instead of socket for TCP fastcgi "host" => "127.0.0.1", "port" => 3033, #"socket" => "/home/user/mysite.sock", "check-local" => "disable", "bin-path" => "/home/path/to/myproject/start.sh", "min-procs" => 1, "max-procs" => 1, "max-load-per-proc" => 0, "idle-timeout" => 0 ) ), ) Any ideas ? Anyway, I made my first shell script to easily type start/stop to start/stop the fcgi server: start.sh = PROJECTNAME=myproject echo Starting $PROJECTNAME ... DIR=`dirname $0` exec $DIR/manage.py runfcgi method=prefork host=127.0.0.1 \ port=3033 maxrequests=50 maxchildren=8 maxspare=3 minspare=1 \ pidfile=/var/run/$PROJECTNAME.pid == stop.sh = #!/bin/bash PROJECTNAME=myproject echo Stopping $PROJECTNAME ... kill `cat /var/run/$PROJECTNAME.pid` rm -f /var/run/$PROJECTNAME.pid = I'm sure they can be more sophisticated... But they work for me. If anyone can spot glaring omissions, stupid mistakes, easy improvements, fire breathing dragons etc. let me know! Probably they can be included to the django project templates after some tweaking, no ? Make it easy for newbies (like me) to start the fcgi server in a new project. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Creating one call for most recent entry, and another call for the restI have just set up a blog using the helpful tutorial over at
Just do {% if forloop.first %} ... {% else %} ... {% endif %} --~--~-~--~~~---~--~~ 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, RDF & XUL
Hey, can you give some more info on the stack of this application ? Is it client-server, standalone ? What advantages does it have over the normal HTML approach ? --~--~-~--~~~---~--~~ 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: template tags to filter rows
Well, the thing missing right now is generating a form given a model. Once this is finished in newforms, it will be piece of cake creating admin-like interfaces. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Creating one call for most recent entry, and another call for the restI have just set up a blog using the helpful tutorial over at
Well if you want to target every second, tenth etc. element you can use the cycle tag. If you want to highlight the tenth entry because it is special, you should define it as special in your view code. If you want to highlight arbitrary entries, well, then... I don't know. Why would you do that anyway ? --~--~-~--~~~---~--~~ 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: Generating slug for words with accents
Can you discuss this on the relevant ticket: http://code.djangoproject.com/ticket/2282 Thanks, Orestis Aidas Bendoraitis wrote: > Similarly Lithuanian would be: > ą = a > č = c > ę = e > ė = e > į = i > š = s > ų = u > ū = u > ž = z > > I am just thinking whether slugify function should correspond to the > chosen language or not. It seems that there are not many differences > among stripped accented letters in different languages, so maybe it > should be left the same. Whatever we decide, ß should still be > translated to ss, but not S. What is the opinion of the others? > > And also, if we are already adding localizations to the slugify > function, should't greek, russian, and other non-latin alphabets also > be translated to latin charset? > > Regards, > Aidas Bendoraitis [aka Archatas] > > > > On 11/17/06, Kamil Wdowicz <[EMAIL PROTECTED]> wrote: > > Polish: > > ą = a > > ć = c > > ź or ż = z > > ę = e > > ó = o > > ł = l > > ś = s > > ń = n > > > > 2006/11/17, zenx <[EMAIL PROTECTED]>: > > > > > > Spanish info: > > > á é í ó úshould be a e i o u > > > ü should be u > > > ñ should be n > > > > > > I think that's everything in spanish ;) > > > > > > > > > > > > > > > > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---