Re: Reduce number of calls to database

2015-06-05 Thread Cherie Pun

Thanks! Would this still give 404 errors when a certain object does not 
exist?

On Tuesday, 2 June 2015 17:07:49 UTC+1, Simon Charette wrote:
>
> Hi Cherie,
>
> A `id__in` queryset lookup should issue a single query.
>
> levels = Level.objects.filter(id__in=level_ids)
>
> Cheers,
> Simon
>
> Le mardi 2 juin 2015 11:42:19 UTC-4, Cherie Pun a écrit :
>>
>> Hi,
>>
>> I am new to Django and I am performing some iteration on a queryset. When 
>> I use django_debug_toolbar to look at the SQL usage, I realised that Django 
>> is actually calling the database once in each iteration. Is there a way to 
>> make it call the database only once and somehow store it locally so that I 
>> can iterate on it?
>>
>> Code:
>> for level_id in levels_id:
>>levels.append(get_object_or_404(Level, id=level_id))
>>
>>
>> I am trying this modified code, but it seems that it's still calling the 
>> same number of times.
>>
>> levels_dict = repr(Level.objects.values('id', 'name'))
>> for level_id in levels_id:
>> levels.append(levels_dict.get(id=level_id).get('name'))
>>
>> I am trying to use this pattern in quite a few places, where I want to 
>> get some data from a list of objects retrieved from the database and 
>> iterate over them. 
>> I would be happy to provide any missing information.
>>
>> Could anyone kindly help me out? Cheers!
>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/844b1d2b-8665-4176-bee5-06297ebe7247%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reduce number of calls to database

2015-06-05 Thread kelvan
On Fri Jun 5 08:32:52 2015 GMT+0100, Cherie Pun wrote:
> 
> Thanks! Would this still give 404 errors when a certain object does not 
> exist?

Nope, but if you really need to ensure all ids exist in the database, compare 
the length of your level_ids with levels.count()
Make sure there are no duplicates in the id list (e.g. use set(level_ids)).

If they differ raise Http404 manually.

--
Florian
 
> On Tuesday, 2 June 2015 17:07:49 UTC+1, Simon Charette wrote:
> >
> > Hi Cherie,
> >
> > A `id__in` queryset lookup should issue a single query.
> >
> > levels = Level.objects.filter(id__in=level_ids)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/jmuoos.npgoke.2ukv4q-qmf%40meitnerium.buergernetzwerk.at.
For more options, visit https://groups.google.com/d/optout.


Re: Implementing multiple user types with Django 1.7

2015-06-05 Thread Andreas Kuhne
Hi Marcelle,

You should not use the user profile solution anymore, because you can now
create a custom User model instead. Check for example:
http://www.lasolution.be/blog/creating-custom-user-model-django-16-part-1.html

This way you can add fields that are needed for your user solutions in your
own user model. You can of course also add models that are specific for
each type of user if you want.

Regards,

Andréas

2015-06-04 22:56 GMT+02:00 marcelle Kouam :

> hello,
> I want to create differents types of user( manager, employee, client) in
> my model. but I don't know how to implemente this. I read many tutorials on
> the django site but I unable to implement this. thank for your help
>
> this is my models.py
>
>
> from django.db import models
> from django.contrib.auth.models import User
>
> # Create your models here.
>
> class UserProfile(models.Model):
> # This line is required. Links UserProfile to a User model instance.
> user = models.OneToOneField(User)
>
> # The additional attributes we wish to include.
> website = models.URLField(blank=True)
> picture = models.ImageField(upload_to='profile_images', blank=True)
>
> # Override the __unicode__() method to return out something meaningful!
> def __str__(self):
> return self.user.username
>
> class EmployeeProfile(models.Model):
> # This line is required. Links UserProfile to a User model instance.
> user = models.OneToOneField(UserProfile)
>
> # The additional attributes we wish to include.
>
> birthday = models.DateField()
>
> # Override the __unicode__() method to return out something meaningful!
> def __str__(self):
> return self.user.username
>
>
>
> how can
>
>
>
>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1fbb0a3c-e0ea-48d2-b606-0c7db2bffb5d%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUbnHGxKEUC6vRXZi_MzCzY_VZmCcMdoAY1ypY0h03BxtaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Implementing multiple user types with Django 1.7

2015-06-05 Thread Daniel França
You can define different groups for each role and assign the users to the
groups.

Em sex, 5 de jun de 2015 às 11:24, Andreas Kuhne 
escreveu:

> Hi Marcelle,
>
> You should not use the user profile solution anymore, because you can now
> create a custom User model instead. Check for example:
> http://www.lasolution.be/blog/creating-custom-user-model-django-16-part-1.html
>
> This way you can add fields that are needed for your user solutions in
> your own user model. You can of course also add models that are specific
> for each type of user if you want.
>
> Regards,
>
> Andréas
>
> 2015-06-04 22:56 GMT+02:00 marcelle Kouam :
>
>> hello,
>> I want to create differents types of user( manager, employee, client) in
>> my model. but I don't know how to implemente this. I read many tutorials on
>> the django site but I unable to implement this. thank for your help
>>
>> this is my models.py
>>
>>
>> from django.db import models
>> from django.contrib.auth.models import User
>>
>> # Create your models here.
>>
>> class UserProfile(models.Model):
>> # This line is required. Links UserProfile to a User model instance.
>> user = models.OneToOneField(User)
>>
>> # The additional attributes we wish to include.
>> website = models.URLField(blank=True)
>> picture = models.ImageField(upload_to='profile_images', blank=True)
>>
>> # Override the __unicode__() method to return out something meaningful!
>> def __str__(self):
>> return self.user.username
>>
>> class EmployeeProfile(models.Model):
>> # This line is required. Links UserProfile to a User model instance.
>> user = models.OneToOneField(UserProfile)
>>
>> # The additional attributes we wish to include.
>>
>> birthday = models.DateField()
>>
>> # Override the __unicode__() method to return out something meaningful!
>> def __str__(self):
>> return self.user.username
>>
>>
>>
>> how can
>>
>>
>>
>>  --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/1fbb0a3c-e0ea-48d2-b606-0c7db2bffb5d%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALXYUbnHGxKEUC6vRXZi_MzCzY_VZmCcMdoAY1ypY0h03BxtaA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACPst9KqHbuCuCwEF9pS2%2B8J7P2QJjXmn1-NVOiT%3DrEv%2BpEdUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django vs ExtJS

2015-06-05 Thread Antonio Saponara
Hi
I am developing my REST proxy for Sencha,

I have tested with ExtJS and Sencha Touch frameworks and it does support, 
pagination, remote filters, remote sorting and so on.

It's developed with Zend Framework 2 and can support  different DB types on 
the same installation.

Have a look at:
http://apiskeleton.asaconsult.com/




