Re: django-http-proxy multiple domains support?

2011-12-01 Thread Daryl
Bump..I'm still stuck on this one and i've had no success
contacting the author.If anyones got any tips about setting this up
for multiple destinations it would be greatly appreciated.

On Nov 19, 4:57 pm, Daryl  wrote:
> Is anyone on the list using the Multiple Domain (bkroeze) fork of
> django-http-proxy ? I've had it working fine using a single proxy
> domain but I am having problems getting it setup for multiple domains,
> due to a lack of documentation.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to intercept password change in admin module ?

2011-12-01 Thread Marc
Hello,

I reformulate my previous question having not no answer.

I would like to get control on the password change form of the admin
site (let us say record some trace in another table).

I put the following code in the admin.py:

class MyUserAdmin(UserAdmin):
def save_model(self, request, obj, form, change):
...
admin.site.unregister(User)
admin.site.register(User, MyUserAdmin)

The problem is that when user calls the password change built-in form
the
save_model method is not called.

Is there a way to intercept the password change action ?

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unable to load application to production environment

2011-12-01 Thread Daniel Roseman
On Thursday, 1 December 2011 07:16:50 UTC, Ganesh-Bugcy wrote:
>
> Hi guys,
>
> I am trying to load to my application to production environment,
> It will work on test server, How to do this please guide me.
>
> my settings file:-
> 'registration',
> 'fileupload',
> 'password_required',
>
> those application cant load at production time.
>
> error says:-
> No module named registration
>
> -Ganesh
>

 How can we possibly answer that question? You have given absolutely no 
details of your 'production environment'.
--
DR.

-- 
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/-/ZMg4gimnbm4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unable to load application to production environment

2011-12-01 Thread Leslie Maclachlan
Hi,
I would start by making sure any third party django apps that you have
installed on your test server (like django-registration) are installed on
the production server as well...

On Thu, Dec 1, 2011 at 11:56 AM, Daniel Roseman wrote:

> On Thursday, 1 December 2011 07:16:50 UTC, Ganesh-Bugcy wrote:
>>
>> Hi guys,
>>
>> I am trying to load to my application to production environment,
>> It will work on test server, How to do this please guide me.
>>
>> my settings file:-
>> 'registration',
>> 'fileupload',
>> 'password_required',
>>
>> those application cant load at production time.
>>
>> error says:-
>> No module named registration
>>
>> -Ganesh
>>
>
>  How can we possibly answer that question? You have given absolutely no
> details of your 'production environment'.
> --
> DR.
>
> --
> 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/-/ZMg4gimnbm4J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards,
MyGolf
http://www.mygolf.za.net

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Fixture migrations using South?

2011-12-01 Thread Gelonida N
On 11/30/2011 06:26 PM, Jeremy Dunck wrote:
> I have some test fixtures with scenarios under test.  Later, I need to
> migrate (with South) the DB schema around, which of cours necessitates
> changing domain and test code.
> 
> A common problem I run into, though, is that I also need to migrate
> the data in my fixtures.  It is possible to create a new DB, sync it
> to a given migration point, load the fixture, run the remaining
> migrations, and dump a new fixture, then drop the extra db.  But it
> seems like a very awkward dance given how often I have the problem.
> 
> Is there already a solution to this?   It seems to me that South could
> manage some book keeping to maintain what fixtures are at which
> migration level, and a new south command could manage the migration of
> fixtures.
> 
Agreed.

The fact that I have to manually migrate fixtures.
(initialize db with old version, apply fixtures, migrate, extract
fixtures) is one of the reasons why I use fixtures less often then code
generating input data.

A small tool migrating fixtures (at least for amy trivial migrations)
with south might be an incentive to use them a little more often.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to intercept password change in admin module ?

2011-12-01 Thread Reinout van Rees

On 01-12-11 09:12, Marc wrote:

Hello,

I reformulate my previous question having not no answer.

I would like to get control on the password change form of the admin
site (let us say record some trace in another table).

I put the following code in the admin.py:

class MyUserAdmin(UserAdmin):
 def save_model(self, request, obj, form, change):
...
admin.site.unregister(User)
admin.site.register(User, MyUserAdmin)

The problem is that when user calls the password change built-in form
the
save_model method is not called.


Just a guess: is your application higher up in the INSTALLED_APPS list 
than Django's build-in apps?




Reinout

--
Reinout van Reeshttp://reinout.vanrees.org/
rein...@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Website Statistics - What should I use to have Google Analytics in Django?

