Re: How/where to call setlocale

2014-09-19 Thread James Hargreaves
Thanks again for your reply Ulrich. I finally figured out the problem :) Towards the bottom of my settings.py I had mistakenly overwritten the LANGUAGE_CODE as follows: LANGUAGE_CODE = 'en' Django must determine the locale internally based on the LANGUAGE_CODE specified. Needless to say this

Re: Simple task. Get request.META values listed on a page via template

2014-09-19 Thread Tom Evans
On Mon, Sep 8, 2014 at 5:08 PM, Артём Мутерко wrote: > I need to list all values from request.META in Django using template. > > I've done it without template like this > (code from my views.py) > > def display_meta(request): > values = request.META.items() > values.sort() > html = [] > fo

Re: How/where to call setlocale

2014-09-19 Thread uvetter
Dear Jay, glad that it works now. I got myself confused about terms such as language name and locale name. Setting the locale via locale.setlocale does indeed have no influence on the Django settings. I knew that but I misunderstood you. I set locale.setlocale in the example because I wanted to

Re: Can I use a calculated value for a key to a dictionary?

2014-09-19 Thread James Schneider
Instead of "for team in {{l}}{{d}}" you should be able to do "for team in l.d" IIRC. TBH I haven't tried it and I'm on my phone so I can't run a quick check. This SO post also has some hints on running nested loops: http://stackoverflow.com/questions/13870890/django-template-counter-in-nested-loop

Re: Can I use a calculated value for a key to a dictionary?

2014-09-19 Thread James Schneider
Scratch that, I misread what you were trying to do, but became clear when I looked at your context a bit closer. You want to concatenate two strings and use that as the variable lookup. You can probably do that using a combination of the {% with %} tag and the 'add' filter (which works on strings

Retrieving recurring events using Django queries

2014-09-19 Thread Stodge
I have the following to model a calendar entry (recurring event). I need the ability to retrieve all events from the database between a start and end date. This has to include one off events and also recurring "virtual" events that occur because of an event in the database. Do you think this is

Re: Retrieving recurring events using Django queries

2014-09-19 Thread Sanjay Bhangar
hey Stodge, Interesting question :) My guess is there are probably a number of approaches one can take. Of course, processing all your entries in python "on the fly" would probably get to be quite an intensive operation. One possible idea maybe to create a "cache" table of sorts where you pre-ca

Re: Can I use a calculated value for a key to a dictionary?

2014-09-19 Thread Tom Evans
On Fri, Sep 19, 2014 at 11:13 AM, James Schneider wrote: > Scratch that, I misread what you were trying to do, but became clear when I > looked at your context a bit closer. You want to concatenate two strings and > use that as the variable lookup. > > You can probably do that using a combination

Custom change_form.html

2014-09-19 Thread Salvatore DI DIO
Hello, *To follow my preceding question, on customize admin view, (*Helton Alves gave me a nice response). I am wondering how to filter a list in change_form.html admin form, according to a partuculiar user ? Thank you for your help Regards -- You received this message because you are s

Re: Retrieving recurring events using Django queries

2014-09-19 Thread Derek Rodger
Take a look at: https://github.com/llazzaro/django-scheduler also available on PyPI: pypi.python.org/pypi/django-scheduler/ It's very similar to what you have done so far. It handles virtual events ('occurrences') by generating them on the fly for a requested date range. Individual occurrences

Re: Possible bug introduced in Django 1.7 admin/docs?

2014-09-19 Thread Christopher Welborn
On 09/18/2014 10:50 PM, James Bennett wrote: > Are you using any third-party libraries which were installed as eggs? > Sorry, but was that supposed to be a hint to say "Don't use eggs"? I can see why it may fail looking for '__file__', but I don't understand why that is acceptable. Surely there s

Possible Bug - PositiveSmallIntegerField Enables Saving Negative Values

2014-09-19 Thread Sy K.
I have generated a very simple test project using a fresh copy Django 1.7.0 with a model that has a PositiveSmallIntegerField, it is attached to this post. The ORM is not preventing instances being created with that field's value set to -1 >>> django.VERSION (1, 7, 0, 'final', 0) $ python man

Can not understand how to change auth.templates

2014-09-19 Thread Артём Мутерко
I want to redirect user after logout to another page, not account/logout. Hoe can I do this? I've red documentation, but can't understand where to find next_page variable -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: Sitemaps - multiple locations per object

2014-09-19 Thread Collin Anderson
Something like this might work: class MySitemap(sitemaps.Sitemap): def items(self): urls = [] for obj in Store.objects.all(): urls.append((obj, '')) urls.append((obj, 'about')) urls.append((obj, 'contact')) return urls def locati

Re: Struggling with One to One relationships

2014-09-19 Thread Collin Anderson
Yes, this seems to be the usual problem with inheritance. You need to do something scary like workshop_job.__dict__.update(job.__dict__) so that your workshop_job object will actually have all of the info from the job, like date_opened. -- You received this message because you are subscribed t

Re: Simple task. Get request.META values listed on a page via template

