Django signals to all connections?

2013-08-18 Thread Gerd Koetje
Is is possible to start an event at all connected users with signals?
If this is possible can someone show me an example of it.


Greetz
Gerd

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How do I create a script to fill in django admin login form and submit?

2013-08-18 Thread Kelvin Wong
You were missing a key. The following works on my machine.

K

---


import requests
login_url = "http://192.168.0.21/admin/login/;


client = requests.session()
client.get(login_url)


csrftoken = client.cookies['csrftoken']


login_data = {'username':'jim', 'password':'beam', 
'this_is_the_login_form':'1', 'csrfmiddlewaretoken':csrftoken}


r = client.post(login_url, data=login_data)


target_url = "http://192.168.0.21/admin/auth/user/;
t = client.get(target_url)


'Select user to change' in t.text # True 

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: tests failing/throwing errors - not sure where to start

2013-08-18 Thread Kelvin Wong
My advice to you is to just ignore it all and focus on the tests in your 
application.

For example, if your app that you wrote yourself is called "amazingapp" 
then you test only that app thus.

---

$ python manage.py test amazingapp

---

And it will say something similar to this...

---

Creating test database for alias 'default'...
.
--
Ran 1 test in 0.002s

OK
Destroying test database for alias 'default'...

---

Don't bother testing your framework code or your modules, which Django does 
if you leave out the app name (assuming you're not making patches for 
Django itself).

PS. Good for you for testing your code.

K



On Saturday, August 17, 2013 11:27:34 PM UTC-7, Kris Fields wrote:
>
> Hi,
>
> The project I'm working on seems to work fine but running "python 
> manage.py test" results in a lot of failed tests. I'm trying to get a 
> handle on them but I'm not sure where to start.  I'm hoping someone can 
> help point me in the right direction.
>
> Most of the failed tests are for django, but some are for mezzanine and 
> allauth.  I've included them all in case it's relevant.
>
> Running django 1.4.3, python 2.7.2
> Mezzanine 1.4.5, allauth 0.12.0
>
> Any help is much appreciated!
>
> Thanks,
>
> Kris
>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How do I create a script to fill in django admin login form and submit?

2013-08-18 Thread 7equivalents
Ok, I've gotten further. I have confirmed the problem was related to the 
csrf token. This is my new code:


client = requests.session()
# Retrieve the CSRF token first
client.get(URL)  # sets the cookie
csrftoken = client.cookies['csrftoken']

