Re: I18N and caching: page don't change language until I press F5 in browser

2011-11-04 Thread Torsten Bronger
Hallöchen! Salvatore Iovene writes: > On Friday, November 4, 2011 5:31:46 PM UTC+2, Salvatore Iovene wrote: >> >> if hasattr(request, 'session'): >> request.session['django_language'] = lang >> else: >> response.set_cookie(settings.LANGUAGE_COOKIE_NAME,

Re: Trouble starting new project

2011-11-04 Thread dotcomboy
Did you try "python django-admin.py startproject mysite"? Is Python on the path? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/AkW0jKgnabsJ. To post to

admindocs app - almost, but not, working

2011-11-04 Thread lorin
I followed the instructions to activate the admindocs (https:// docs.djangoproject.com/en/dev/ref/contrib/admin/admindocs/#overview) and now I see a link Documentation, next to Welcome, myname in the admin, and that goes to a nice page at admin/doc. But none of the hyperlinks go to working pages

Re: Site Administration Page

2011-11-04 Thread Jesramz
Is your url pointing to (http://127.0.0.1:8080/admin/) ? -- 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

Re: Django class based views - not keen - anyone else??

2011-11-04 Thread Kurtis Mullins
Hey Cal, Yeah the documentation is a bit lacking. It's kinda difficult to put the pieces together. But once you learn how to use them -- they're pretty awesome and powerful. It does seem a little difficult to deviate away from the box at first, but once you understand how they work -- it's pretty

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Furbee
No worries. Wow, I've got some interesting results. I am pretty sure the ModelForm class has a bug in it that it is not looking at the secondary database with the using() method. It is a bug in the foreign reference fields only, though. I set up tables in my default database, and in an extra

Django class based views - not keen - anyone else??

2011-11-04 Thread Cal Leeming [Simplicity Media Ltd]
Hey all, I took a look through some of the documentation for class based views - and my first reaction was "Eww.". Imho, it looks much like the "admin section" customization stuff, and would quickly become a pain to work with if you deviate away from 'the box'. This comes from me having

[Problem]Site Administration Page

2011-11-04 Thread Nora Youssef
Hi I tried to follow the steps included here http://www.jetbrains.com/pycharm/quickstart/django_guide.html but i stopped at running the "Site Administration page" when i run the application it produces Congratulations It Worked ! Page actually it's the start page it appears when i tested the

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Tabitha Samuel
I don't mean to be spamming you like this, just thought you might be interested in this result: So I created the same tables (n_test_staff and n_nics_groups) in the default gibbs database. I removed the using part in the form statement (form = StaffForm(instance =

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Furbee
I guess the ModelForm must require the Meta class, sorry about that. This is really strange behavior, but it looks like everything you've got is correct. Running syncdb will only create new databases/tables, it does not ALTER any existing tables or modify any of the data. However, if you have

Multiple sessions per user?

2011-11-04 Thread Nan
OK, the subject doesn't *quite* describe what I need to do, but almost. Basically, I'd like to have 1) one "session" that expires after logout or browser close, and applies to logged-in sessions (like the default Django session framework using the "SESSION_EXPIRE_AT_BROWSER_CLOSE" setting) 2)

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Tabitha Samuel
I found this patch for the raw function (https:// code.djangoproject.com/attachment/ticket/13805/manager.patch), because according to this ticket (https://code.djangoproject.com/ticket/ 13805), .raw does not work in a multi db env. So this is what I have: in django/db/models/manager.py, I have

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Tabitha Samuel
One thought I have is that the using() is messing things up. Would it be possible for you to create a second non-default db, throw these two tables in there and then try the same thing? If that works for you, then I must have a ghost sitting in my system! :-| On Nov 4, 2:28 pm, Furbee

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Tabitha Samuel
Yep, n_nics_groups and n_test_staff exist in the same 'gold' database. So when I tried: form = StaffForm(instance = Staff.objects.using('gold').raw("SELECT s.*, g.n_group_name FROM n_test_staff s LEFT JOIN n_nics_groups g ON(g.n_group_number = s.nics_group) WHERE s.username = 'tsamuel')")) I

Re: Caching at model class level

2011-11-04 Thread Malcolm Box
On 4 November 2011 07:02, Thomas Guettler wrote: > Am 03.11.2011 18:42, schrieb Tom Evans: > > On Thu, Nov 3, 2011 at 2:22 PM, Thomas Guettler wrote: > >> Hi, > >> > >> I try to reduce the number of db-queries in my app. > >> > >> There is a model which

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Furbee
That is very strange... I recreated this on my development system and it worked fine. I looked for Django bugs, but haven't found any related to this issue. To be clear, the table n_nics_groups definitely exists in the same database as n_test_staff, right? It does in mine because I used python

Re: I18N and caching: page don't change language until I press F5 in browser

2011-11-04 Thread Salvatore Iovene
On Friday, November 4, 2011 5:31:46 PM UTC+2, Salvatore Iovene wrote: > > if hasattr(request, 'session'): > request.session['django_language'] = lang > else: > response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang) > I have solved my problem by setting

Trouble starting new project

2011-11-04 Thread Sydney Lo
I go into the folder that I would like to store my project and successfully start up python 2.7 then I checked to see if django was installed and it shows that I have 1.3.1 installed. So i run the command "django-admin.py startproject mysite" it says invalid syntax. I am using admin command prompt

Filtering generic relation with additional field

2011-11-04 Thread guardbadger
Hi all, Appreciate some help trying to build a queryset. Im hoping I can make this in django, without having to crack open raw sql... Here is my setup: class Container(models.Model): permissions = generic.GenericRelation(Permission) class Item(models.Model): container =

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Tabitha Samuel
The error that I'm getting is on the second form instantiation, that is on the line: form = StaffForm(instance = Staff.objects.using('gold').get(username = current_staff) where current_staff='tsamuel' for instance This is the traceback of the error that I get when I do a print form right after

Re: django-registration-template

2011-11-04 Thread Andre Lopes
Great! I will test your templates. I'm new to Django and I have searched a lot for this. The templates look awesome. Best Regards, On Fri, Nov 4, 2011 at 4:11 AM, Ezequiel Bertti wrote: > Hi, > I just release a project on github with bootstrap from twitter v1.4 form >

Help with relationships

2011-11-04 Thread goof2092
hello all. due to either lack of knowledge or confusion, I am unable to achieve a relationship using 3 models. I have the models as below:

Re: Reg. Basic django.db.models

2011-11-04 Thread Brett Epps
Hi Ganesh, Here are some examples: Filter: SELECT * FROM device WHERE locked = true - returns a QuerySet which can be evaluated as a list of Device objects Get: SELECT * FROM device WHERE id = (value of id variable) LIMIT 1 - returns a single Device object All: SELECT * FROM schedule - returns a

Re: I18N and caching: page don't change language until I press F5 in browser

2011-11-04 Thread Salvatore Iovene
PS: I have also tried the @vary_on_header('Accept-Language') decorator, but unfortunately that didn't help either. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit

I18N and caching: page don't change language until I press F5 in browser

2011-11-04 Thread Salvatore Iovene
Hi, I've got a Django website that's multi-lingual, and I'd like to use memcaching on it. While everything works fine with caching disabled, I have observed the following when caching is enabled: 1) Open any page on the website 2) Click on link (the image of a little flat) to change language 3)

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Furbee
Oh no, that would not be a good thing to share! :-) That's a bummer that the upgrade broke things. So, the error is being raised on this line? staff_form = StaffForm(request.POST, instance=staffinstance).using('gold') Furbee On Fri, Nov 4, 2011 at 8:02 AM, Tabitha Samuel

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Tabitha Samuel
So this is how I'm creating the staff form: def staff_info(request, *args, **kws): class StaffForm(forms.ModelForm): class Meta: model= Staff if request.method == 'POST' and request.POST['event'] == 'choosestaff': current_staff =

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Mark Furbee
Good Morning Tabitha. Actually, do you have a model for StaffForm? That is the object being instantiated and then causing the error. If there is no nics group reference field in the StaffForm object, it may raise this error. Also, do you have this running in a view/template? Do you have a real