2014-09-19 Thread Collin Anderson
You can't get it sorted (you would need a template filter for that), but: {% for k, v in request.META.items %}{{ k }}{{ v }}{% endfor %} -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails f

Re: Django 1.6 Nginx with static files outside project folder

2014-09-19 Thread Collin Anderson
so if you go to http://myproject.de:8001/static/some-file-in-myproject.css it works fine, but if you go to http://myproject.de:8001/static/admin/js/jquery.js you get a 404 Not Found? Are the files you're looking for actually in webapps/sonar3/static? -- You received this message because you a

Re: unicode problems in admin interface

2014-09-19 Thread Collin Anderson
Are you uploading a file using apache? It could be the /etc/apache2/envvars issue. Are you ever using string formatting like "something %s something" % something ? If so, use unicode_literals or change that to a unicode string: u"something %s something" % something -- You received this messag

Re: new to django data modeling for an application

2014-09-19 Thread Collin Anderson
class Dish(models.Model): resturant = models.ForeignKey(Resturant) name = models.CharField(max_length=255) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email t

Re: django 1.7: inlines not deleted when save_formset is overridden

2014-09-19 Thread Collin Anderson
Wow. It took a lot of digging, but your situation is documented in https://docs.djangoproject.com/en/1.7/topics/forms/formsets/#django.forms.formsets.BaseFormSet.can_delete another thing that might also work in your case: def save_formset(self, request, form, formset, change): for form in fo

Re: Admin doesn't show all entities

2014-09-19 Thread Collin Anderson
This happened to me once when using django.contrib.comments. It turned out there was an exception happening in the template rendering that was getting silenced. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Re: Custom change_form.html

2014-09-19 Thread Collin Anderson
if nothing else: {% for item in list %}{% if item.user = user %} {% endif %}{% endfor %} -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr.

Re: Possible Bug - PositiveSmallIntegerField Enables Saving Negative Values

2014-09-19 Thread Collin Anderson
Yes. I believe that type of validation only happens in forms, or if you manually call obj.full_clean(). -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-u

Re: Can not understand how to change auth.templates

2014-09-19 Thread Collin Anderson
from django.contrib.auth.views import logout urlpatterns = [ url('^/accounts/logout/', logout, {'next_page': '/'}), ] -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an

Re: Can not understand how to change auth.templates

2014-09-19 Thread Collin Anderson
or send them to /accounts/logout/?next=/another/page/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this

Any stable and trusted packages for python XML?

2014-09-19 Thread Chen Xu
Hi Everyone, I wonder if there is any good, stable and trusted django or python package that can convert dict to xml, and load xml into dict, just like what the json package does. Thanks -- ⚡ Chen Xu ⚡ -- You received this message because you are subscribed to the Google Groups "Django user

Re: Struggling with One to One relationships

2014-09-19 Thread Lachlan Musicman
Ah! OK, it's not just me then. Good. It's a usual inheritance problem? I've never seen it with o2m or m2m relations? I think I'll just change them to o2m and check to make sure there's only one in the save method - seems clearer -easier to read for !me, and less scary. Thanks for your help L. O

Re: Possible bug introduced in Django 1.7 admin/docs?

2014-09-19 Thread Russell Keith-Magee
On Sat, Sep 20, 2014 at 2:17 AM, Christopher Welborn wrote: > On 09/18/2014 10:50 PM, James Bennett wrote: > > Are you using any third-party libraries which were installed as eggs? > > > > Sorry, but was that supposed to be a hint to say "Don't use eggs"? I can > see why it may fail looking for '

Re: Possible bug introduced in Django 1.7 admin/docs?

2014-09-19 Thread Christopher Welborn
On 09/19/2014 08:26 PM, Russell Keith-Magee wrote: > So - James' comment should be interpreted as "Are you using eggs? Well, > there's your first problem". If you're actually using eggs, I'd strongly > encourage you to consider why, because there's almost certainly a better > way to distribute your

Re: Turn off migrations completely in Django 1.7

2014-09-19 Thread Anthony Tuininga
Hmm, the problem is that there doesn't appear to be any way to turn off the creation of the migrations table itself, even if all of the other models are set to managed=False as suggested by Nikolas. I've commented it out for now but it would be ideal to have some way of turning it off completely

Re: Any stable and trusted packages for python XML?

2014-09-19 Thread Timothy W. Cook
XML is more complex than JSON and AFAIK there isn't a generic tool to do this. I work with XML all the time with Python/Django and I would only recommend lxml http://lxml.de/ On Fri, Sep 19, 2014 at 9:39 PM, Chen Xu wrote: > Hi Everyone, > I wonder if there is any good, stable and trusted

Re: Possible Bug - PositiveSmallIntegerField Enables Saving Negative Values

2014-09-19 Thread Patti Chen
I guess you're probably using SQLite as the database engine. "unsigned integer" and "signed integer" belong to same affinity in SQLite (http://www.sqlite.org/datatype3.html). Even if you specify "unsigned int" for the column during creation, you can save negative values without any error. If you us