Re: Executing ssh scripts with django
> I'm developing an ISP control panel for my organization. a bit off topic on Django and ISP. Look at the NOC Project http://www.nocproject.org/ > NOC is an Operation Support System (OSS) for the Telco, > Service provider and Enterprise Network Operation Centers (NOC). > Written in Python language and utilizing the power > of Django framework and PostgreSQL RDBMS . -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Full Text Search
Check this out: http://www.julienphalip.com/blog/2008/08/16/adding-search-django-site-snap/ On Oct 1, 6:52 am, Alessandro Ronchiwrote: > On Fri, Oct 1, 2010 at 3:35 AM, Steve Holden wrote: > > On 9/30/2010 8:26 PM, Nick Arnett wrote: > > > Brain is mush, though. > > Thank you. I'm waiting with hope :) > > -- > Alessandro Ronchihttp://www.soasi.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How does the default option for a field work in the model?
I want to use the Admin module to pre-set default values when creating the form. For example, in the gender case, I want to have default "Unknown" option. Is this this not possible? On Feb 28, 6:00 pm, James Bennett <ubernost...@gmail.com> wrote: > On Sun, Feb 28, 2010 at 4:42 PM, Andrej <amas...@gmail.com> wrote: > > Shouldn't this work? It's a tuple. > > > gender = models.CharField(_('Gender'), max_length=1, > > choices=GENDER_CHOICES, default=GENDER_CHOICES[2]) > > > It doesn't. > > I smell black magic! > > The value that goes in 'default' is the actual DB value you'd want to > store, not a tuple of (DB value, human-readable value). What, exactly, > do you think is "magical" about that? > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Serving https with runserver
because you need to load apache ssl gear. Set up your normal virtual host and then use reverse proxy: ProxyPass / http://localhost:8000/ ProxyPassReverse / http://localhost:8000/ On Feb 28, 5:09 pm, cool-RRwrote: > Why doesn't runserver automatically serve in https as well as http? It > would have been useful. > > Ram. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How does the default option for a field work in the model?
>From the docs: GENDER_CHOICES = ( ('M', 'Male'), ('F', 'Female'), ) Shouldn't this work? It's a tuple. gender = models.CharField(_('Gender'), max_length=1, choices=GENDER_CHOICES, default=GENDER_CHOICES[2]) It doesn't. I smell black magic! 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Conditonal validators for the model
Thanks for the reply, that definitely works, and it's within the MVC paradigm. On Feb 28, 3:14 pm, sc...@thereceptor.net wrote: > > Greetings, > > > Django is awesome! I'm playing around and I was wondering if there is > > a way to specify conditional validators in the model. > > > Example: if field x is blank, field y is required. > > > Thanks for your help! > > You might consider making a ModelForm and then adding cleaner methods. > Forms are Django's validation mechanism, and ModelForms combine them with > Models. > > http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Conditonal validators for the model
Greetings, Django is awesome! I'm playing around and I was wondering if there is a way to specify conditional validators in the model. Example: if field x is blank, field y is required. Thanks for your 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: making two-column table from one-column data
Thanks for your reply, I really like the general iterator approach. This recipe will definitely go to my personal "standard" library. A. On Dec 2, 11:09 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > If your data is in the 'data' context variable, then try this: > > > > > {% for d in data %} > > {% if forloop.counter0|divisibleby:"2" %}{% endif %} > > {{d}} > > {% if forloop.counter|divisibleby:"2" %}{% endif %} > > {% endfor %} > > {% if data|length|divisibleby:"2" %}{% else > > %}{% endif %} > > > > > It's a little awkward, and doesn't generalize to more than two columns, > > but it does produce properly structured HTML. > > It can be generalized, as I've done it in a pinch, and it looks > something like this (untested, as I don't have my actual code > right in front of me): > > > > {% for d in data %} >{{d}} > {% if forloop.counter|divisibleby:"4" %}{% endif %} > {% endfor %} > > > > HTML is forgiving if you don't have the right number of columns > in your final row (don't know about XHTML's definition). And it > adds a bogus row at the bottom if your dataset is divisible by N. > > A better way would be to make a custom template filter that > breaks the data-set into groups. > > # > from itertools import izip, islice > > def pad(iterable, length, padding=None): > i = 0 > for thing in iterable: > i += 1 > yield thing > for i in xrange(length - i): > yield padding > > def columnize(dataset, args="2"): > if "," in str(args): > columns, padding = args.split(",",1) > else: > columns = args > padding = "" > columns = int(columns) > row_count, leftovers = divmod(len(dataset), columns) > if leftovers: row_count += 1 > return izip(*( > pad(islice(dataset, i, None, columns), row_count, padding) > for i in xrange(columns) > )) > # > > and then register columnize your filter. It should presume 2 > columns, but be extensible to more than two columns with an > optional parameter. It also takes optional padding as a > parameter, so it can be called like > > > {% for thing in data|columnize:"3," %} > > {% for value in thing %} > {{ value }} > {% endfor %} > > {% endfor %} > > > or > > > {% for thing in my_queryset|columnize %} > > {% for value in thing %} > > {% if value %} > {{ value.name }}: > {{ value.other_field }} > {% else %} > > {% endif %} > > {% endfor %} > > {% endfor %} > > > which is about as clean a solution as it gets, as it guarantees > "square" result-sets that have been padded out. > > -tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~--~~~~--~~--~--~---
making two-column table from one-column data
hi, i have small question: suppose i have data in QuerySet - ['A', 'B', 'C', 'D', 'E', 'F', 'G']. I want make from this set two-column table in my template: AB CD EF G What is the fastest way to do it? I don't want split the QuerySet in my views to something like this: [(A, B), (C, D)...] etc. Thanks, Andrej Kesely --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~--~~~~--~~--~--~---