Re: Translation problem with percent sign

2011-11-04 Thread Martin J. Laubach
Just remove the line with "python-format" from your translation since it isn't a format string after all. mjl -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Tabitha Samuel
Here is staff/models.py from django.db import models class NICSGroupType(models.Model): n_group_number = models.IntegerField(primary_key = True) n_group_name = models.CharField(max_length = 512) def __str__(self): return self.n_group_name class Meta: db_table =

Translation problem with percent sign

2011-11-04 Thread Martin Tiršel
Hello, I am using Django 1.2.5. * template: {% trans 'If you cancel queued construction, you will get 75% of resources back' %} * django-admin.py makemessages -l sk produces: #: templates/core/buildings/construction.html:65 #, python-format msgid "If you cancel queued construction, you

Re: How can I limit a 'list_filter' to a certain subset of objects?

2011-11-04 Thread Andre Terra
Hello, Rodrigo >From looking at the ModelAdmin source code[1], I think all you need to do is reimplement the queryset() method in your subclass on admin.py. Make sure you return a filtered queryset based on request.user. I never use the admin, so I'm not so sure about how the user will be

Re: Abstract FormView

2011-11-04 Thread Kurtis Mullins
Great answer. Thanks a lot! On Thu, Nov 3, 2011 at 8:08 AM, Andre Terra wrote: > All you have to do is create a MyFormMixin class and add all those methods > you want to override. Usually you will want to call super() on the class so > that the normal behavior is also