login_data = dict(Username='jim', Password='beam, csrfmiddlewaretoken=csrftoken)
r = client.post(URL, data=login_data)

Now, I get a 200 for the status code, but it still doesn't actually 
login..

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How do I create a script to fill in django admin login form and submit?

2013-08-18 Thread 7equivalents
Ok, I've gotten further. I have confirmed the problem was related to the 
csrf token. This is my new code:


client = requests.session()
# Retrieve the CSRF token first
client.get(URL)  # sets the cookie
csrftoken = client.cookies['csrftoken']

login_data = dict(Username='jim', Password='beam, csrfmiddlewaretoken=csrftoken)
r = client.post(URL, data=login_data)

Now, I get a 200 for the status code, but it still doesn't actually 
login..



-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How do I create a script to fill in django admin login form and submit?

2013-08-18 Thread 7equivalents
Well this is where I'm at. I have used the requests package  to try and 
request the Django Admin login page and submit the username and password. 
However, when I do this I get a 403 error. I have tried to turn off the 
dependency for csrf tokens in the login view by using the csrf_exempt,but 
this gave me a 500 error. So I need to break this down to learn whats going 
on. So here is the code I'm typing into the python prompt:

import rquests

url = "http://192.168.0.21/admin/login/;
payload = {'Username':'jimmy', 'Password':'Beam'}
r = requests.post(url, payload)


I get a 403.

My questions are:
(1) Is the the code above the correct way to fill in and submit the django user 
login form?
(2) What should I do next to troubleshoot the problem?


-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


pinyin.urlify not mapping characters

2013-08-18 Thread lesssugar
Hi,

In my app I'm trying to generate friendly user-profile URL (first name + 
last name) using the following module:

http://pydoc.net/Python/redsolutioncms.django-hex-storage/0.1.1/pinyin.urlify/

However, there is no full char mapping done when I run my test code 
(notice: I changed the function name to my_urlify()):

from maps import *
from urlify import *
s = "żźć ńąś łęó"
print my_urlify(s)

- the code above evaluates to: aaa-aaa-aaa, so the function replaces spaces 
with dash but that's it. Special characters like ł, ź etc. are not being 
mapped.

I'm running Python 2.7.3.
Unicode characters are stored as UCS-4 (sys.maxunicode = 1114111)

Any ideas what could be wrong?



-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Greyed out models in Django Admin

2013-08-18 Thread huw_at1
Hi,

I'm using the latest Apache server on production.

The DEBUG setting is the standard setting that exists within the 
settings.py file.

I'll check what write permissions the production database user has.

Thanks

On Thursday, 31 January 2013 22:56:05 UTC, huw_at1 wrote:
>
> Hi,
>
> Using Django 1.4, have registered 3 model classes with admin. When 
> accessing admin page provided by test server can select each class and edit 
> entries. However when accessing production admin the classes are greyed 
> out, only the users, groups and sites are selectable. I thought this might 
> be database access issues however I can run syncdb without any problems. 
> Any ideas?
>
> Many thanks
>
> Huw Jones.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: upgrading to 1.5.1

2013-08-18 Thread Larry Martell
On Sun, Aug 18, 2013 at 2:51 AM, Harjot Mann  wrote:
> Hello Everyone
> Currently I am using django version 1.4.5 and I want to upgrade it to
> 1.5.1, I have an app in django. I want to know that what problems will
> I face while upgrading to that version. I have no idea about the
> features of new version. Any major points which I need to take into
> consideration?

The 2 issues I ran into are:

1. first argument to url must be quoted
2. direct_to_template and redirect_to have been deprecated in favor of
RedirectView, and you can no longer pass in extra context.

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: upgrading to 1.5.1

2013-08-18 Thread Satinderpal Singh
On Sun, Aug 18, 2013 at 12:21 PM, Harjot Mann  wrote:
> Hello Everyone
> Currently I am using django version 1.4.5 and I want to upgrade it to
> 1.5.1, I have an app in django. I want to know that what problems will
> I face while upgrading to that version. I have no idea about the
> features of new version. Any major points which I need to take into
> consideration?
>
In the 1.5 django version, url requires a non-empty first argument, so
you have to change it accordingly, and there should be other change in
the urls and views, but the advantage of this version is that ,In
Django 1.5, you can now swap out theUser model for one that you write
yourself. This could be a simple extension to the existing User model
– for example, you could add a Twitter or Facebook ID field – or you
could completely replace the User with one totally customized for your
site.

-- 
Satinderpal Singh

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: upgrading to 1.5.1

2013-08-18 Thread Deepak Sharma
On Sun, Aug 18, 2013 at 12:21 PM, Harjot Mann  wrote:
> Hello Everyone
> Currently I am using django version 1.4.5 and I want to upgrade it to
> 1.5.1, I have an app in django. I want to know that what problems will
> I face while upgrading to that version. I have no idea about the
> features of new version. Any major points which I need to take into
> consideration?


Basically in your app. what you need is to change templateview at
place of direct_to_template and put every url in double quotes "".

-- 
Deepak Kumar Sharma
Blog:
http://deekysharma.wordpress.com

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Senior Python/Django Dev in London (£5000-6000 per month)

2013-08-18 Thread George Kazarian
 

Based in London, *The Recipe Kit* is a tech startup with a set mission of 
changing the way people currently eat and cook at home. We believe that all 
traditional shopping and cooking models are quite outdated and create a lot 
of unnecessary stress.

 

We are currently experiencing a growing demand and are looking for an 
experienced Django developer.

 

What you need for this position: 

·  4+ years Django developing, 

·  Javascript

·  jQuery

·  AJAX

·  SASS

·  EC2

·  uWSGI

·  Mandrill

·  GIT

·  Pipeline

·  South

·  Persona MySQL

·  Stripe

·  Cloudflare

·  New Relic

·  Experience with Agile methodologies and test-driven deployment

·  Working in startup environments 

 

What you’ll be doing: 

·  Migration to a new payment provider 

·  Changes to checkout workflow 

·  Order system control (cancel orders, refund payments etc)

·  Discount code abuse prevention

·  CMS improvements 

·  Notifications system 

·  Customer lifecycle tracking

 

What’s in it for you: 

·  Highly Competitive Salary 

·  Equity Participation 

·  Full Benefits

 

So, if you are an Expert Django Developer who would like to make the world 
a better place to live and eat, please apply today!

 

Must be authorized to wok in the UK on full-time basis for any employer.

 

*Contact Note :*geo...@therecipekit.co.uk

 

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: upgrading to 1.5.1

2013-08-18 Thread Lachlan Musicman
Also, you should be upgrading to 1.5.2 - there's a serious security update.

cheers
L.

On 18 August 2013 17:08, Mike Dewhirst  wrote:
> On 18/08/2013 4:51pm, Harjot Mann wrote:
>>
>> Hello Everyone
>> Currently I am using django version 1.4.5 and I want to upgrade it to
>> 1.5.1, I have an app in django. I want to know that what problems will
>> I face while upgrading to that version. I have no idea about the
>> features of new version. Any major points which I need to take into
>> consideration?
>
>
> It depends ...
>
> https://docs.djangoproject.com/en/1.5/releases/1.5/#backwards-incompatible-changes-in-1-5
>
>
>
>
>
>>
>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013:
When you used to be punk, and now you are still punk but not as punk,
are you post-punk or decaying punk or ex-punk or just not punk anymore

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: message_set filter

2013-08-18 Thread Karl Arunachal
Suppose, A is the request.user. And 'msg' has all the mesasges sent by the
user A and all the messages that A has received. Now how will I separate
the messages for each user from 'msg', to make it like an Inbox for A. I
think I have made it clear now. If not, please ask again.
Thank you.


On Sun, Aug 18, 2013 at 2:17 PM, Avraham Serour  wrote:

> so what's the question?
>
>
> On Sat, Aug 17, 2013 at 7:52 AM, Karl Arunachal <
> kakararunachalserv...@gmail.com> wrote:
>
>> Hello,
>> I have a model for messaging between the users.
>>
>> models.py:
>>
>> class Message(models.Model):
>> description = models.TextField()
>> date_added = models.DateTimeField(default=datetime.now)
>> sender = models.ForeignKey(User, related_name='sent_set')
>> recipient = models.ForeignKey(User, related_name='recieved_set')
>>
>> def __unicode__(self):
>> return "%s sent message: %s to %s" % (self.sender, self.description, 
>> self.recipient)
>>
>> def save(self, **kwargs):
>> if self.sender == self.recipient:
>> raise ValueError("Cannot message yourself")
>> super(Message, self).save(**kwargs)
>>
>>
>>
>> Till now I get all the messages (sent/recieved) of a particular user,
>>
>> from django.db.models import Q
>>
>>
>>
>> A = request.usermsg = Message.objects.filter(Q(sender=A)|Q(recipient=A))
>>
>>
>>
>> Suppose, msg has all the messages sent and recieved for user 'A'. Now
>> how would i filter from this 'msg',  all the message sent to and recieved
>> from a particular user 'B'.
>>
>> --
>> 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 group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Foreign key to different model types

2013-08-18 Thread Omar Abou Mrad
On Sun, Aug 18, 2013 at 4:59 AM, Kristofer  wrote:

> Hello,
>
> I remember seeing this some time ago, but can't remember what it is called
> or where it is in the documentation.
>
>
contenttypes framework

https://docs.djangoproject.com/en/1.5/ref/contrib/contenttypes/



> I am looking for the feature that allows for a field to reference a key in
> multiple tables.
>

GenericForeignKey

https://docs.djangoproject.com/en/1.5/ref/contrib/contenttypes/#django.contrib.contenttypes.generic.GenericForeignKey


>
> For example, lets say I have several models: User, Address, Message. Each
> of these models has an "id".  I also have a model called Log, and I want
> each row in the model to refer to the appropriately related model.
>
> Thanks,
> Kris
>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: message_set filter

2013-08-18 Thread Avraham Serour
so what's the question?


On Sat, Aug 17, 2013 at 7:52 AM, Karl Arunachal <
kakararunachalserv...@gmail.com> wrote:

> Hello,
> I have a model for messaging between the users.
>
> models.py:
>
> class Message(models.Model):
> description = models.TextField()
> date_added = models.DateTimeField(default=datetime.now)
> sender = models.ForeignKey(User, related_name='sent_set')
> recipient = models.ForeignKey(User, related_name='recieved_set')
>
> def __unicode__(self):
> return "%s sent message: %s to %s" % (self.sender, self.description, 
> self.recipient)
>
> def save(self, **kwargs):
> if self.sender == self.recipient:
> raise ValueError("Cannot message yourself")
> super(Message, self).save(**kwargs)
>
>
>
> Till now I get all the messages (sent/recieved) of a particular user,
>
> from django.db.models import Q
>
>
> A = request.usermsg = Message.objects.filter(Q(sender=A)|Q(recipient=A))
>
>
>
> Suppose, msg has all the messages sent and recieved for user 'A'. Now how
> would i filter from this 'msg',  all the message sent to and recieved from
> a particular user 'B'.
>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: upgrading to 1.5.1

2013-08-18 Thread Mike Dewhirst

On 18/08/2013 4:51pm, Harjot Mann wrote:

Hello Everyone
Currently I am using django version 1.4.5 and I want to upgrade it to
1.5.1, I have an app in django. I want to know that what problems will
I face while upgrading to that version. I have no idea about the
features of new version. Any major points which I need to take into
consideration?


It depends ...

https://docs.djangoproject.com/en/1.5/releases/1.5/#backwards-incompatible-changes-in-1-5








--
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


upgrading to 1.5.1

2013-08-18 Thread Harjot Mann
Hello Everyone
Currently I am using django version 1.4.5 and I want to upgrade it to
1.5.1, I have an app in django. I want to know that what problems will
I face while upgrading to that version. I have no idea about the
features of new version. Any major points which I need to take into
consideration?

-- 
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.