2011-12-01 Thread Gelonida N
On 11/30/2011 09:25 PM, Andre Lopes wrote:
> Hi,
> 
> I need to track visitors with Google Analytics. What should I use to
> get Google Analytics working on Django?
> 
> What is my best choice?
> 
> Best Regards,
> 

Out of curiousity:

Is there anything similiar  which does work well in an intranet
environment or an environment, where one does not want to send data to a
third party server?


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



add project directory path to python path permanently

2011-12-01 Thread Nikhil Verma
Hi all,

I want to add my django project directory path to PYTHONPATH. I am a newbie
in ubuntu 11.10
Please tell me step by step. When i do
>>>import sys
>>>sys.path.append(''project_directory path")
It does append but not permanently. I want it like whenever i do sys.path
it should show me Project Directory path in PYTHONPATH
-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Website Statistics - What should I use to have Google Analytics in Django?

2011-12-01 Thread Daniel Roseman


On Thursday, 1 December 2011 10:32:11 UTC, Gelonida N wrote:
>
> Out of curiousity:
>
> Is there anything similiar  which does work well in an intranet
> environment or an environment, where one does not want to send data to a
> third party server?
>

I've used django-request for this - it's very nice.
https://github.com/kylef/django-request
--
DR. 

-- 
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/-/mQkW1zNL2tEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: add project directory path to python path permanently

2011-12-01 Thread Daniel Roseman
On Thursday, 1 December 2011 10:59:15 UTC, Nikhil Verma wrote:
>
>
> Hi all,
>
> I want to add my django project directory path to PYTHONPATH. I am a 
> newbie in ubuntu 11.10
> Please tell me step by step. When i do 
> >>>import sys
> >>>sys.path.append(''project_directory path")
> It does append but not permanently. I want it like whenever i do sys.path 
> it should show me Project Directory path in PYTHONPATH
> -- 
> Regards
> Nikhil Verma
> +91-958-273-3156
>
>
Why? If you start your shell with `./manage.py shell` you will always have 
this.
--
DR. 

-- 
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/-/A7eRoKBzDpAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Website Statistics - What should I use to have Google Analytics in Django?

2011-12-01 Thread Ivo Brodien
>> Out of curiousity:
> 
> Is there anything similiar  which does work well in an intranet
> environment or an environment, where one does not want to send data to a
> third party server?

Not Django but  Piwik (MySQL, PHP) can do this.

http://piwik.org/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Two Servers plus one Load Balancer Vip Advice for DB?

2011-12-01 Thread Tom Evans
On Wed, Nov 30, 2011 at 11:51 PM, Colin  wrote:
> Hi Django users,
>
> So I have two servers behind a vip. I currently have it setup so if
> one server goes down it uses the other http server which works great.
> However I tried to set up mysql master - master and I keep getting
> duplicate key errors and grind the process to a hault and causes a
> real headache.
>
> My only requirment is that if one server goes down the system will
> still work, either physical or software server. So what would your
> advice be? This isnt a high volumn system but it needs high
> availability due ot the fact I use this as a tools mainsite and
> configuration system.
>

Hi Colin

I run a django web-app in a similar configuration to this, like you we
do this for HA, not scalability. I have a target of four 9s
availability (roughly less than a minute per week downtime).

We have multiple DCs, with a pair of app servers in each DC. Each DC
has 2 DB servers, one master, one slave, and both app servers in the
DC are configured to use both DB servers, with writes going to the
masters, obviously. The master DB servers in each DC slave the other.
If anything goes wrong with any part of the stack in one DC, we
failover to the other and repair it.

We don't have issues with duplicate keys, because we configure each
master to use a different auto_increment_offset. This means that
inserting a new tuple cannot result in a key collision on the other
master.

Here is the stock my.cnf that we use:

 # Multi Master Replication settings
 server-id = 1
 log-bin = /var/db/mysql/bin-log
 log-slave-updates
 log-bin-index = /var/db/mysql/bin-log.index
 log-error = /var/db/mysql/error.log
 relay-log = /var/db/mysql/relay-log
 relay-log-info-file = /var/db/mysql/relay-log.info
 relay-log-index = /var/db/mysql/relay-log.index
 expire-logs-days = 14
 auto_increment_increment = 2
 auto_increment_offset = 1
 master-host = 
 master-user = 
 master-password = 
 replicate-do-db = 

On this server, offset is 1 and increment is 2, so the auto increment
keys are all odd numbers. On the other master, offset is 2 and
increment is 2, so the auto increment keys are all even numbers.

Hope that helps

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



row level permissions

2011-12-01 Thread kenneth gonsalves
hi,

I have an app with a model called Project. A project can have several
areas, and each area many children. The fk relationship is child -> area
-> project. Now for user rights:

some users should only have access to the children under a specific
area, others only to children and areas under a specific project. This
is trivial to implement outside admin. But is there any app that can do
this within admin? I looked at django guardian, but it does not seem to
cover the case.

Any suggestions as how to go about this within admin?
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unable to load application to production environment

2011-12-01 Thread 彭嘉
Do you add the path of your project to system path?
Try this:
  os.path.append('/path/to/your/project/')

2011/12/1 Ganesh Kumar 

> Hi guys,
>
> I am trying to load to my application to production environment,
> It will work on test server, How to do this please guide me.
>
> my settings file:-
>'registration',
>'fileupload',
>'password_required',
>
> those application cant load at production time.
>
> error says:-
> No module named registration
>
> -Ganesh
> Did I learn something today? If not, I wasted 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards~
Peng Jia

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



division breaks makemessages djangojs

2011-12-01 Thread Michael
Just found out about some unexpected behavior of the "django-admin.py
makemessages --all -d djangojs" command.

Consider this JavaScript function:

function baz() {
gettext("first string");
var bar = 1;
var foo = bar / 2;
gettext("second string");
}

The first string does appear in "djangojs.po" while the second does
not. Changing the function makes it work (removing whitespace around
the slash had no effect):

function baz() {
gettext("first string");
var bar = 1;
var foo = bar * 0.5;
gettext("second string");
}

I am using Django 1.3.1,

Well, I am happy again since I found out what the problem is. I write
this here, because I havent found out how to report the bug -- anyway,
probably someone should try to reproduce this.

Micha

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to intercept password change in admin module ?

2011-12-01 Thread Marc
Thanks for your suggestion. Yes it is. Save_model is called when I
modify the User but not when I change the password using the dedicated
form.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to intercept password change in admin module ?

2011-12-01 Thread Martin J. Laubach
How about just listening to pre_save or post_save signals on the User 
model? 

   mjl

-- 
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/-/C65AzRxHDNwJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: row level permissions

2011-12-01 Thread raj

Isn't this possible with a custom UserProfile and overriding the
queryset() & has_change_permission() methods of each ModelAdmin?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: add project directory path to python path permanently

2011-12-01 Thread Nan

Do you have pip installed?  If so, you can just create a setup.py
script [1] and from inside your project directory run:

pip install -e ./

I assume setuptools (easy_install) can do the same, but I'm not 100%
clear on the command.

[1] http://docs.python.org/distutils/setupscript.html


On Dec 1, 5:59 am, Nikhil Verma  wrote:
> Hi all,
>
> I want to add my django project directory path to PYTHONPATH. I am a newbie
> in ubuntu 11.10
> Please tell me step by step. When i do>>>import sys
> >>>sys.path.append(''project_directory path")
>
> It does append but not permanently. I want it like whenever i do sys.path
> it should show me Project Directory path in PYTHONPATH
> --
> Regards
> Nikhil Verma
> +91-958-273-3156

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



select_related, need reverse foreighn key help

2011-12-01 Thread Sells, Fred
I've got a model structure like this

 

class Order(models.Model):

id = models.CharField(max_length=10, primary_key=True)  # like
OT-6212345

facility = models.ForeignKey(Facility)

therapy = models.CharField(max_length=2, blank=True)

. . .

 

class Schedule(models.Model):

facility = models.ForeignKey(Facility)  #yes I  know this is
redundant, but handy for debugging in sql.

order = models.ForeignKey(Order)

. . .

 

I need to find a list of all orders at a facility that have not been
scheduled; BUT I also need a specific set of values.  I can do it using
the following, but since the result is a list rather than a queryset, I
can no longer use the .values() method.  I could "brute force" it but
I've gotta believe Django can do this and it's just my lack of
experience.  My code is

 

 

class Test(unittest.TestCase):

 

def testOrderFilters(self):

values = tuple('id resident_id therapy resident__lname
resident__fname resident__room resident__payor'.split())

facility = models.Facility.objects.get(pk='xx')

queryset = models.Order.objects.filter(facility=facility)

queryset = queryset.filter(therapy='OT').select_related()
#sometimes want all, othertimes just one type

unscheduled = [x for x in queryset if not x.schedule_set.all()]

for u in unscheduled: print u.schedule_set.all(), u.__dict__

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: select_related, need reverse foreighn key help

2011-12-01 Thread Tom Evans
On Thu, Dec 1, 2011 at 5:13 PM, Sells, Fred
 wrote:
> I’ve got a model structure like this
>
>
>
> class Order(models.Model):
>
>     id = models.CharField(max_length=10, primary_key=True)  # like
> OT-6212345
>
>     facility = models.ForeignKey(Facility)
>
>     therapy = models.CharField(max_length=2, blank=True)
>
>     . . .
>
>
>
> class Schedule(models.Model):
>
>     facility = models.ForeignKey(Facility)  #yes I  know this is redundant,
> but handy for debugging in sql.
>
>     order = models.ForeignKey(Order)
>
>     . . .
>
>
>
> I need to find a list of all orders at a facility that have not been
> scheduled; BUT I also need a specific set of values.  I can do it using the
> following, but since the result is a list rather than a queryset, I can no
> longer use the .values() method.  I could “brute force” it but I’ve gotta
> believe Django can do this and it’s just my lack of experience.  My code is
>
>
>
>
>
> class Test(unittest.TestCase):
>
>
>
>     def testOrderFilters(self):
>
>     values = tuple('id resident_id therapy resident__lname
> resident__fname resident__room resident__payor'.split())
>
>     facility = models.Facility.objects.get(pk='xx')
>
>     queryset = models.Order.objects.filter(facility=facility)
>
>     queryset = queryset.filter(therapy='OT').select_related()
> #sometimes want all, othertimes just one type
>
>     unscheduled = [x for x in queryset if not x.schedule_set.all()]
>
>     for u in unscheduled: print u.schedule_set.all(), u.__dict__
>
>
>

(I don't know what mail client you are using, but it made gmail think
that every line is double space, and I cba to fix it)

Sounds like you want all the orders for a particular facility where
the number of schedules is 0?

> from django.db.models import Count
> Order.objects.filter(facility=facility).annotate(num_schedules=Count('schedule')).filter(num_schedules=0)

https://docs.djangoproject.com/en/1.3/topics/db/aggregation/#generating-aggregates-for-each-item-in-a-queryset

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: add project directory path to python path permanently

2011-12-01 Thread DrBloodmoney
On Thu, Dec 1, 2011 at 5:59 AM, Nikhil Verma  wrote:
>
> Hi all,
>
> I want to add my django project directory path to PYTHONPATH. I am a newbie
> in ubuntu 11.10
> Please tell me step by step. When i do
import sys
sys.path.append(''project_directory path")
> It does append but not permanently. I want it like whenever i do sys.path it
> should show me Project Directory path in PYTHONPATH

The easiest way is to find out where your site-packages is on your
python installation. Then just symlink your django project directory
there.

Or just use a separate virtualenv for every django project (hint: this
is what you should be doing anyways). Then just symlink into your
virtualenv site-packages

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



models.Q raising exception

2011-12-01 Thread Martin Tiršel

Hello,

why this is not working?

from django.db import models

...
GameProfile.objects.get(
models.Q(nick=nick) | models.Q(user=self.user),
world=self.world,
)

but this is working?

from django.db.models import Q

...
GameProfile.objects.get(
Q(nick=nick) | Q(user=self.user),
world=self.world,
)

I get "'module' object has no attribute 'Q'" exception. But in another  
file I have:


from django.db import transaction, models
...
context['incoming_armies'] = MovingArmy.objects.filter(
models.Q(
target_base=active_base,
returning=False
) | models.Q(
game_base=active_base
)
).order_by('end_time')

and here is everything ok.

Thanks,
Martin

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: models.Q raising exception

2011-12-01 Thread Ian Clelland
On Thu, Dec 1, 2011 at 12:58 PM, Martin Tiršel  wrote:

> Hello,
>
> why this is not working?
>
> from django.db import models
>
> ...
>GameProfile.objects.get(
>models.Q(nick=nick) | models.Q(user=self.user),
>world=self.world,
>)
>
>
A shot in the dark here, but if you are getting "'module' object has no
attribute 'Q'" here, have you imported something else called 'models'? Or
redefined it somehow above this code?

Try:
from django.db import models as django_models
...
GameProfile.objects.get(
   django_models.Q(nick=nick) | django_models.Q(user=self.user),
   world=self.world,
   )

to see if the problem goes away. If it does, it's almost definitely a
redefined name.

-- 
Regards,
Ian Clelland


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: converting a large site to Django

2011-12-01 Thread Tiago Almeida
Hi,
I'm assuming you have lots of html files that you want to serve. You
could try writing a catch all url pattern that is handled by a generic
view to serve these html files. I'm not sure if there is something
already like this in django itself.
However, if you don't want/need to process the html with the
templating engine, you should just serve them at the webserver level
(without going through django).

Hope it helps,


On Dec 1, 12:24 am, marjenni  wrote:
> Hi,ne
>    Thank you for your quick reply :)
>
> Actually, I am a little concerned that I may have a lot of work ahead
> of me!
>
> I have an existing php based website that is used to advertise holiday
> accommodation, and the pages that contain advert listings are
> dynamically recreated every 24 hours.
>
> I needed to implement a search feature, and this seemed much easier to
> write in python than php, so on a new server I created a django
> project, and basically all this contains is the modified home page of
> the existing website with the search that generates a list of results.
>
> Now I need to move across the rest of the website to the new server,
> and I need to do this with minimal effort. I also need to preserve the
> existing page URLs.
>
> It maybe the case that there are no real shortcuts, but I just didn't
> want to make unnecessary work for myself!
>
> If anyone has some tips, please let me know.
>
> Thanks again for the support
>
> Mark
>
> On Nov 30, 5:21 pm, creecode  wrote:
>
>
>
>
>
>
>
> > Hello Mark,
>
> > On Wednesday, November 30, 2011 8:46:28 AM UTC-8, marjenni wrote:
>
> > All seems good, but what I need to know is what is the easiest/> quickest 
> > way of moving across the rest of the website onto this new
> > > server? Will I need an entry for each page in the urls file?
>
> > It will be hard for us to answer that question unless we know more about
> > how/where the old webpages are stored and how you would like to store them
> > in your Django based website.
>
> > You have several options:
>
> >     Use an app like Flatpages 
> > , which
> > comes with Django.  Webpages are stored in the database.  It might be
> > pretty easy to populate your Django website with some python code you would
> > write that would grab your old webpages, massage them, and store them into
> > your new website database.
>
> >     If the old webpages are static, you could put them into the static area
> > of your website.
>
> > Give us more detail and we can probably be of more help.
>
> > Toodle-lo..
> > creecode

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



double trailing slash in url

2011-12-01 Thread Brian Craft
I have a url spec like so:
(r'^foo/$', 'blah')

I just noted from our server logs that if someone mistakenly types two
slashes ('foo//'), the page
gets served, but all of the relative links are broken. It's really
confusing. I believe it should be redirecting or 404ing instead.

I note that foo/bar and foo/bar/ give 404.

I thought that ending in a $ would prevent this from matching.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: double trailing slash in url

2011-12-01 Thread creecode
Hello Brain,

Could it be you are seeing the results of the APPEND_SLASH setting < 
https://docs.djangoproject.com/en/1.3/ref/settings/#append-slash >.

Toodle-loo...
creecode

-- 
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/-/vjH3Q5JCwXgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: double trailing slash in url

2011-12-01 Thread Brian Craft
I don't think so. It's not issuing a redirect. It's just serving the
view, even though the url spec doesn't match.

On Thu, Dec 1, 2011 at 2:42 PM, creecode  wrote:
> Hello Brain,
>
> Could it be you are seeing the results of the APPEND_SLASH setting <
> https://docs.djangoproject.com/en/1.3/ref/settings/#append-slash >.
>
> Toodle-loo...
> creecode
>
> --
> 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/-/vjH3Q5JCwXgJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django

2011-12-01 Thread Victor Hooi
Hi,

I'm writing a  Django application to mange some XML configuration files 
through the Django-admin.

Currently, I'm converting the XML values/hierarchies into Django models.

After this, we also need to code an import - to import in configuration 
files and populate Django models based on them, and also an export, to 
export from our Django models back into the finished XML configuration 
files.

However, another way might be just to inspect the XSD files we have, and 
try to create the models from that.

I know there's django-models-schemas 
(https://bitbucket.org/eegg/django-model-schemas/wiki/Home), that is meant 
to generate XSD files from Django models. I'm not aware of anything going 
the other way (introspecting XSD files to get Django models).

However, what are your thoughts on this?

Is there an easier way of achieving the main goal - editing XMl 
configuration files through a Django interface? Things I should be aware of?

Cheers,
Victor

-- 
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/-/iWVmPfYsrOQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django

2011-12-01 Thread Victor Hooi
heya,

Damn, I didn't edit the subject - apologies - if there's a moderator, can 
you change it to "Using Django to edit XML configuration files" please?

Thanks,
Victor

-- 
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/-/_7FYPrf30k0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Pointing to Memcached on Remote Server

2011-12-01 Thread mattym
Hi all -

I am stuck on this one. Caching with memcached works when I reference
the local box holding Django. But when I point my setting to a remote
box it does not cache:

This is with Django 1.3 using python-memcached on the localbox in a
virtualenv

 'default': {
'BACKEND':
'django.core.cache.backends.memcached.MemcachedCache',
#'LOCATION': ['127.0.0.1:11211',]  # This works
'LOCATION': ['xx.xxx.xxx.xx:11211',]  # This remote one does not
}

My settings file appears to have the proper middleware installed:

 "django.middleware.gzip.GZipMiddleware",
  "django.middleware.cache.UpdateCacheMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.redirects.middleware.RedirectFallbackMiddleware",
"mezzanine.core.middleware.DeviceAwareUpdateCacheMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"mezzanine.core.middleware.DeviceAwareFetchFromCacheMiddleware",
"mezzanine.core.middleware.AdminLoginInterfaceSelector",
"django.middleware.cache.FetchFromCacheMiddleware",

I've checked that memcached is running on the remote box. I am
probably overlooking something simple.
Any help is greatly appreciated.

Thanks,
Matt

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Bulk import of data

2011-12-01 Thread Nathan McCorkle
would interfacing with SQL via C or C++ be faster to parse and load
data in bulk? I have files that are only a few MB worth of text, but
can take hours to load due to the amount of parsing I do, and the
number of database entries each item in a file makes

On Mon, Nov 28, 2011 at 3:28 AM, Anler Hernandez Peral
 wrote:
> Hi, this is probably not your case, but in case it is, here is my story:
> Creating a script for import CSV files is the best solution as long as they
> are few, but in my case, the problem was that I need to import nearly 40
> VERY BIG CSV files, each one mapping a database table, and I needed to do it
> quickly. I thought that the best way was to use MySQL's "load data in
> local..." functionality since it works very fast and I could create only one
> function to import all the files. The problem was that my CSV files were
> pretty big and my database server were eating big amounts of memory and
> crashing my site so I ended up slicing each file in smaller chunks.
> Again, this is a very specific need, but in case you find yourself in such
> situation, here's my base code from which you can extend ;)
>
> https://gist.github.com/1dc28cd496d52ad67b29
> --
> anler
>
>
> On Sun, Nov 27, 2011 at 7:56 PM, Andre Terra  wrote:
>>
>> This should be run asynchronously (i.e. celery) when importing large
>> files.
>> If you have a lot of categories/subcategories, you will need to bulk
>> insert them instead of looping through the data and just using
>> get_or_create. A single, long transaction will definitely bring great
>> improvements to speed.
>> One tool is DSE, which I've mentioned before.
>> Good luck!
>>
>> Cheers,
>> AT
>>
>> On Sat, Nov 26, 2011 at 8:44 PM, Petr Přikryl  wrote:
>>>
>>> >>> import csv
>>> >>> data = csv.reader(open('/path/to/csv', 'r'), delimiter=';')
>>> >>> for row in data:
>>> >>> category = Category.objects.get_or_create(name=row[0])
>>> >>> sub_category = SubCategory.objects.get_or_create(name=row[1],
>>> >>> defaults={'parent_category': category})
>>> >>> product = Product.objects.get_or_create(name=row[2],
>>> >>> defaults={'sub_category': sub_category})
>>>
>>> There are few potential problems with the cvs as used here.
>>>
>>> Firstly, the file should be opened in binary mode.  In Unix-based
>>> systems, the binary mode is technically similar to text mode.
>>> However, you may once observe problems when you move
>>> the code to another environment (Windows).
>>>
>>> Secondly, the opened file should always be closed -- especially
>>> when building application (web) that may run for a long time.
>>> You can do it like this:
>>>
>>> ...
>>> f = open('/path/to/csv', 'rb')
>>> data = csv.reader(f, delimiter=';')
>>> for ...
>>> ...
>>> f.close()
>>>
>>> Or you can use the new Python construct "with".
>>>
>>> P.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Nathan McCorkle
Rochester Institute of Technology
College of Science, Biotechnology/Bioinformatics

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.