Re: Django login() fails when using custom Facebook backend

2011-11-04 Thread Tom Evans
On Fri, Nov 4, 2011 at 4:11 AM, kz26 wrote: > I'm currently working on a site (Django 1.3) where all users will be > authenticated through Facebook. To do this, I've written a simple > custom authentication backend: > > > # custom Facebook authentication backend > from

Reg. Basic django.db.models

2011-11-04 Thread Ganesh Kumar
Hi, I'm a new to Django. I know mysql queries. I cant understand django queries, Basically My understanding complicated to the django queries. please guide me. Device.objects.filter(device_id = device_id)[0] Device->table device-->column Device.objects.filter(locked = True)

django-registration-template

2011-11-04 Thread Ezequiel Bertti
Hi, I just release a project on github with bootstrap from twitter v1.4 form django-registration. Is a simple use of bootstrap just using template for render with css. No python code need. Its is perfect sample for designers to know how to use bootstrap without asking to programmer to do some

Django login() fails when using custom Facebook backend

2011-11-04 Thread kz26
I'm currently working on a site (Django 1.3) where all users will be authenticated through Facebook. To do this, I've written a simple custom authentication backend: # custom Facebook authentication backend from django.contrib.auth.models import User from site_main.models import * from fb import

Re: Caching at model class level

2011-11-04 Thread Thomas Guettler
Am 03.11.2011 18:42, schrieb Tom Evans: > On Thu, Nov 3, 2011 at 2:22 PM, Thomas Guettler wrote: >> Hi, >> >> I try to reduce the number of db-queries in my app. >> >> There is a model which changes almost never. It is like a "type of ticket" >> in a trouble ticket system. >>

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Furbee
Hi Tabitha, I wish I could supply a quick and simple answer to fix what's going on in your database, but nothing obvious is standing out. Can you supply your model for StaffForm? That seems to be where the problem lies, since we can get details from the model and view elsewhere. Thanks, Furbee