Il giorno martedì 30 dicembre 2014 14:45:08 UTC+1, Jani Tiainen ha scritto:
>
> On Mon, 29 Dec 2014 06:55:57 -0800 (PST) 
> Joris Benschop > wrote: 
>
> > Hi List, 
> > 
> > I;m a data maangement specialist in a rather large multinational. I'm 
> > trying to push Django as a fast development framework for front-end 
> > applications of our databases. Currently the company is focusing on 
> > Sencha ExtJS and java solutions. Can you help me with pointers why 
> > Django is better? The free-as-in-beer argument is not very convincing 
> > by itself. 
> > 
>
> I'll give my late insight here. We're having rather large SPA's built 
> on top of ExtJS + Django and REST rather successfully. 
>
> Of course ExtJS and REST is really a joke - there is nothing that 
> really proper rest support in ExtJS, (no HATEOAS at all) 
>
> For a Django side REST tool we've been using DRF 
> (Django-Rest-Framework) which big gun for REST api. 
>
> Now why we picked Django over several others - We tried PHP, we 
> used Java for few web apps (and it's still in use). First reason was 
> the speed. We could implement features much faster with Python and 
> Django than we ever could do with Java (we did similiar apps with Java 
> as well but pace was definitely slower). Specially getting things 
> done within a reasonable time. Also lot of boilerplate code was 
> unnecessary. In Java we had really carefully plan every attribute and 
> getters and setters. Python makes lot of shortcuts there and it's much 
> more easier to do "magic". Though there lies a danger - you can write 
> Python code as Java (or even like C code) and that is not pretty 
> sight... 
>
> Another reason was level of complexity - even simplest Java app 
> (deployed on Tomcat) takes lot of efforts and "special" knowledge, not 
> to mention that you have to match versions you build with java versions 
> and complex configuration. Python is much more forgiving in those parts. 
>
> Of course we've ran a few issues on the road, like composite keys and 
> some "oo" features of Django ORM that were possible with Hibernate. 
>
> So current main setup in our development stack is Python (2.7), Django 
> (1.5), Oracle (10g and 11g), ExtJS (4.3), Dojotoolkit (1.6), OpenLayers 
> (2.x) and mapserver (6.x) 
>
> -- 
>
> Jani Tiainen 
>
> -- 
>
> Jani Tiainen 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a7fdfc7c-2797-4aa4-8443-e5b5dc1caef0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


I need ur help.

2015-06-05 Thread Wandy Lau
I am new to django. I want to write some templates for my app. And write 
it. But It is seems not loaded.

The structure of the template is below:

mysite/templates/admin is for overriding the admin
mysite/myapp/templates/myapp/* is for my app. 

So far it works well. But it just loads the templates of my app.

Yeah, in the settings.py , the config is :

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.static',
],
},
},
]

I really can't find the the point. Please help with this. Thank you in 
advance.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d3ea0b15-d7da-4f59-b2b8-ed2eaee1f6df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Bug in 1.7-1.8 migrations

2015-06-05 Thread Владислав Пискунов
In 1.7 auto-created migration with makemigrations. it contains: 

related_name=b''

Now in 1.8 while migrate, django tries Render model state and fails with:

File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 338, in execute_from_command_line
utility.execute()
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/core/management/base.py",
 
line 390, in run_from_argv
self.execute(*args, **cmd_options)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/core/management/base.py",
 
line 441, in execute
output = self.handle(*args, **options)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
 
line 221, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/migrations/executor.py",
 
line 104, in migrate
state = migration.mutate_state(state, preserve=do_run)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/migrations/migration.py",
 
line 83, in mutate_state
operation.state_forwards(self.app_label, new_state)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/migrations/operations/models.py",
 
line 158, in state_forwards
apps = state.apps
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/utils/functional.py",
 
line 60, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/migrations/state.py",
 
line 166, in apps
return StateApps(self.real_apps, self.models)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/migrations/state.py",
 
line 232, in __init__
self.render_multiple(list(models.values()) + self.real_models)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/migrations/state.py",
 
line 262, in render_multiple
model.render(self)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/migrations/state.py",
 
line 546, in render
body,
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/models/base.py",
 
line 189, in __new__
new_class.add_to_class(obj_name, obj)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/models/base.py",
 
line 324, in add_to_class
value.contribute_to_class(cls, name)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/models/fields/related.py",
 
line 1767, in contribute_to_class
super(ForeignObject, self).contribute_to_class(cls, name, 
virtual_only=virtual_only)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/models/fields/related.py",
 
line 305, in contribute_to_class
add_lazy_relation(cls, self, other, resolve_related_class)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/models/fields/related.py",
 
line 86, in add_lazy_relation
operation(field, model, cls)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/models/fields/related.py",
 
line 304, in resolve_related_class
field.do_related_class(model, cls)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/models/fields/related.py",
 
line 349, in do_related_class
self.contribute_to_related_class(other, self.rel)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/models/fields/related.py",
 
line 1958, in contribute_to_related_class
super(ForeignKey, self).contribute_to_related_class(cls, related)
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/models/fields/related.py",
 
line 1773, in contribute_to_related_class
if not self.rel.is_hidden() and not related.related_model._meta.swapped:
  File 
"/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/models/fields/related.py",
 
line 1355, in is_hidden
return self.related_name is not None and self.related_name[-1] == '+'
IndexError: string index out of range


-- 
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

Is it possible to connect django to apache derby as a database?

2015-06-05 Thread Uk Jo
I am a newbie about Django and Python. But I attended the basic lecture of 
python. So I will implement my web application.
I want to use apache derby. Is is possible? I am proud of being one of 
member in this group. Thanks.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5c3529de-7010-40ed-9ad0-71294c12f14e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible to connect django to apache derby as a database?

2015-06-05 Thread Florian Apolloner
If it speaks SQL you can just write your own backend for it, but that is 
probably a bit of work.

On Friday, June 5, 2015 at 2:05:40 PM UTC+1, Uk Jo wrote:
>
> I am a newbie about Django and Python. But I attended the basic lecture of 
> python. So I will implement my web application.
> I want to use apache derby. Is is possible? I am proud of being one of 
> member in this group. Thanks.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/03f927c2-fada-409a-8b31-5eaff4ce8079%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reduce number of calls to database

2015-06-05 Thread Cherie Pun
Thanks!

On Friday, 5 June 2015 08:53:48 UTC+1, kel...@ist-total.org wrote:
>
> On Fri Jun 5 08:32:52 2015 GMT+0100, Cherie Pun wrote: 
> > 
> > Thanks! Would this still give 404 errors when a certain object does not 
> > exist? 
>
> Nope, but if you really need to ensure all ids exist in the database, 
> compare the length of your level_ids with levels.count() 
> Make sure there are no duplicates in the id list (e.g. use 
> set(level_ids)). 
>
> If they differ raise Http404 manually. 
>
> -- 
> Florian 
>   
> > On Tuesday, 2 June 2015 17:07:49 UTC+1, Simon Charette wrote: 
> > > 
> > > Hi Cherie, 
> > > 
> > > A `id__in` queryset lookup should issue a single query. 
> > > 
> > > levels = Level.objects.filter(id__in=level_ids)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1e5b6e7f-72bc-45f4-aac5-a3976945f990%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Implementing multiple user types with Django 1.7

2015-06-05 Thread marcelle Kouam
thanks for your responses
I read the tutos that you have sended me andreas but it just implement one 
user.
but I want to have a structure which implements 3 types of users( handler, 
employee and client). can you give a clear example to do this.
thank for your help

Le vendredi 5 juin 2015 05:31:19 UTC-4, daniel.franca a écrit :
>
> You can define different groups for each role and assign the users to the 
> groups.
>
> Em sex, 5 de jun de 2015 às 11:24, Andreas Kuhne  > escreveu:
>
>> Hi Marcelle,
>>
>> You should not use the user profile solution anymore, because you can now 
>> create a custom User model instead. Check for example: 
>> http://www.lasolution.be/blog/creating-custom-user-model-django-16-part-1.html
>>
>> This way you can add fields that are needed for your user solutions in 
>> your own user model. You can of course also add models that are specific 
>> for each type of user if you want.
>>
>> Regards,
>>
>> Andréas
>>
>> 2015-06-04 22:56 GMT+02:00 marcelle Kouam > >:
>>
>>> hello,
>>> I want to create differents types of user( manager, employee, client) in 
>>> my model. but I don't know how to implemente this. I read many tutorials on 
>>> the django site but I unable to implement this. thank for your help
>>>
>>> this is my models.py
>>>
>>>
>>> from django.db import models
>>> from django.contrib.auth.models import User
>>>
>>> # Create your models here.
>>>
>>> class UserProfile(models.Model):
>>> # This line is required. Links UserProfile to a User model instance.
>>> user = models.OneToOneField(User)
>>>
>>> # The additional attributes we wish to include.
>>> website = models.URLField(blank=True)
>>> picture = models.ImageField(upload_to='profile_images', blank=True)
>>>
>>> # Override the __unicode__() method to return out something meaningful!
>>> def __str__(self):
>>> return self.user.username
>>>
>>> class EmployeeProfile(models.Model):
>>> # This line is required. Links UserProfile to a User model instance.
>>> user = models.OneToOneField(UserProfile)
>>>
>>> # The additional attributes we wish to include.
>>>
>>> birthday = models.DateField()
>>>
>>> # Override the __unicode__() method to return out something meaningful!
>>> def __str__(self):
>>> return self.user.username
>>>
>>>
>>>
>>> how can
>>>
>>>
>>>
>>>  -- 
>>> 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...@googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com 
>>> .
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/1fbb0a3c-e0ea-48d2-b606-0c7db2bffb5d%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CALXYUbnHGxKEUC6vRXZi_MzCzY_VZmCcMdoAY1ypY0h03BxtaA%40mail.gmail.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/99a45ba1-789a-4edf-8531-acbb4dfcae59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Implementing multiple user types with Django 1.7

2015-06-05 Thread Andreas Kuhne
Hi again Marcelle,

It really depends on how you want to implement it.

Here is one example which I think is pretty good:
http://scopyleft.fr/blog/2013/django-model-advanced-user-inheritance/

This way you create a new model for each type you want (Handler, Employee
and Client), and then you can check which kind of user it is.

Regards,

Andréas

2015-06-05 16:51 GMT+02:00 marcelle Kouam :

> thanks for your responses
> I read the tutos that you have sended me andreas but it just implement one
> user.
> but I want to have a structure which implements 3 types of users( handler,
> employee and client). can you give a clear example to do this.
> thank for your help
>
> Le vendredi 5 juin 2015 05:31:19 UTC-4, daniel.franca a écrit :
>>
>> You can define different groups for each role and assign the users to the
>> groups.
>>
>> Em sex, 5 de jun de 2015 às 11:24, Andreas Kuhne 
>> escreveu:
>>
>>> Hi Marcelle,
>>>
>>> You should not use the user profile solution anymore, because you can
>>> now create a custom User model instead. Check for example:
>>> http://www.lasolution.be/blog/creating-custom-user-model-django-16-part-1.html
>>>
>>> This way you can add fields that are needed for your user solutions in
>>> your own user model. You can of course also add models that are specific
>>> for each type of user if you want.
>>>
>>> Regards,
>>>
>>> Andréas
>>>
>>> 2015-06-04 22:56 GMT+02:00 marcelle Kouam :
>>>
 hello,
 I want to create differents types of user( manager, employee, client)
 in my model. but I don't know how to implemente this. I read many tutorials
 on the django site but I unable to implement this. thank for your help

 this is my models.py


 from django.db import models
 from django.contrib.auth.models import User

 # Create your models here.

 class UserProfile(models.Model):
 # This line is required. Links UserProfile to a User model instance.
 user = models.OneToOneField(User)

 # The additional attributes we wish to include.
 website = models.URLField(blank=True)
 picture = models.ImageField(upload_to='profile_images', blank=True)

 # Override the __unicode__() method to return out something meaningful!
 def __str__(self):
 return self.user.username

 class EmployeeProfile(models.Model):
 # This line is required. Links UserProfile to a User model instance.
 user = models.OneToOneField(UserProfile)

 # The additional attributes we wish to include.

 birthday = models.DateField()

 # Override the __unicode__() method to return out something meaningful!
 def __str__(self):
 return self.user.username



 how can



  --
 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...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/1fbb0a3c-e0ea-48d2-b606-0c7db2bffb5d%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>  --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CALXYUbnHGxKEUC6vRXZi_MzCzY_VZmCcMdoAY1ypY0h03BxtaA%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/99a45ba1-789a-4edf-8531-acbb4dfcae59%40googlegroups.com
> 

Re: Heisenbug to do with self.client losing its sessionstore

2015-06-05 Thread mlpizarro
Hi, I am facing a similar issue and have not found any solution yet. I was 
wondering if you had been able to fix this?

On Tuesday, 31 March 2015 22:27:32 UTC+2, Peter Bengtsson wrote:
>
> I have this code that looks something like this (django 1.6.11):
>
> def test_something(self):
> url = someobject.get_url()
> User.objects.create_user('a', 'a...@example.com ', 
> 'secret')
> assert self.client.login(username='a', password='secret')
> r = self.client.get(url)
> assert r.status_code == 302  # because you're not allowed to view it
> someobject.privacy_setting = 'different'
> r = self.client.get(url)
> assert r.status_code == 200  # now you can view it according the 
> business logic
>
>
> This code has been working for many many months but suddenly it started to 
> Heisenfail with the last line being 302 != 200.
> It might be related to caching somewhere else because it ONLY ever fails 
> (if it fails!) when I run the whole test suite. 
> After a lot of painful debugging I concluded that sometimes, that last 
> self.client.get(url) causes `request.user ==  >`
>
> I.e. for the second request made by that logged in client, it's all of a 
> sudden NOT logged in!! Not always. Only sometimes. :(
>
> I put in a debugging line just before that last test like `assert 
> self.client.session['_auth_user_id']` and that sometimes fails. Almost as 
> if the testclient loses its session store DURING the lifetime of the test. 
> Sometimes. 
>
>
> Anybody seen anything similar that might be able to explain it or give me 
> a clue?
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/aaca3ca4-098a-4e66-8c63-e3d54baa4036%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django subprocess doesnt like sleep

2015-06-05 Thread dk
I created a website that can reboot a machine. basically subprocess a 
script that lunch the reboot command in Linux.
after that  I need to run some other operations. after that I wait 1 minute 
before start pinging the machine to see if its back online.

the funny thing my script doesn't work, and I found out that django doesn't 
like to wait more than 24 secs. =(  I might be doing something wrong?  If I 
do more than 25 the process just stops at the time.sleep(60) and nothing 
happen afterwards.  if I do it for 24 secs everything run fine.   

is there any special thing that I should know?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/89d96ad6-88b2-402a-9e23-269b02ea4155%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to get get-pip.py

2015-06-05 Thread Steve Burrus
Okay Monte I will certsainly "man up" and start over and try to do what you 
said. Incidentally I have done the "Add python.exe to the PATH" thing that 
you suggested but it still failed! I have done all of the configuration the 
right way but I still simply cannot type "pip" [into the command line] and 
get all of the pip commands.

On Thursday, June 4, 2015 at 10:30:36 PM UTC-5, Monte Milanuk wrote:
>
> Stop. 
>
> Uninstall python (whatever version(s) you have). 
>
> Re-install python (3.4.3), but this time when you get to the screen 
> telling you what all is going to be installed, scroll down and enable 
> the last item "Add python.exe to the PATH". 
>
> Python commands (including pip) should work from the command line with 
> no problem.  I did *exactly* this as a test this afternoon, and told you 
> so earlier. Quit flailing about and start over. 
>
>
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/efc089d1-6e9c-48a8-a7c3-4cca3bdbec32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django subprocess doesnt like sleep

2015-06-05 Thread dk
this is what I got from putting 
*time.sleep(60)*
*print "sleeped for 60secs"*
*print 6*
directly in the view.
and this is what the httpd log gave me.



*[Fri Jun 05 11:31:02.034913 2015] [mpm_prefork:notice] [pid 33231] 
AH00170: caught SIGWINCH, shutting down gracefully[Fri Jun 05 
16:31:02.046665 2015] [:error] [pid 33304] sleeped for 60secs[Fri Jun 05 
16:31:02.046702 2015] [:error] [pid 33304] 6*

why is shutting down gracefully, what does it mean? that killed to 
process?  why?can this be happening to my subprocess? 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/222a147f-1771-43f7-8b0c-621819cfb89e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to get get-pip.py

2015-06-05 Thread Steve Burrus
well moknte I got good/bad news for you! The GOOD news is that I finally
got pip installed successfully but the BAD news is that I wasn't able to
upgrade pip. Here is the resulting error when I tried to do that :

"C:\Users\SteveB>pip install --upgrade pip
You are using pip version 6.0.8, however version 7.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip from
https://pypi.python.org/packages/py2.py3/p/pip/pip-7.0.3-py2.py3-none-any.whl#md5=6950e1d775fea7ea50af690f72589dbd
  Using cached pip-7.0.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 6.0.8
Uninstalling pip-6.0.8:
  Successfully uninstalled pip-6.0.8
  Exception:
  Traceback (most recent call last):
File "C:\Python34\lib\shutil.py", line 371, in _rmtree_unsafe
os.unlink(fullname)
  PermissionError: [WinError 5] Access is denied:
'C:\\Users\\SteveB\\AppData\\Local\\Temp\\pip-xfly9791-uninstall\\python34\\scripts\\pip.exe'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pip\basecommand.py", line 232, in
main
  return PREVIOUS_BUILD_DIR_ERROR
File "C:\Python34\lib\site-packages\pip\commands\install.py", line 347,
in run
  if os.path.islink(target_item_dir):
File "C:\Python34\lib\site-packages\pip\req\req_set.py", line 560, in
install
  self.successfully_downloaded.append(req_to_install)
File "C:\Python34\lib\site-packages\pip\req\req_install.py", line 680,
in commit_uninstall
File "C:\Python34\lib\site-packages\pip\req\req_uninstall.py", line
153, in commit
  rmtree(self.save_dir)
File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line 49,
in wrapped_f
  return Retrying(*dargs, **dkw).call(f, *args, **kw)
File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line 212,
in call
  raise attempt.get()
File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line 247,
in get
  six.reraise(self.value[0], self.value[1], self.value[2])
File "C:\Python34\lib\site-packages\pip\_vendor\six.py", line 659, in
reraise
  raise value
File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line 200,
in call
  attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
File "C:\Python34\lib\site-packages\pip\utils\__init__.py", line 61, in
rmtree
  try:
File "C:\Python34\lib\shutil.py", line 478, in rmtree
  return _rmtree_unsafe(path, onerror)
File "C:\Python34\lib\shutil.py", line 368, in _rmtree_unsafe
  _rmtree_unsafe(fullname, onerror)
File "C:\Python34\lib\shutil.py", line 368, in _rmtree_unsafe
  _rmtree_unsafe(fullname, onerror)
File "C:\Python34\lib\shutil.py", line 373, in _rmtree_unsafe
  onerror(os.unlink, fullname, sys.exc_info())
File "C:\Python34\lib\site-packages\pip\utils\__init__.py", line 73, in
rmtree_errorhandler
  raise
  PermissionError: [WinError 5] Access is denied:
'C:\\Users\\SteveB\\AppData\\Local\\Temp\\pip-xfly9791-uninstall\\python34\\scripts\\pip.exe'
"

Now what's wrong?

On Fri, Jun 5, 2015 at 10:51 AM, Steve Burrus 
wrote:

> Okay Monte I will certsainly "man up" and start over and try to do what
> you said. Incidentally I have done the "Add python.exe to the PATH" thing
> that you suggested but it still failed! I have done all of the
> configuration the right way but I still simply cannot type "pip" [into the
> command line] and get all of the pip commands.
>
> On Thursday, June 4, 2015 at 10:30:36 PM UTC-5, Monte Milanuk wrote:
>>
>> Stop.
>>
>> Uninstall python (whatever version(s) you have).
>>
>> Re-install python (3.4.3), but this time when you get to the screen
>> telling you what all is going to be installed, scroll down and enable
>> the last item "Add python.exe to the PATH".
>>
>> Python commands (including pip) should work from the command line with
>> no problem.  I did *exactly* this as a test this afternoon, and told you
>> so earlier. Quit flailing about and start over.
>>
>>
>>
>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABcoaSATZOdDeEpuK0ghOH%2BgPR4BtH%3DVOuQqwqktF2TdVd_XWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django subprocess doesnt like sleep

2015-06-05 Thread Vijay Khemlani
I don't think you should be doing that kind of work in the web server
process.

If you want to run a task that may take a long time to finish then use
celery or something like that.

On Fri, Jun 5, 2015 at 1:34 PM, dk  wrote:

> this is what I got from putting
> *time.sleep(60)*
> *print "sleeped for 60secs"*
> *print 6*
> directly in the view.
> and this is what the httpd log gave me.
>
>
>
> *[Fri Jun 05 11:31:02.034913 2015] [mpm_prefork:notice] [pid 33231]
> AH00170: caught SIGWINCH, shutting down gracefully[Fri Jun 05
> 16:31:02.046665 2015] [:error] [pid 33304] sleeped for 60secs[Fri Jun 05
> 16:31:02.046702 2015] [:error] [pid 33304] 6*
>
> why is shutting down gracefully, what does it mean? that killed to
> process?  why?can this be happening to my subprocess?
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/222a147f-1771-43f7-8b0c-621819cfb89e%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei3qttBKFM-3q%3D05VW11ZmqYSFxyYuiKaV7hGsda%2BTJysg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to get get-pip.py

2015-06-05 Thread Gergely Polonkai
Hello,

it seems that the user running pip doesn’t have write access to the temp
directory. You should check the permissions of
C:\Users\SteveB\AppData\Local\Temp and its subdirectories as you can see in
the PermissionError line (just change the double backslashes (\\) to single
ones (\).

Is it possible that you run pip with a user other than the one you used to
install Python?

Best,
Gergely

2015-06-05 18:41 GMT+02:00 Steve Burrus :

> well moknte I got good/bad news for you! The GOOD news is that I finally
> got pip installed successfully but the BAD news is that I wasn't able to
> upgrade pip. Here is the resulting error when I tried to do that :
>
> "C:\Users\SteveB>pip install --upgrade pip
> You are using pip version 6.0.8, however version 7.0.3 is available.
> You should consider upgrading via the 'pip install --upgrade pip' command.
> Collecting pip from
> https://pypi.python.org/packages/py2.py3/p/pip/pip-7.0.3-py2.py3-none-any.whl#md5=6950e1d775fea7ea50af690f72589dbd
>   Using cached pip-7.0.3-py2.py3-none-any.whl
> Installing collected packages: pip
>   Found existing installation: pip 6.0.8
> Uninstalling pip-6.0.8:
>   Successfully uninstalled pip-6.0.8
>   Exception:
>   Traceback (most recent call last):
> File "C:\Python34\lib\shutil.py", line 371, in _rmtree_unsafe
> os.unlink(fullname)
>   PermissionError: [WinError 5] Access is denied:
> 'C:\\Users\\SteveB\\AppData\\Local\\Temp\\pip-xfly9791-uninstall\\python34\\scripts\\pip.exe'
>
>   During handling of the above exception, another exception occurred:
>
>   Traceback (most recent call last):
> File "C:\Python34\lib\site-packages\pip\basecommand.py", line 232, in
> main
>   return PREVIOUS_BUILD_DIR_ERROR
> File "C:\Python34\lib\site-packages\pip\commands\install.py", line
> 347, in run
>   if os.path.islink(target_item_dir):
> File "C:\Python34\lib\site-packages\pip\req\req_set.py", line 560, in
> install
>   self.successfully_downloaded.append(req_to_install)
> File "C:\Python34\lib\site-packages\pip\req\req_install.py", line 680,
> in commit_uninstall
> File "C:\Python34\lib\site-packages\pip\req\req_uninstall.py", line
> 153, in commit
>   rmtree(self.save_dir)
> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line 49,
> in wrapped_f
>   return Retrying(*dargs, **dkw).call(f, *args, **kw)
> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
> 212, in call
>   raise attempt.get()
> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
> 247, in get
>   six.reraise(self.value[0], self.value[1], self.value[2])
> File "C:\Python34\lib\site-packages\pip\_vendor\six.py", line 659, in
> reraise
>   raise value
> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
> 200, in call
>   attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
> File "C:\Python34\lib\site-packages\pip\utils\__init__.py", line 61,
> in rmtree
>   try:
> File "C:\Python34\lib\shutil.py", line 478, in rmtree
>   return _rmtree_unsafe(path, onerror)
> File "C:\Python34\lib\shutil.py", line 368, in _rmtree_unsafe
>   _rmtree_unsafe(fullname, onerror)
> File "C:\Python34\lib\shutil.py", line 368, in _rmtree_unsafe
>   _rmtree_unsafe(fullname, onerror)
> File "C:\Python34\lib\shutil.py", line 373, in _rmtree_unsafe
>   onerror(os.unlink, fullname, sys.exc_info())
> File "C:\Python34\lib\site-packages\pip\utils\__init__.py", line 73,
> in rmtree_errorhandler
>   raise
>   PermissionError: [WinError 5] Access is denied:
> 'C:\\Users\\SteveB\\AppData\\Local\\Temp\\pip-xfly9791-uninstall\\python34\\scripts\\pip.exe'
>  "
>
> Now what's wrong?
>
> On Fri, Jun 5, 2015 at 10:51 AM, Steve Burrus 
> wrote:
>
>> Okay Monte I will certsainly "man up" and start over and try to do what
>> you said. Incidentally I have done the "Add python.exe to the PATH" thing
>> that you suggested but it still failed! I have done all of the
>> configuration the right way but I still simply cannot type "pip" [into the
>> command line] and get all of the pip commands.
>>
>> On Thursday, June 4, 2015 at 10:30:36 PM UTC-5, Monte Milanuk wrote:
>>>
>>> Stop.
>>>
>>> Uninstall python (whatever version(s) you have).
>>>
>>> Re-install python (3.4.3), but this time when you get to the screen
>>> telling you what all is going to be installed, scroll down and enable
>>> the last item "Add python.exe to the PATH".
>>>
>>> Python commands (including pip) should work from the command line with
>>> no problem.  I did *exactly* this as a test this afternoon, and told you
>>> so earlier. Quit flailing about and start over.
>>>
>>>
>>>
>>>
>>>
>  --
> 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 dja

Re: how to get get-pip.py

2015-06-05 Thread DHaval Joshi
sry dear i don't know about windows installation.

On Fri, Jun 5, 2015 at 10:20 PM, Gergely Polonkai 
wrote:

> Hello,
>
> it seems that the user running pip doesn’t have write access to the temp
> directory. You should check the permissions of
> C:\Users\SteveB\AppData\Local\Temp and its subdirectories as you can see in
> the PermissionError line (just change the double backslashes (\\) to single
> ones (\).
>
> Is it possible that you run pip with a user other than the one you used to
> install Python?
>
> Best,
> Gergely
>
> 2015-06-05 18:41 GMT+02:00 Steve Burrus :
>
>> well moknte I got good/bad news for you! The GOOD news is that I finally
>> got pip installed successfully but the BAD news is that I wasn't able to
>> upgrade pip. Here is the resulting error when I tried to do that :
>>
>> "C:\Users\SteveB>pip install --upgrade pip
>> You are using pip version 6.0.8, however version 7.0.3 is available.
>> You should consider upgrading via the 'pip install --upgrade pip' command.
>> Collecting pip from
>> https://pypi.python.org/packages/py2.py3/p/pip/pip-7.0.3-py2.py3-none-any.whl#md5=6950e1d775fea7ea50af690f72589dbd
>>   Using cached pip-7.0.3-py2.py3-none-any.whl
>> Installing collected packages: pip
>>   Found existing installation: pip 6.0.8
>> Uninstalling pip-6.0.8:
>>   Successfully uninstalled pip-6.0.8
>>   Exception:
>>   Traceback (most recent call last):
>> File "C:\Python34\lib\shutil.py", line 371, in _rmtree_unsafe
>> os.unlink(fullname)
>>   PermissionError: [WinError 5] Access is denied:
>> 'C:\\Users\\SteveB\\AppData\\Local\\Temp\\pip-xfly9791-uninstall\\python34\\scripts\\pip.exe'
>>
>>   During handling of the above exception, another exception occurred:
>>
>>   Traceback (most recent call last):
>> File "C:\Python34\lib\site-packages\pip\basecommand.py", line 232, in
>> main
>>   return PREVIOUS_BUILD_DIR_ERROR
>> File "C:\Python34\lib\site-packages\pip\commands\install.py", line
>> 347, in run
>>   if os.path.islink(target_item_dir):
>> File "C:\Python34\lib\site-packages\pip\req\req_set.py", line 560, in
>> install
>>   self.successfully_downloaded.append(req_to_install)
>> File "C:\Python34\lib\site-packages\pip\req\req_install.py", line
>> 680, in commit_uninstall
>> File "C:\Python34\lib\site-packages\pip\req\req_uninstall.py", line
>> 153, in commit
>>   rmtree(self.save_dir)
>> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
>> 49, in wrapped_f
>>   return Retrying(*dargs, **dkw).call(f, *args, **kw)
>> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
>> 212, in call
>>   raise attempt.get()
>> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
>> 247, in get
>>   six.reraise(self.value[0], self.value[1], self.value[2])
>> File "C:\Python34\lib\site-packages\pip\_vendor\six.py", line 659, in
>> reraise
>>   raise value
>> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
>> 200, in call
>>   attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
>> File "C:\Python34\lib\site-packages\pip\utils\__init__.py", line 61,
>> in rmtree
>>   try:
>> File "C:\Python34\lib\shutil.py", line 478, in rmtree
>>   return _rmtree_unsafe(path, onerror)
>> File "C:\Python34\lib\shutil.py", line 368, in _rmtree_unsafe
>>   _rmtree_unsafe(fullname, onerror)
>> File "C:\Python34\lib\shutil.py", line 368, in _rmtree_unsafe
>>   _rmtree_unsafe(fullname, onerror)
>> File "C:\Python34\lib\shutil.py", line 373, in _rmtree_unsafe
>>   onerror(os.unlink, fullname, sys.exc_info())
>> File "C:\Python34\lib\site-packages\pip\utils\__init__.py", line 73,
>> in rmtree_errorhandler
>>   raise
>>   PermissionError: [WinError 5] Access is denied:
>> 'C:\\Users\\SteveB\\AppData\\Local\\Temp\\pip-xfly9791-uninstall\\python34\\scripts\\pip.exe'
>>  "
>>
>> Now what's wrong?
>>
>> On Fri, Jun 5, 2015 at 10:51 AM, Steve Burrus 
>> wrote:
>>
>>> Okay Monte I will certsainly "man up" and start over and try to do what
>>> you said. Incidentally I have done the "Add python.exe to the PATH" thing
>>> that you suggested but it still failed! I have done all of the
>>> configuration the right way but I still simply cannot type "pip" [into the
>>> command line] and get all of the pip commands.
>>>
>>> On Thursday, June 4, 2015 at 10:30:36 PM UTC-5, Monte Milanuk wrote:

 Stop.

 Uninstall python (whatever version(s) you have).

 Re-install python (3.4.3), but this time when you get to the screen
 telling you what all is going to be installed, scroll down and enable
 the last item "Add python.exe to the PATH".

 Python commands (including pip) should work from the command line with
 no problem.  I did *exactly* this as a test this afternoon, and told
 you
 so earlier. Quit flailing about and start over.





>>  --
>> You received this mess

Re: how to get get-pip.py

2015-06-05 Thread Steve Burrus
well tqhat's okay. I was absolutely struggling to get pip installed
correctly for quite a long time! I need to see more videos on how to start
to work with Django. You have any tips about t hat?

On Fri, Jun 5, 2015 at 12:43 PM, DHaval Joshi  wrote:

> sry dear i don't know about windows installation.
>
> On Fri, Jun 5, 2015 at 10:20 PM, Gergely Polonkai 
> wrote:
>
>> Hello,
>>
>> it seems that the user running pip doesn’t have write access to the temp
>> directory. You should check the permissions of
>> C:\Users\SteveB\AppData\Local\Temp and its subdirectories as you can see in
>> the PermissionError line (just change the double backslashes (\\) to single
>> ones (\).
>>
>> Is it possible that you run pip with a user other than the one you used
>> to install Python?
>>
>> Best,
>> Gergely
>>
>> 2015-06-05 18:41 GMT+02:00 Steve Burrus :
>>
>>> well moknte I got good/bad news for you! The GOOD news is that I finally
>>> got pip installed successfully but the BAD news is that I wasn't able to
>>> upgrade pip. Here is the resulting error when I tried to do that :
>>>
>>> "C:\Users\SteveB>pip install --upgrade pip
>>> You are using pip version 6.0.8, however version 7.0.3 is available.
>>> You should consider upgrading via the 'pip install --upgrade pip'
>>> command.
>>> Collecting pip from
>>> https://pypi.python.org/packages/py2.py3/p/pip/pip-7.0.3-py2.py3-none-any.whl#md5=6950e1d775fea7ea50af690f72589dbd
>>>   Using cached pip-7.0.3-py2.py3-none-any.whl
>>> Installing collected packages: pip
>>>   Found existing installation: pip 6.0.8
>>> Uninstalling pip-6.0.8:
>>>   Successfully uninstalled pip-6.0.8
>>>   Exception:
>>>   Traceback (most recent call last):
>>> File "C:\Python34\lib\shutil.py", line 371, in
>>> _rmtree_unsafe os.unlink(fullname)
>>>   PermissionError: [WinError 5] Access is denied:
>>> 'C:\\Users\\SteveB\\AppData\\Local\\Temp\\pip-xfly9791-uninstall\\python34\\scripts\\pip.exe'
>>>
>>>   During handling of the above exception, another exception occurred:
>>>
>>>   Traceback (most recent call last):
>>> File "C:\Python34\lib\site-packages\pip\basecommand.py", line 232,
>>> in main
>>>   return PREVIOUS_BUILD_DIR_ERROR
>>> File "C:\Python34\lib\site-packages\pip\commands\install.py", line
>>> 347, in run
>>>   if os.path.islink(target_item_dir):
>>> File "C:\Python34\lib\site-packages\pip\req\req_set.py", line 560,
>>> in install
>>>   self.successfully_downloaded.append(req_to_install)
>>> File "C:\Python34\lib\site-packages\pip\req\req_install.py", line
>>> 680, in commit_uninstall
>>> File "C:\Python34\lib\site-packages\pip\req\req_uninstall.py", line
>>> 153, in commit
>>>   rmtree(self.save_dir)
>>> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
>>> 49, in wrapped_f
>>>   return Retrying(*dargs, **dkw).call(f, *args, **kw)
>>> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
>>> 212, in call
>>>   raise attempt.get()
>>> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
>>> 247, in get
>>>   six.reraise(self.value[0], self.value[1], self.value[2])
>>> File "C:\Python34\lib\site-packages\pip\_vendor\six.py", line 659,
>>> in reraise
>>>   raise value
>>> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
>>> 200, in call
>>>   attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
>>> File "C:\Python34\lib\site-packages\pip\utils\__init__.py", line 61,
>>> in rmtree
>>>   try:
>>> File "C:\Python34\lib\shutil.py", line 478, in rmtree
>>>   return _rmtree_unsafe(path, onerror)
>>> File "C:\Python34\lib\shutil.py", line 368, in _rmtree_unsafe
>>>   _rmtree_unsafe(fullname, onerror)
>>> File "C:\Python34\lib\shutil.py", line 368, in _rmtree_unsafe
>>>   _rmtree_unsafe(fullname, onerror)
>>> File "C:\Python34\lib\shutil.py", line 373, in _rmtree_unsafe
>>>   onerror(os.unlink, fullname, sys.exc_info())
>>> File "C:\Python34\lib\site-packages\pip\utils\__init__.py", line 73,
>>> in rmtree_errorhandler
>>>   raise
>>>   PermissionError: [WinError 5] Access is denied:
>>> 'C:\\Users\\SteveB\\AppData\\Local\\Temp\\pip-xfly9791-uninstall\\python34\\scripts\\pip.exe'
>>>  "
>>>
>>> Now what's wrong?
>>>
>>> On Fri, Jun 5, 2015 at 10:51 AM, Steve Burrus 
>>> wrote:
>>>
 Okay Monte I will certsainly "man up" and start over and try to do what
 you said. Incidentally I have done the "Add python.exe to the PATH" thing
 that you suggested but it still failed! I have done all of the
 configuration the right way but I still simply cannot type "pip" [into the
 command line] and get all of the pip commands.

 On Thursday, June 4, 2015 at 10:30:36 PM UTC-5, Monte Milanuk wrote:
>
> Stop.
>
> Uninstall python (whatever version(s) you have).
>
> Re-install python (3.4.3), but this time when you get to the screen
> telling you what all is 

Re: Bug in 1.7-1.8 migrations

2015-06-05 Thread Carl Meyer
Hi!

On 06/05/2015 05:29 AM, Владислав Пискунов wrote:
> In 1.7 auto-created migration with makemigrations. it contains: 
> 
> |
> related_name=b''
> |
> 
> Now in 1.8 while migrate, django tries Render model state and fails with:
> 
[snip]

>   File
> "/home/vladislav/.virtualenvs/furskru/local/lib/python2.7/site-packages/django/db/models/fields/related.py",
> line 1355, in is_hidden
> return self.related_name is not None and self.related_name[-1] == '+'
> IndexError: string index out of range
> |

Certainly looks like a bug! Would you be willing to report it at
https://code.djangoproject.com/newticket ?

Thanks!

Carl

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5571E8BC.2000403%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: Heisenbug to do with self.client losing its sessionstore

2015-06-05 Thread Peter Bengtsson
No :(

It's still a mystery. It's really annoying. It resurfaced again about 2 
weeks ago and it caused several test failures that I could never reproduce 
locally. 
I have some tests that look like this:

class TestCase(DjangoTestCase):
  def setUp(self):
  super(TestCase, self).setUp()
  User.objects.create(...)
  assert self.client.login(...)

  def test_something(self):
  response = self.client.get('/some/url/for/signed/in/people')
  assert response.status_code == 200
   
But sometimes, for no reason I can understand, that fails because at the 
point of doing the self.client.get the self.client.session is empty! :(



On Friday, June 5, 2015 at 8:10:52 AM UTC-7, mlpi...@qdqmedia.com wrote:
>
> Hi, I am facing a similar issue and have not found any solution yet. I was 
> wondering if you had been able to fix this?
>
> On Tuesday, 31 March 2015 22:27:32 UTC+2, Peter Bengtsson wrote:
>>
>> I have this code that looks something like this (django 1.6.11):
>>
>> def test_something(self):
>> url = someobject.get_url()
>> User.objects.create_user('a', 'a...@example.com', 'secret')
>> assert self.client.login(username='a', password='secret')
>> r = self.client.get(url)
>> assert r.status_code == 302  # because you're not allowed to view it
>> someobject.privacy_setting = 'different'
>> r = self.client.get(url)
>> assert r.status_code == 200  # now you can view it according the 
>> business logic
>>
>>
>> This code has been working for many many months but suddenly it started 
>> to Heisenfail with the last line being 302 != 200.
>> It might be related to caching somewhere else because it ONLY ever fails 
>> (if it fails!) when I run the whole test suite. 
>> After a lot of painful debugging I concluded that sometimes, that last 
>> self.client.get(url) causes `request.user == > >`
>>
>> I.e. for the second request made by that logged in client, it's all of a 
>> sudden NOT logged in!! Not always. Only sometimes. :(
>>
>> I put in a debugging line just before that last test like `assert 
>> self.client.session['_auth_user_id']` and that sometimes fails. Almost as 
>> if the testclient loses its session store DURING the lifetime of the test. 
>> Sometimes. 
>>
>>
>> Anybody seen anything similar that might be able to explain it or give me 
>> a clue?
>>
>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a0207a9f-2928-48a5-80f5-969e2180675e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to get get-pip.py

2015-06-05 Thread Gergely Polonkai
It seems the very first thing you should do is make pip (and with that,
Python) work. For this, you may want to go to a Python related mailing
list, although I’m sure there are many overlapping between the Django list
and that one.

2015-06-05 20:05 GMT+02:00 Steve Burrus :

> well tqhat's okay. I was absolutely struggling to get pip installed
> correctly for quite a long time! I need to see more videos on how to start
> to work with Django. You have any tips about t hat?
>
> On Fri, Jun 5, 2015 at 12:43 PM, DHaval Joshi 
> wrote:
>
>> sry dear i don't know about windows installation.
>>
>> On Fri, Jun 5, 2015 at 10:20 PM, Gergely Polonkai 
>> wrote:
>>
>>> Hello,
>>>
>>> it seems that the user running pip doesn’t have write access to the temp
>>> directory. You should check the permissions of
>>> C:\Users\SteveB\AppData\Local\Temp and its subdirectories as you can see in
>>> the PermissionError line (just change the double backslashes (\\) to single
>>> ones (\).
>>>
>>> Is it possible that you run pip with a user other than the one you used
>>> to install Python?
>>>
>>> Best,
>>> Gergely
>>>
>>> 2015-06-05 18:41 GMT+02:00 Steve Burrus :
>>>
 well moknte I got good/bad news for you! The GOOD news is that I
 finally got pip installed successfully but the BAD news is that I wasn't
 able to upgrade pip. Here is the resulting error when I tried to do that :

 "C:\Users\SteveB>pip install --upgrade pip
 You are using pip version 6.0.8, however version 7.0.3 is available.
 You should consider upgrading via the 'pip install --upgrade pip'
 command.
 Collecting pip from
 https://pypi.python.org/packages/py2.py3/p/pip/pip-7.0.3-py2.py3-none-any.whl#md5=6950e1d775fea7ea50af690f72589dbd
   Using cached pip-7.0.3-py2.py3-none-any.whl
 Installing collected packages: pip
   Found existing installation: pip 6.0.8
 Uninstalling pip-6.0.8:
   Successfully uninstalled pip-6.0.8
   Exception:
   Traceback (most recent call last):
 File "C:\Python34\lib\shutil.py", line 371, in
 _rmtree_unsafe os.unlink(fullname)
   PermissionError: [WinError 5] Access is denied:
 'C:\\Users\\SteveB\\AppData\\Local\\Temp\\pip-xfly9791-uninstall\\python34\\scripts\\pip.exe'

   During handling of the above exception, another exception occurred:

   Traceback (most recent call last):
 File "C:\Python34\lib\site-packages\pip\basecommand.py", line 232,
 in main
   return PREVIOUS_BUILD_DIR_ERROR
 File "C:\Python34\lib\site-packages\pip\commands\install.py", line
 347, in run
   if os.path.islink(target_item_dir):
 File "C:\Python34\lib\site-packages\pip\req\req_set.py", line 560,
 in install
   self.successfully_downloaded.append(req_to_install)
 File "C:\Python34\lib\site-packages\pip\req\req_install.py", line
 680, in commit_uninstall
 File "C:\Python34\lib\site-packages\pip\req\req_uninstall.py", line
 153, in commit
   rmtree(self.save_dir)
 File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
 49, in wrapped_f
   return Retrying(*dargs, **dkw).call(f, *args, **kw)
 File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
 212, in call
   raise attempt.get()
 File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
 247, in get
   six.reraise(self.value[0], self.value[1], self.value[2])
 File "C:\Python34\lib\site-packages\pip\_vendor\six.py", line 659,
 in reraise
   raise value
 File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
 200, in call
   attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
 File "C:\Python34\lib\site-packages\pip\utils\__init__.py", line
 61, in rmtree
   try:
 File "C:\Python34\lib\shutil.py", line 478, in rmtree
   return _rmtree_unsafe(path, onerror)
 File "C:\Python34\lib\shutil.py", line 368, in _rmtree_unsafe
   _rmtree_unsafe(fullname, onerror)
 File "C:\Python34\lib\shutil.py", line 368, in _rmtree_unsafe
   _rmtree_unsafe(fullname, onerror)
 File "C:\Python34\lib\shutil.py", line 373, in _rmtree_unsafe
   onerror(os.unlink, fullname, sys.exc_info())
 File "C:\Python34\lib\site-packages\pip\utils\__init__.py", line
 73, in rmtree_errorhandler
   raise
   PermissionError: [WinError 5] Access is denied:
 'C:\\Users\\SteveB\\AppData\\Local\\Temp\\pip-xfly9791-uninstall\\python34\\scripts\\pip.exe'
  "

 Now what's wrong?

 On Fri, Jun 5, 2015 at 10:51 AM, Steve Burrus 
 wrote:

> Okay Monte I will certsainly "man up" and start over and try to do
> what you said. Incidentally I have done the "Add python.exe to the PATH"
> thing that you suggested but it still failed! I have done all of the
> confi

Re: django subprocess doesnt like sleep

2015-06-05 Thread Tom Lockhart

> On Jun 5, 2015, at 8:44 AM, dk  wrote:
> 
> I created a website that can reboot a machine. basically subprocess a script 
> that lunch the reboot command in Linux.
> after that  I need to run some other operations. after that I wait 1 minute 
> before start pinging the machine to see if its back online.
> 
> the funny thing my script doesn't work, and I found out that django doesn't 
> like to wait more than 24 secs. =(  I might be doing something wrong?  If I 
> do more than 25 the process just stops at the time.sleep(60) and nothing 
> happen afterwards.  if I do it for 24 secs everything run fine.  

That is a long delay for an http request/response cycle.

If you do not already, you may want to model the remote machine state in a 
Django model. Use that to monitor and update the machine states and then your 
client-facing interactions can be decoupled from it.

You can use a subprocess or celery to do the extended work as required.

hth

- Tom

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DB6523B8-0EC3-4181-A247-56B9AF1CFFF7%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django subprocess doesnt like sleep

2015-06-05 Thread dk

some one put in contab -e
** * * * * systemctl resetart httpd*

means that every minute the apache server is restarting and killing 
everything. that's why non of the script where working =(  
now that I commented that line from cron tab its working =).

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cee01cab-d626-4216-96d5-75dd604497fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Upgrade Confusion with ForeignKey

2015-06-05 Thread Tim Sawyer
I've just upgraded from a very old version of Django (1.4) up to 1.7.8, and 
some behaviour isn't how I expect.  I may have missed something - I've not 
been keeping an eye on the framework changes.

Two models, Venue and VenueAlias.  VenueAlias has a ForeignKey to Venue, 
one venue has many VenueAliases. (Full models pasted below.)

My problem is with accessing venuealias_set on my Venue, it doesn't seem to 
be limiting to Venue how it used to in the earlier version.

Here's an interactive session that shows the problem.  Venue 5854 has three 
aliases.

>>> from bbr.contests.models import Venue
>>> lVenue = Venue.objects.filter(id=5854)[0]
>>> lVenue

>>> lVenue.exact
False
>>> lAliases = lVenue.venuealias_set.all()
>>> len(lAliases)
402
>>> print lAliases.query
SELECT "venues_venuealias"."id", "venues_venuealias"."last_modified", 
"venues_venuealias"."created", "venues_venuealias"."name", 
"venues_venuealias"."alias_start_date", 
"venues_venuealias"."alias_end_date", "venues_venuealias"."venue_id", 
"venues_venuealias"."lastChangedBy_id", "venues_venuealias"."owner_id" FROM 
"venues_venuealias" INNER JOIN "contests_venue" ON ( 
"venues_venuealias"."venue_id" = "contests_venue"."id" ) WHERE 
"contests_venue"."exact" = True ORDER BY "venues_venuealias"."name" ASC

Where's the SQL to limit by the foreign key to venue.id=5854?  Why is there 
a reference in here to contests_venue.exact?

Approaching the same problem from the other direction works fine, and I get 
the correct number of aliases returned.

>>> from bbr.venues.models import VenueAlias
>>> lVenueAliases = VenueAlias.objects.filter(venue_id=5854)
>>> len(lVenueAliases)
3
>>> print lVenueAliases.query
SELECT "venues_venuealias"."id", "venues_venuealias"."last_modified", 
"venues_venuealias"."created", "venues_venuealias"."name", 
"venues_venuealias"."alias_start_date", 
"venues_venuealias"."alias_end_date", "venues_venuealias"."venue_id", 
"venues_venuealias"."lastChangedBy_id", "venues_venuealias"."owner_id" FROM 
"venues_venuealias" WHERE "venues_venuealias"."venue_id" = 5854 ORDER BY 
"venues_venuealias"."name" ASC

On my old server, running the old django 1.4 code, both these approaches 
work as expected.  Venue and VenueAlias are actually in different models.py 
files, for historical reasons.

What have I missed?  Thanks for any input/education!

Tim.


class VenueAlias(models.Model):
"""
An alias for a venue
"""
last_modified = 
models.DateTimeField(default=datetime.now,editable=False)
created = models.DateTimeField(default=datetime.now,editable=False)
name = models.CharField(max_length=200, help_text='Name of Venue Alias')
alias_start_date = models.DateField(blank=True, null=True, 
help_text="Start date for this alias (-mm-dd)")
alias_end_date = models.DateField(blank=True, null=True, help_text="End 
date for this alias (-mm-dd)")
venue = models.ForeignKey(Venue)
lastChangedBy = models.ForeignKey(User, editable=False, 
related_name='VenueAliasLastChangedBy')
owner = models.ForeignKey(User, editable=False, 
related_name='VenueAliasOwner')

def save(self):
self.last_modified = datetime.now()
super(VenueAlias, self).save()

def show_start_date(self):
"""
Return true if start date is recent enough to make sense
"""
lCutOffDate = date(year=1700, month=1, day=1)
print lCutOffDate
print self.alias_start_date
if self.alias_start_date > lCutOffDate:
return True
return False
 
@property
def slug(self):
return self.venue.slug

def __unicode__(self):
return "%s -> %s" % (self.name, self.venue.name)

class Meta:
ordering = ['name']
verbose_name_plural = 'Venue aliases'


class Venue(models.Model):
"""
A venue for a contest
"""
last_modified = 
models.DateTimeField(default=datetime.now,editable=False)
created = models.DateTimeField(default=datetime.now,editable=False)
name = models.CharField(max_length=255)
slug = models.SlugField()
country = models.ForeignKey(Region, blank=True, null=True)
latitude = models.CharField(max_length=15, blank=True, null=True)
longitude = models.CharField(max_length=15, blank=True, null=True)
point = geomodels.PointField(dim=3, geography=True, blank=True, 
null=True, editable=False)
postcode = models.CharField(max_length=10, blank=True, null=True)
exact = models.BooleanField(default=False, help_text="True if latitude 
and longitude is for a building, rather than a town")
mapper = models.ForeignKey(User, editable=False, 
related_name='VenueMapper', blank=True, null=True)
parent = models.ForeignKey("Venue", blank=True, null=True)
notes = models.TextField(blank=True, null=True)
lastChangedBy = models.ForeignKey(User, editable=False, 
related_name='VenueLastChangedBy')
owner = models.ForeignKey(User, editable=False, 
related_name='VenueOwner

Re: how to get get-pip.py

2015-06-05 Thread Steve Burrus
oh I thought tha t I told you thsat I *was *able to make python/pip work!
It's just this little thing about not being able to upgrade pip which
bothers me, just a little bit. and I am not trying to run pip with any
other User other than myself.

On Fri, Jun 5, 2015 at 1:50 PM, Gergely Polonkai 
wrote:

> It seems the very first thing you should do is make pip (and with that,
> Python) work. For this, you may want to go to a Python related mailing
> list, although I’m sure there are many overlapping between the Django list
> and that one.
>
> 2015-06-05 20:05 GMT+02:00 Steve Burrus :
>
>> well tqhat's okay. I was absolutely struggling to get pip installed
>> correctly for quite a long time! I need to see more videos on how to start
>> to work with Django. You have any tips about t hat?
>>
>> On Fri, Jun 5, 2015 at 12:43 PM, DHaval Joshi 
>> wrote:
>>
>>> sry dear i don't know about windows installation.
>>>
>>> On Fri, Jun 5, 2015 at 10:20 PM, Gergely Polonkai 
>>> wrote:
>>>
 Hello,

 it seems that the user running pip doesn’t have write access to the
 temp directory. You should check the permissions of
 C:\Users\SteveB\AppData\Local\Temp and its subdirectories as you can see in
 the PermissionError line (just change the double backslashes (\\) to single
 ones (\).

 Is it possible that you run pip with a user other than the one you used
 to install Python?

 Best,
 Gergely

 2015-06-05 18:41 GMT+02:00 Steve Burrus :

> well moknte I got good/bad news for you! The GOOD news is that I
> finally got pip installed successfully but the BAD news is that I wasn't
> able to upgrade pip. Here is the resulting error when I tried to do that :
>
> "C:\Users\SteveB>pip install --upgrade pip
> You are using pip version 6.0.8, however version 7.0.3 is available.
> You should consider upgrading via the 'pip install --upgrade pip'
> command.
> Collecting pip from
> https://pypi.python.org/packages/py2.py3/p/pip/pip-7.0.3-py2.py3-none-any.whl#md5=6950e1d775fea7ea50af690f72589dbd
>   Using cached pip-7.0.3-py2.py3-none-any.whl
> Installing collected packages: pip
>   Found existing installation: pip 6.0.8
> Uninstalling pip-6.0.8:
>   Successfully uninstalled pip-6.0.8
>   Exception:
>   Traceback (most recent call last):
> File "C:\Python34\lib\shutil.py", line 371, in
> _rmtree_unsafe os.unlink(fullname)
>   PermissionError: [WinError 5] Access is denied:
> 'C:\\Users\\SteveB\\AppData\\Local\\Temp\\pip-xfly9791-uninstall\\python34\\scripts\\pip.exe'
>
>   During handling of the above exception, another exception occurred:
>
>   Traceback (most recent call last):
> File "C:\Python34\lib\site-packages\pip\basecommand.py", line 232,
> in main
>   return PREVIOUS_BUILD_DIR_ERROR
> File "C:\Python34\lib\site-packages\pip\commands\install.py", line
> 347, in run
>   if os.path.islink(target_item_dir):
> File "C:\Python34\lib\site-packages\pip\req\req_set.py", line 560,
> in install
>   self.successfully_downloaded.append(req_to_install)
> File "C:\Python34\lib\site-packages\pip\req\req_install.py", line
> 680, in commit_uninstall
> File "C:\Python34\lib\site-packages\pip\req\req_uninstall.py",
> line 153, in commit
>   rmtree(self.save_dir)
> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
> 49, in wrapped_f
>   return Retrying(*dargs, **dkw).call(f, *args, **kw)
> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
> 212, in call
>   raise attempt.get()
> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
> 247, in get
>   six.reraise(self.value[0], self.value[1], self.value[2])
> File "C:\Python34\lib\site-packages\pip\_vendor\six.py", line 659,
> in reraise
>   raise value
> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py", line
> 200, in call
>   attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
> File "C:\Python34\lib\site-packages\pip\utils\__init__.py", line
> 61, in rmtree
>   try:
> File "C:\Python34\lib\shutil.py", line 478, in rmtree
>   return _rmtree_unsafe(path, onerror)
> File "C:\Python34\lib\shutil.py", line 368, in _rmtree_unsafe
>   _rmtree_unsafe(fullname, onerror)
> File "C:\Python34\lib\shutil.py", line 368, in _rmtree_unsafe
>   _rmtree_unsafe(fullname, onerror)
> File "C:\Python34\lib\shutil.py", line 373, in _rmtree_unsafe
>   onerror(os.unlink, fullname, sys.exc_info())
> File "C:\Python34\lib\site-packages\pip\utils\__init__.py", line
> 73, in rmtree_errorhandler
>   raise
>   PermissionError: [WinError 5] Access is denied:
> 'C:\\Users\\SteveB\\AppData\

Re: Upgrade Confusion with ForeignKey

2015-06-05 Thread Carl Meyer
Hi Tim,

On 06/05/2015 03:44 PM, Tim Sawyer wrote:
> I've just upgraded from a very old version of Django (1.4) up to 1.7.8,
> and some behaviour isn't how I expect.  I may have missed something -
> I've not been keeping an eye on the framework changes.

I would strongly recommend that you upgrade version by version (that is,
first 1.4.x to 1.5.12, then 1.5.12 to 1.6.11, then 1.6.11 to 1.7.8),
each as a separate step, making sure that everything works as you expect
between each step, and that you carefully read the release notes (if you
haven't) for each version as you update to it.

Django tries to maintain backwards compatibility where we can, but we do
have to change and remove features sometimes. Those changes are
documented in the release notes for each version.

If you've upgraded all the way from 1.4 to 1.7 without reading the
release notes, which is what it sounds like, then I will be very
surprised if the below is the only problem you have.

> Two models, Venue and VenueAlias.  VenueAlias has a ForeignKey to Venue,
> one venue has many VenueAliases. (Full models pasted below.)
> 
> My problem is with accessing venuealias_set on my Venue, it doesn't seem
> to be limiting to Venue how it used to in the earlier version.
> 
> Here's an interactive session that shows the problem.  Venue 5854 has
> three aliases.
> 
 from bbr.contests.models import Venue
 lVenue = Venue.objects.filter(id=5854)[0]
 lVenue
>  Manchester, Greater Manchester, England, UK>
 lVenue.exact
> False
 lAliases = lVenue.venuealias_set.all()
 len(lAliases)
> 402
 print lAliases.query
> SELECT "venues_venuealias"."id", "venues_venuealias"."last_modified",
> "venues_venuealias"."created", "venues_venuealias"."name",
> "venues_venuealias"."alias_start_date",
> "venues_venuealias"."alias_end_date", "venues_venuealias"."venue_id",
> "venues_venuealias"."lastChangedBy_id", "venues_venuealias"."owner_id"
> FROM "venues_venuealias" INNER JOIN "contests_venue" ON (
> "venues_venuealias"."venue_id" = "contests_venue"."id" ) WHERE
> "contests_venue"."exact" = True ORDER BY "venues_venuealias"."name" ASC
> 
> Where's the SQL to limit by the foreign key to venue.id=5854?  Why is
> there a reference in here to contests_venue.exact?

That is very strange. I've never seen that, and I'm not aware of any
changes to Django that would cause that. Nor do I see anything in the
models code you pasted below that looks suspicious to me as a possible
cause.

I have to guess that there's some other code in your project causing
this problem, but I'm afraid I don't know what that might be.

I'm afraid the best I can advise is to go back to Django 1.4 and do the
upgrade again methodically, and see if you can track down at precisely
which version this problem first manifests.

Good luck!

Carl


> Approaching the same problem from the other direction works fine, and I
> get the correct number of aliases returned.
> 
 from bbr.venues.models import VenueAlias
 lVenueAliases = VenueAlias.objects.filter(venue_id=5854)
 len(lVenueAliases)
> 3
 print lVenueAliases.query
> SELECT "venues_venuealias"."id", "venues_venuealias"."last_modified",
> "venues_venuealias"."created", "venues_venuealias"."name",
> "venues_venuealias"."alias_start_date",
> "venues_venuealias"."alias_end_date", "venues_venuealias"."venue_id",
> "venues_venuealias"."lastChangedBy_id", "venues_venuealias"."owner_id"
> FROM "venues_venuealias" WHERE "venues_venuealias"."venue_id" = 5854
> ORDER BY "venues_venuealias"."name" ASC
> 
> On my old server, running the old django 1.4 code, both these approaches
> work as expected.  Venue and VenueAlias are actually in different
> models.py files, for historical reasons.
> 
> What have I missed?  Thanks for any input/education!

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55721CB8.9070202%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: how to get get-pip.py

2015-06-05 Thread Gergely Polonkai
So it doesn’t work :) I’m not very familiar with Python on Windows (or
Windows, in general), but this really seems to be a problem related to this.

Have you also checked the permissions on the directory mentioned in the
PermissionDenied message?

2015-06-05 23:53 GMT+02:00 Steve Burrus :

> oh I thought tha t I told you thsat I *was *able to make python/pip work!
> It's just this little thing about not being able to upgrade pip which
> bothers me, just a little bit. and I am not trying to run pip with any
> other User other than myself.
>
> On Fri, Jun 5, 2015 at 1:50 PM, Gergely Polonkai 
> wrote:
>
>> It seems the very first thing you should do is make pip (and with that,
>> Python) work. For this, you may want to go to a Python related mailing
>> list, although I’m sure there are many overlapping between the Django list
>> and that one.
>>
>> 2015-06-05 20:05 GMT+02:00 Steve Burrus :
>>
>>> well tqhat's okay. I was absolutely struggling to get pip installed
>>> correctly for quite a long time! I need to see more videos on how to start
>>> to work with Django. You have any tips about t hat?
>>>
>>> On Fri, Jun 5, 2015 at 12:43 PM, DHaval Joshi 
>>> wrote:
>>>
 sry dear i don't know about windows installation.

 On Fri, Jun 5, 2015 at 10:20 PM, Gergely Polonkai 
 wrote:

> Hello,
>
> it seems that the user running pip doesn’t have write access to the
> temp directory. You should check the permissions of
> C:\Users\SteveB\AppData\Local\Temp and its subdirectories as you can see 
> in
> the PermissionError line (just change the double backslashes (\\) to 
> single
> ones (\).
>
> Is it possible that you run pip with a user other than the one you
> used to install Python?
>
> Best,
> Gergely
>
> 2015-06-05 18:41 GMT+02:00 Steve Burrus :
>
>> well moknte I got good/bad news for you! The GOOD news is that I
>> finally got pip installed successfully but the BAD news is that I wasn't
>> able to upgrade pip. Here is the resulting error when I tried to do that 
>> :
>>
>> "C:\Users\SteveB>pip install --upgrade pip
>> You are using pip version 6.0.8, however version 7.0.3 is available.
>> You should consider upgrading via the 'pip install --upgrade pip'
>> command.
>> Collecting pip from
>> https://pypi.python.org/packages/py2.py3/p/pip/pip-7.0.3-py2.py3-none-any.whl#md5=6950e1d775fea7ea50af690f72589dbd
>>   Using cached pip-7.0.3-py2.py3-none-any.whl
>> Installing collected packages: pip
>>   Found existing installation: pip 6.0.8
>> Uninstalling pip-6.0.8:
>>   Successfully uninstalled pip-6.0.8
>>   Exception:
>>   Traceback (most recent call last):
>> File "C:\Python34\lib\shutil.py", line 371, in
>> _rmtree_unsafe os.unlink(fullname)
>>   PermissionError: [WinError 5] Access is denied:
>> 'C:\\Users\\SteveB\\AppData\\Local\\Temp\\pip-xfly9791-uninstall\\python34\\scripts\\pip.exe'
>>
>>   During handling of the above exception, another exception occurred:
>>
>>   Traceback (most recent call last):
>> File "C:\Python34\lib\site-packages\pip\basecommand.py", line
>> 232, in main
>>   return PREVIOUS_BUILD_DIR_ERROR
>> File "C:\Python34\lib\site-packages\pip\commands\install.py",
>> line 347, in run
>>   if os.path.islink(target_item_dir):
>> File "C:\Python34\lib\site-packages\pip\req\req_set.py", line
>> 560, in install
>>   self.successfully_downloaded.append(req_to_install)
>> File "C:\Python34\lib\site-packages\pip\req\req_install.py", line
>> 680, in commit_uninstall
>> File "C:\Python34\lib\site-packages\pip\req\req_uninstall.py",
>> line 153, in commit
>>   rmtree(self.save_dir)
>> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py",
>> line 49, in wrapped_f
>>   return Retrying(*dargs, **dkw).call(f, *args, **kw)
>> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py",
>> line 212, in call
>>   raise attempt.get()
>> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py",
>> line 247, in get
>>   six.reraise(self.value[0], self.value[1], self.value[2])
>> File "C:\Python34\lib\site-packages\pip\_vendor\six.py", line
>> 659, in reraise
>>   raise value
>> File "C:\Python34\lib\site-packages\pip\_vendor\retrying.py",
>> line 200, in call
>>   attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
>> File "C:\Python34\lib\site-packages\pip\utils\__init__.py", line
>> 61, in rmtree
>>   try:
>> File "C:\Python34\lib\shutil.py", line 478, in rmtree
>>   return _rmtree_unsafe(path, onerror)
>> File "C:\Python34\lib\shutil.py", line 368, in _rmtree_unsafe
>>   _rmtree_unsafe(fullname, onerror)
>> File "C:\Python34\lib\shutil.

Re: Upgrade Confusion with ForeignKey

2015-06-05 Thread Tim Sawyer
Thanks. :-)

Did that, read the release notes, made sure it worked after each upgrade 
stage.  This is an esoteric corner of my app, and I didn't notice it not 
working.  The other foreign key stuff I have seems to work ok.

Looks like I have more investigation to do...any more clues over what 
*could* be the cause appreciated!

Cheers,

Tim.

On Friday, 5 June 2015 23:04:00 UTC+1, Carl Meyer wrote:
>
> Hi Tim, 
>
> On 06/05/2015 03:44 PM, Tim Sawyer wrote: 
> > I've just upgraded from a very old version of Django (1.4) up to 1.7.8, 
> > and some behaviour isn't how I expect.  I may have missed something - 
> > I've not been keeping an eye on the framework changes. 
>
> I would strongly recommend that you upgrade version by version (that is, 
> first 1.4.x to 1.5.12, then 1.5.12 to 1.6.11, then 1.6.11 to 1.7.8), 
> each as a separate step, making sure that everything works as you expect 
> between each step, and that you carefully read the release notes (if you 
> haven't) for each version as you update to it. 
>
> Django tries to maintain backwards compatibility where we can, but we do 
> have to change and remove features sometimes. Those changes are 
> documented in the release notes for each version. 
>
> If you've upgraded all the way from 1.4 to 1.7 without reading the 
> release notes, which is what it sounds like, then I will be very 
> surprised if the below is the only problem you have. 
>
> > Two models, Venue and VenueAlias.  VenueAlias has a ForeignKey to Venue, 
> > one venue has many VenueAliases. (Full models pasted below.) 
> > 
> > My problem is with accessing venuealias_set on my Venue, it doesn't seem 
> > to be limiting to Venue how it used to in the earlier version. 
> > 
> > Here's an interactive session that shows the problem.  Venue 5854 has 
> > three aliases. 
> > 
>  from bbr.contests.models import Venue 
>  lVenue = Venue.objects.filter(id=5854)[0] 
>  lVenue 
> >  > Manchester, Greater Manchester, England, UK> 
>  lVenue.exact 
> > False 
>  lAliases = lVenue.venuealias_set.all() 
>  len(lAliases) 
> > 402 
>  print lAliases.query 
> > SELECT "venues_venuealias"."id", "venues_venuealias"."last_modified", 
> > "venues_venuealias"."created", "venues_venuealias"."name", 
> > "venues_venuealias"."alias_start_date", 
> > "venues_venuealias"."alias_end_date", "venues_venuealias"."venue_id", 
> > "venues_venuealias"."lastChangedBy_id", "venues_venuealias"."owner_id" 
> > FROM "venues_venuealias" INNER JOIN "contests_venue" ON ( 
> > "venues_venuealias"."venue_id" = "contests_venue"."id" ) WHERE 
> > "contests_venue"."exact" = True ORDER BY "venues_venuealias"."name" ASC 
> > 
> > Where's the SQL to limit by the foreign key to venue.id=5854?  Why is 
> > there a reference in here to contests_venue.exact? 
>
> That is very strange. I've never seen that, and I'm not aware of any 
> changes to Django that would cause that. Nor do I see anything in the 
> models code you pasted below that looks suspicious to me as a possible 
> cause. 
>
> I have to guess that there's some other code in your project causing 
> this problem, but I'm afraid I don't know what that might be. 
>
> I'm afraid the best I can advise is to go back to Django 1.4 and do the 
> upgrade again methodically, and see if you can track down at precisely 
> which version this problem first manifests. 
>
> Good luck! 
>
> Carl 
>
>
> > Approaching the same problem from the other direction works fine, and I 
> > get the correct number of aliases returned. 
> > 
>  from bbr.venues.models import VenueAlias 
>  lVenueAliases = VenueAlias.objects.filter(venue_id=5854) 
>  len(lVenueAliases) 
> > 3 
>  print lVenueAliases.query 
> > SELECT "venues_venuealias"."id", "venues_venuealias"."last_modified", 
> > "venues_venuealias"."created", "venues_venuealias"."name", 
> > "venues_venuealias"."alias_start_date", 
> > "venues_venuealias"."alias_end_date", "venues_venuealias"."venue_id", 
> > "venues_venuealias"."lastChangedBy_id", "venues_venuealias"."owner_id" 
> > FROM "venues_venuealias" WHERE "venues_venuealias"."venue_id" = 5854 
> > ORDER BY "venues_venuealias"."name" ASC 
> > 
> > On my old server, running the old django 1.4 code, both these approaches 
> > work as expected.  Venue and VenueAlias are actually in different 
> > models.py files, for historical reasons. 
> > 
> > What have I missed?  Thanks for any input/education! 
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/292a591e-326f-47fe-b25e-5c84b127858d%40googlegroups.com.
For more options, visit https://groups.google.com/d/op

Re: Upgrade Confusion with ForeignKey

2015-06-05 Thread Carl Meyer
Hi Tim,

On 06/05/2015 04:26 PM, Tim Sawyer wrote:
> Thanks. :-)
> 
> Did that, read the release notes, made sure it worked after each upgrade
> stage.  This is an esoteric corner of my app, and I didn't notice it not
> working.  The other foreign key stuff I have seems to work ok.

Ah, good! In that case, sorry for the unnecessary admonitions. :-)

> Looks like I have more investigation to do...any more clues over what
> *could* be the cause appreciated!

Well, I can give you a rundown of some things that crossed my mind as I
was thinking through what might cause that symptom. Some of them don't
make much sense, and none of them satisfy me as an explanation given the
data I have, but maybe they'll remind you of something in your codebase:

* Was your shell session pasted exactly as you ran it? No possibility
that queryset came from somewhere other than the reverse related manager?

* Any custom model managers in use on either of the relevant models?
(Didn't look like it from the code you pasted).

* Both the apps are in INSTALLED_APPS?

* No `to_field` on any relevant ForeignKeys?

Beyond that, if I were debugging this I would use PDB to step through
the entire process of accessing the reverse-relation attribute,
generating the related-manager, getting a queryset from it, etc, and
compare that to the same process for a reverse-related-set that's
working properly.

Good luck!

Carl

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/557223E8.3060401%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: how to get get-pip.py

2015-06-05 Thread Russell Keith-Magee
On Fri, Jun 5, 2015 at 4:51 PM, Steve Burrus 
wrote:

> Okay Monte I will certsainly "man up" and start over and try to do what
> you said.
>

Hi Steve,

A quick aside: I'm sure you didn't intend any offence, but using language
like "man up" isn't something we support in the Django community. We aspire
to being an open and inclusive community; if you're participating in Django
community spaces, you're expected to adhere to the Django Community Code of
Conduct:

https://www.djangoproject.com/conduct/

There's nothing inherently masculine about software development.
Expressions of overt masculinity and "bro" culture don't improve the
clarity of your message, and are direct contradiction of our community
goals of inclusivity and diversity.

Please don't use turns of phrase like this in future.

Yours,
Russ Magee %-)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJxq84-Z84VEDnMiivHU5_uub70XmfAjbUKUnn_14pRqf2Td2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to get get-pip.py

2015-06-05 Thread dvdhbs
Steve,

Try this at a command prompt:

py -3.4 -m pip install --upgrade pip

You can't upgrade pip using pip directly on Windows.

Best,
Dave

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/81822987-48c2-439d-bf68-cfe7cbd5a516%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to get get-pip.py

2015-06-05 Thread Steve Burrus
*to everyone concerned : It's all goo d now! I  not only got pip installed
I also managed to upgrade it and got django going, and connected to the
Server, synched my new database. So  that is just about all the help which
I require for now.*


*On Fri, Jun 5, 2015 at 9:10 PM, dvdhbs > wrote:*
>
>
>
>
>
>
>
>
>
>
>
> *Steve,Try this at a command prompt:py -3.4 -m pip install --upgrade
> pipYou can't upgrade pip using pip directly on Windows.Best,Dave*
>
>
>
>
>
>
>
> * -- You received this message because you are subscribed to a topic in
> the Google Groups "Django users" group. To unsubscribe from this topic,
> visit
> https://groups.google.com/d/topic/django-users/tKJTNAq4sS4/unsubscribe
> .
> To unsubscribe from this group and all its topics, 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
> . To view this discussion on
> the web visit
> https://groups.google.com/d/msgid/django-users/81822987-48c2-439d-bf68-cfe7cbd5a516%40googlegroups.com
> .*
>
>
> * For more options, visit https://groups.google.com/d/optout
> . *
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABcoaSC5TzZsmbOXLQ6b%2ByXGsqhW9J%3D%2B%3D%2BOAfwmTE3zMgp-unw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrade Confusion with ForeignKey

2015-06-05 Thread Stephen J. Butler
I don't know if this is the problem, but...

On Fri, Jun 5, 2015 at 4:44 PM, Tim Sawyer  wrote:
> class Venue(models.Model):
> """
> A venue for a contest
> """
> last_modified =
> models.DateTimeField(default=datetime.now,editable=False)
> created = models.DateTimeField(default=datetime.now,editable=False)
> name = models.CharField(max_length=255)
> slug = models.SlugField()
> country = models.ForeignKey(Region, blank=True, null=True)
> latitude = models.CharField(max_length=15, blank=True, null=True)
> longitude = models.CharField(max_length=15, blank=True, null=True)
> point = geomodels.PointField(dim=3, geography=True, blank=True,
> null=True, editable=False)
> postcode = models.CharField(max_length=10, blank=True, null=True)
> exact = models.BooleanField(default=False, help_text="True if latitude
> and longitude is for a building, rather than a town")
> mapper = models.ForeignKey(User, editable=False,
> related_name='VenueMapper', blank=True, null=True)
> parent = models.ForeignKey("Venue", blank=True, null=True)

... ever since 1.4 the only documented way for a Model to have a
ForeignKey to another instance of the same type is to use the special
value "self". You've put "Venue" in for the "parent" field.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAD4ANxVPhtYssi33rLyG_8B%3D_AG1hfn8%2B_d4ni5R_DjYbVWnHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.