Re: inlineformset_factory with multiple foreignKeys

2015-10-14 Thread jupiter
No longer need it, please ignore it.

On Wed, Oct 14, 2015 at 9:35 AM, jupiter  wrote:

> Hi,
>
> How can the inlineformset_factory be used for multiple following
> foreignKeys at following an example?
>
> class Recipe(models.Model):
> pub_date = models.DateTimeField('Date Published', auto_now_add = True)
> title = models.CharField(max_length=200)
> instructions = models.TextField()
>
> class Ingredients(models.Model):
> pub_date = models.DateTimeField('Date Published', auto_now_add = True)
> title = models.CharField(max_length=200)
> instructions = models.TextField()
>
> class RecipeIngredient(models.Model):
> recipe = models.ForeignKey(Recipe)
> ingredient = models.ForeignKey(Ingredients)
>
>
> ingredientFormSet = inlineformset_factory(Recipe, Ingredients,
> RecipeIngredient) doesn't seem work.
>
> Thank you.
>
> - jup
>

-- 
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/CAA%3DhcWT0Aety6S%2BEnRgkCWteumjDvKBH59Rx9-%3DbXCNf2idVjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Logout implementation Django

2015-10-14 Thread palansh agarwal
Hi,

I am trying to implement logout for users in my app. My problem is : When a 
user logs out and clicks back button in browser he is able to access the 
website again without logging in.

My current code for logout function is-->

def logout_user(request):
> del request.session['userid']
> logout(request)
> return render_to_response('index.html')
>

Any help will be appreciated.

Regards,

-- 
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/183577c1-57b8-47be-9308-19205cb11bd9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Reverse access model through a “double” ForeignKey

2015-10-14 Thread Gergely Polonkai
Hello,

I have three models:

• Build
• BuildGrouping, with a ForeignKey “build” pointing to Build
• Value, with a ForeignKey “grouping” that points to BuildGrouping

Right now, I also have Value.build, which is a ForeignKey to Build, so I
can access the list of Values directly from a Build.

This setup, though, doesn’t feel right, as it contains redundancy. Is there
a way to access the list of Values directly from Build without having this
redundancy?

Thank you in advance!

Best,
Gergely

-- 
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/CACczBU%2BCCSPDbH6Q%2Bn-n9r0kQjYHKrAMQgVWd6mFPjLfZhoULg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Alphabetical list with links

2015-10-14 Thread Pippo Pluto
 

I have a list of people (something like, in my model:


surname = models.CharField(max_length=255)
firstname = models.CharField(max_length=255)

I'd like to output a table for each starting letter of a surname. So, for 
example (in the template):


{% for author in content %}
{% if author.surname|first == "A" %}
{{ author.surname }}
{% endif %}{% endfor %}

The above code works. Nevertheless, is it possible to somewhat automate the 
above code instead of building as many 'ifs' (and templates) as the letters 
of the alphabet? I'd like something like A B C D E etc... with links on 
each letter, and when clicking on one letter it outputs a table for the 
surnames starting with A B C D E etc...


Thanks in advance for any help.

-- 
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/01024e73-b36c-4961-8093-20052a4cd62a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


If appears doesn't work in template, why?

2015-10-14 Thread Fellipe Henrique
Hello,

I have one model, with a Char(1) Field... in my template I use these code:




But, always enter in "else"... even the record was saved with "A"... I
tried with 'A' and "A", same "problem"...

Any ideas, what's going on?

Cheers!

T.·.F.·.A.·. S+F
*Fellipe Henrique P. Soares*

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
*Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
*
*Blog: *http:www.fellipeh.eti.br
*GitHub: https://github.com/fellipeh *
*Twitter: @fh_bash*

-- 
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/CAF1jwZG_w2tc%2BwBEa1EzH09rnqac3vFhKamUHs45jMwAHvQ3JA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Solr query through Scorched/Sunburnt

2015-10-14 Thread Pippo Pluto
 

I have a weird problem. I'm querying a Solr 5.3 instance with Django 
through Scorched. It all works great as far as I don't ask an exact-match 
query. In other words,


q=something something else

returns exactly the same result as:


q="something something else"

The culprit, as far as I can see, is the actual query which Django throws 
at Solr. In fact, for the second case this is:


q=\"something\+something\+else\"

So, in other words, the " character is escaped. Am I right? How do I tell 
Solr that when I query something between double quotes I want an exact 
match?


In the Solr admin webpage it all works well, i.e. if I search for 
"something something else" I get the correct result.


I'm not sure this is a Scorched/Sunburnt problem or not. Does it have 
something to do with filters/tokenizers (e.g. 
solr.MappingCharFilterFactory)?


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/77272146-99cb-4a23-8fe4-294eefc9ea2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Creating the testing db fails (django 1.8.5)

2015-10-14 Thread Uwe Schuerkamp
Hi folks,

this is my first posting in this group, so I'm sorry in advance if I'm 
breaking any rules or missing some vital information.

My setup: 

Ubuntu Server 14.04.x
Python 2.7.6
Django 1.8.4 (updated to 1.8.5 recently) installed via "pip"
MariaDB 5.5.44

I'm trying to set up a test framework for a little internal project which 
I've been working on since the Django 1.3 days. I've recently migrated the 
project to Django 1.8.4/5 via Django 1.7, and everything appears to be 
working fine. 

Trying to set up a testing framework for the first time to get out of my 
bad "non-testing" habit and increase the test coverage above "0%" for the 
first time ever, I've run into a problem when the manage.py script tries to 
create the test database (permissions on the MySQL side are ok, i've tested 
createdb, dropping, creating and changing tables in the test db manually): 

http://pastebin.com/XDRiqaqL

I've been googling for quite some time and have tried creating the 
migrations via "--fake-initial", but nothing has helped to work around the 
problem. 

I've read it could be some foreign key problem (MariaDB 5.5.x backend), but 
I'm at a loss on how to analyze things further except for randomly 
reordering my models which seems a bit silly. 8( 

Thanks in advance for any pointers, 

Uwe

-- 
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/6d0a3eee-fa06-4ba4-b8ac-5447c073e830%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrade path for Django 1.4.9 to Django 1.6.0

2015-10-14 Thread Uwe Schuerkamp
Hi Mark,

I recently had the same issue, I went from 1.3.x to 1.4.21 and then to 
1.8.5 via 1.7.x without any major issues. 

Granted my application isn't too complex and doesn't use too many of 
Django's internal bells and whistles, but the major obstacles for me were 
adding some new entries to settings.py, creating a new manage.py script and 
properly escaping / quoting arguements to [% url %}, so nothing that could 
not be fixed by a bit of googling (the problems I'm having with the testing 
setup is another matter, though and may be entirely due to me not really 
knowing what I'm doing ;) 

Cheers, Uwe

-- 
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/ac1db1a8-65b3-4bdc-8018-3c12c9c2de23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Logout implementation Django

2015-10-14 Thread Andreas Kuhne
Hi,

You should be able to access the website without logging in? Or do you mean
that the user has access to protected pages?

If you have added the login_required decorator (
https://docs.djangoproject.com/en/1.8/topics/auth/default/#the-login-required-decorator)
on your view functions that shouldn't be possible. However the cached
version of the page should still be accessible (by clicking back). That is
per design (the client side caches the page). You can prevent this by using
cache decorators:
http://stackoverflow.com/questions/6923027/disable-browser-back-button-after-logout

Regards,

Andréas

2015-10-14 11:07 GMT+02:00 palansh agarwal :

> Hi,
>
> I am trying to implement logout for users in my app. My problem is : When
> a user logs out and clicks back button in browser he is able to access the
> website again without logging in.
>
> My current code for logout function is-->
>
> def logout_user(request):
>> del request.session['userid']
>> logout(request)
>> return render_to_response('index.html')
>>
>
> Any help will be appreciated.
>
> Regards,
>
> --
> 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/183577c1-57b8-47be-9308-19205cb11bd9%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/CALXYUbn5UdQUfU%2BWpt_-_iQLRreHvre_EPkoHnu75oA6y8pjjA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: If appears doesn't work in template, why?

2015-10-14 Thread Carsten Fuchs

Am 14.10.2015 um 13:36 schrieb Fellipe Henrique:

But, always enter in "else"... even the record was saved with "A"... I tried 
with 'A'
and "A", same "problem"...

Any ideas, what's going on?


Have you cross-checked? I.e., what is the output of {{ status }} ?

Best regards,
Carsten

--
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/561E5230.1010203%40cafu.de.
For more options, visit https://groups.google.com/d/optout.


Re: Reverse access model through a “double” ForeignKey

2015-10-14 Thread Vijay Khemlani
Value.objects.filter(grouping__build=your_build) I guess

You can add it as a method to the Build class

On Wed, Oct 14, 2015 at 6:11 AM, Gergely Polonkai 
wrote:

> Hello,
>
> I have three models:
>
> • Build
> • BuildGrouping, with a ForeignKey “build” pointing to Build
> • Value, with a ForeignKey “grouping” that points to BuildGrouping
>
> Right now, I also have Value.build, which is a ForeignKey to Build, so I
> can access the list of Values directly from a Build.
>
> This setup, though, doesn’t feel right, as it contains redundancy. Is
> there a way to access the list of Values directly from Build without having
> this redundancy?
>
> Thank you in advance!
>
> Best,
> Gergely
>
> --
> 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/CACczBU%2BCCSPDbH6Q%2Bn-n9r0kQjYHKrAMQgVWd6mFPjLfZhoULg%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/CALn3ei1YKx1KPbcVJXQOfT034%3Dr5A0Lc9AO7ifq5cBb2eS%3D_yA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reverse access model through a “double” ForeignKey

2015-10-14 Thread Carsten Fuchs

Am 14.10.2015 um 11:11 schrieb Gergely Polonkai:

This setup, though, doesn’t feel right, as it contains redundancy. Is there a 
way to
access the list of Values directly from Build without having this redundancy?


Well, you can filter your Value queryset by Build, see
https://docs.djangoproject.com/en/1.8/topics/db/queries/#lookups-that-span-relationships

Or, starting with a Build instance, you can work towards the Value instances, 
see
https://docs.djangoproject.com/en/1.8/topics/db/queries/#related-objects

Best regards,
Carsten

--
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/561E540F.6030202%40cafu.de.
For more options, visit https://groups.google.com/d/optout.


Re: Logout implementation Django

2015-10-14 Thread palansh agarwal
Thank you. The problem with the cache thing. Now resolved.

*Palansh Agarwal | +919461787317 *
*Co-Founder*, Team Lead IDC,
*GoMobileFirst, USA*
*Systems/Software Dev Intern*, Instaroid  , *Bangkok,
Thailand*
Pre Final Year, B.Tech
The LNM Institute of Information Technology, Jaipur, India
[image: https://www.facebook.com/palansh.agarwal]

    [image:
https://github.com/py-geek]   [image: palansh]


*See**! it's not hard when you FOCUS*

On Wed, Oct 14, 2015 at 6:11 PM, Andreas Kuhne 
wrote:

> Hi,
>
> You should be able to access the website without logging in? Or do you
> mean that the user has access to protected pages?
>
> If you have added the login_required decorator (
> https://docs.djangoproject.com/en/1.8/topics/auth/default/#the-login-required-decorator)
> on your view functions that shouldn't be possible. However the cached
> version of the page should still be accessible (by clicking back). That is
> per design (the client side caches the page). You can prevent this by using
> cache decorators:
> http://stackoverflow.com/questions/6923027/disable-browser-back-button-after-logout
>
> Regards,
>
> Andréas
>
> 2015-10-14 11:07 GMT+02:00 palansh agarwal :
>
>> Hi,
>>
>> I am trying to implement logout for users in my app. My problem is : When
>> a user logs out and clicks back button in browser he is able to access the
>> website again without logging in.
>>
>> My current code for logout function is-->
>>
>> def logout_user(request):
>>> del request.session['userid']
>>> logout(request)
>>> return render_to_response('index.html')
>>>
>>
>> Any help will be appreciated.
>>
>> Regards,
>>
>> --
>> 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/183577c1-57b8-47be-9308-19205cb11bd9%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/CALXYUbn5UdQUfU%2BWpt_-_iQLRreHvre_EPkoHnu75oA6y8pjjA%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/CAPCyp%2B9Z-kta%2Bk5xpc7z_p94uDKD8FYgWAo-rWB7eaibsPs%3DTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reverse access model through a “double” ForeignKey

2015-10-14 Thread Gergely Polonkai
Hello,

I just solved it, and went with a @property. On Build I have:

@property
def values(self):
return Value.objects.filter(grouping__build=self)

and on the Value I have:

@property
def build(self):
return self.grouping.build

This way I stay backwards compatible and didn’t even have to change my
templates and such. Thanks for the tips, though!

Best,
Gergely

2015-10-14 15:09 GMT+02:00 Carsten Fuchs :

> Am 14.10.2015 um 11:11 schrieb Gergely Polonkai:
>
>> This setup, though, doesn’t feel right, as it contains redundancy. Is
>> there a way to
>> access the list of Values directly from Build without having this
>> redundancy?
>>
>
> Well, you can filter your Value queryset by Build, see
>
> https://docs.djangoproject.com/en/1.8/topics/db/queries/#lookups-that-span-relationships
>
> Or, starting with a Build instance, you can work towards the Value
> instances, see
> https://docs.djangoproject.com/en/1.8/topics/db/queries/#related-objects
>
> Best regards,
> Carsten
>
> --
> 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/561E540F.6030202%40cafu.de.
>
> 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/CACczBU%2BogVBRKWPoMU_N_g8sXb4prmb-iMKD26pJAkOgzgePBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


The sitemap framework documentation

2015-10-14 Thread Emre Düzer
Hi,

There is an error while declaring code in the sitemap framework 
documentation.

Incorrect statement:

from django.contrib.sitemaps.view*s* import sitemap

url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps},
name='django.contrib.sitemaps.views.sitemap')


Correct statement:

from django.contrib.sitemaps.view*s* import sitemap

url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps},
'django.contrib.sitemaps.views.sitemap')


Have a nice day.

https://docs.djangoproject.com/en/1.8/ref/contrib/sitemaps/#initialization

-- 
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/40b33e22-deae-4314-96b2-73559fe41823%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Filtering records based on date months

2015-10-14 Thread 'Chris Norman' via Django users

Hi all,
I have written a Journey model, which has an out and a back field, both 
of which are datetime fields.


What I want to do is something like:

from datetime import datetime
now = datetime.now()
for journey in Journey.objects.filter(out__month = now.month, out__day = 
now.day):

 print journey

This returns an empty list though.

Am I doing something wrong?

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/561E5DDD.4010604%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.


Cron Job

2015-10-14 Thread 'Chris Norman' via Django users

Hi again,
I would like to set up a cron job to email the day's journeys to a 
pre-defined set of email addresses, using the model I described in the 
previous example.


I have it so I can type:

python manage.py shell
import journey_sender

This does everything.

Thing is, I would like to use the server's cron demon to do this, so I 
can't work it in the way I just described. I tried using combinations of 
pipe characters, but to no avail.


Is there some way I can programatically simulate the shell yielded by 
manage.py? Or is there a smarter way of running the cron job from within 
Django it's self?


Thanks 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/561E5E70.3060901%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Cron Job

2015-10-14 Thread Vijay Khemlani
The easiest way would be using a custom management command

https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/

On Wed, Oct 14, 2015 at 10:53 AM, 'Chris Norman' via Django users <
django-users@googlegroups.com> wrote:

> Hi again,
> I would like to set up a cron job to email the day's journeys to a
> pre-defined set of email addresses, using the model I described in the
> previous example.
>
> I have it so I can type:
>
> python manage.py shell
> import journey_sender
>
> This does everything.
>
> Thing is, I would like to use the server's cron demon to do this, so I
> can't work it in the way I just described. I tried using combinations of
> pipe characters, but to no avail.
>
> Is there some way I can programatically simulate the shell yielded by
> manage.py? Or is there a smarter way of running the cron job from within
> Django it's self?
>
> Thanks 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/561E5E70.3060901%40googlemail.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/CALn3ei1wGy6WdBeOoM7KULuLQ45wtDXEsVX0NRExfruuTe8W8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.8: subclass AbstractUser, App 'auth' doesn't have a 'myuser' model.

2015-10-14 Thread 술욱
Hello Tim,

yes, I need to use the custom user model. The app is now in production
(Django 1.6.11).

If I use settings.AUTH_USER_MODEL = 'auth.MyUser', I get the error
described in my previous emails.

If I change to settings.AUTH_USER_MODEL = 'myauth.MyUser', I get the
following tables created:

myauth_myuser
myauth_myuser_groups
myauth_myuser_user_permissions

Thanks,
Norberto


2015-10-13 18:26 GMT-03:00 Tim Graham :
> Do you want to use the custom user model or not? What extra tables are
> created?
>
> On Tuesday, October 13, 2015 at 1:31:03 PM UTC-7, Norberto Bensa wrote:
>>
>> Hello,
>>
>> I'm re-posting this.
>>
>> Note that I already tried AUTH_USER_MODEL = "myauth.MyUser', and while
>> that makes the problem disappear, the change also creates new tables
>> in the database.
>>
>> What are my options? AFAIK 1.6 is deprecated for security reasons and
>> I want to upgrade to 1.8.x.
>>
>> Thanks.
>> Norberto
>>
>>
>>
>> -- Forwarded message --
>> From: 술욱 
>> Date: 2015-10-06 22:37 GMT-03:00
>> Subject: Django 1.8: subclass AbstractUser, App 'auth' doesn't have a
>> 'myuser' model.
>> To: 'Tom 
>>
>>
>> Hello,
>>
>> I'm trying to upgrade an app from Django 1.6 to 1.8 but I can't solve
>> a problem apparently related to a custom user model.
>>
>> The project has an 'auth' app with its corresponding models.py and
>> apps.py. The snippet pasted bellow reproduces the problem which I
>> don't know how to fix.
>>
>> Many TIA,
>> Norberto
>>
>>
>> # auth/models.py
>> from django.contrib.auth.models import AbstractUser
>> from django.db import models
>>
>> class MyUser(AbstractUser):
>> pass
>>
>>
>> # auth/apps.py
>> from django.apps import AppConfig
>>
>> class MyAuth(AppConfig):
>> name = 'auth'
>> label = 'myauth'
>>
>>
>> # project/setting.py
>>
>> INSTALLED_APPS = (
>> ...
>> 'auth.apps.MyAuth',
>> ...
>> )
>>
>> AUTH_USER_MODEL = 'auth.MyUser'
>>
>>
>> Note apps.py is there just because 'auth' collides with
>> django.contrib.auth.
>>
>>
>> $ ./manage.py makemigrations
>> Traceback (most recent call last):
>>   File
>> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/apps/config.py",
>> line 159, in get_model
>> return self.models[model_name.lower()]
>> KeyError: 'myuser'
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>>   File "./manage.py", line 10, in 
>> execute_from_command_line(sys.argv)
>>   File
>> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/__init__.py",
>> line 351, in execute_from_command_line
>> utility.execute()
>>   File
>> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/__init__.py",
>> line 343, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File
>> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/base.py",
>> line 394, in run_from_argv
>> self.execute(*args, **cmd_options)
>>   File
>> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/base.py",
>> line 444, in execute
>> self.check()
>>   File
>> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/base.py",
>> line 482, in check
>> include_deployment_checks=include_deployment_checks,
>>   File
>> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/checks/registry.py",
>> line 72, in run_checks
>> new_errors = check(app_configs=app_configs)
>>   File
>> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/contrib/auth/checks.py",
>> line 12, in check_user_model
>> cls = apps.get_model(settings.AUTH_USER_MODEL)
>>   File
>> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/apps/registry.py",
>> line 202, in get_model
>> return self.get_app_config(app_label).get_model(model_name.lower())
>>   File
>> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/apps/config.py",
>> line 162, in get_model
>> "App '%s' doesn't have a '%s' model." % (self.label, model_name))
>> LookupError: App 'auth' doesn't have a 'myuser' model.
>
> --
> 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/7f285c9a-6088-4615-8b68-342322ad89c7%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-

Re: Cron Job

2015-10-14 Thread 'Chris Norman' via Django users

Hi,
Thanks for the advice.

I actually found that just after writing my post. Now the cron job works 
perfectly.


Thanks,


On 10/14/2015 3:26 PM, Vijay Khemlani wrote:

The easiest way would be using a custom management command

https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/

On Wed, Oct 14, 2015 at 10:53 AM, 'Chris Norman' via Django users 
mailto:django-users@googlegroups.com>> 
wrote:


Hi again,
I would like to set up a cron job to email the day's journeys to a
pre-defined set of email addresses, using the model I described in
the previous example.

I have it so I can type:

python manage.py shell
import journey_sender

This does everything.

Thing is, I would like to use the server's cron demon to do this,
so I can't work it in the way I just described. I tried using
combinations of pipe characters, but to no avail.

Is there some way I can programatically simulate the shell yielded
by manage.py? Or is there a smarter way of running the cron job
from within Django it's self?

Thanks 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/561E5E70.3060901%40googlemail.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/CALn3ei1wGy6WdBeOoM7KULuLQ45wtDXEsVX0NRExfruuTe8W8g%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/561E7877.8080706%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.


Django Models Joining and Normalising

2015-10-14 Thread Yunti
I'm still relatively new to Django and now working on a project that has 
much more complex models than I've used before.  

The question is about when is it best to separate out large models into 
separate models (and the impact caused by joining the smaller models 
together and also keeping data normalised).  

I'm trying to model magazine subscriptions, which are available from 
different suppliers - the costs vary slightly per region (due to delivery 
costs) and the available subscriptions vary slightly dependent on payment 
type (direct debit, card, cheque etc...). 

The subscriptions have a lot of different fields for each subscriptions so 
I'm not clear on how best to represent this in django - one large model or 
split into smaller models.

Firstly,  each supplier will have multiple magazines - to keep the data 
normalised should the suppliers be kept in a separate table/model separate 
to the subscriptions table? How will this impact performance when having to 
join the data back together when querying a list of subscriptions. 
(e.g. similarly for payment types of which there are only 4 should these be 
pulled out into a separate table? and regions)

There will be a form field for: 
supplier
payment type,
region,
should a separate model be made for these 3 fields to ease with making the 
form and how should that tie into the above tables (if they should be 
separated? Should I make e.g. an Input model class with ForeignKeys to each 
of the separate tables?). 

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/e233ed53-d0cc-4540-a93b-45471887be4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django.contrib.auth 1.8 failed if user.pk not int

2015-10-14 Thread Petr Bondarenko
Yes.
CharField(primary_key=True)
When referring to RemoteApiUser._mata.pk returned this field.

вторник, 13 октября 2015 г., 6:47:50 UTC+5 пользователь Tim Graham написал:
>
> In the traceback it appears that to_python() is being called for 
> AutoField, not CharField. Are you sure the custom user model with the 
> CharField pk is properly configured?
>
> On Monday, October 12, 2015 at 7:03:25 AM UTC-7, Petr Bondarenko wrote:
>>
>> Apparently my problem is caused by the transition to a new Model._meta 
>> API.
>> It was:
>> request.session[SESSION_KEY] = user.pk
>> It became:
>> request.session[SESSION_KEY] = user._meta.pk.value_to_string(user)
>>
>> As user.pk we use access_token - CharField(max_length=64, 
>> primary_key=True)
>> An error occurs in a certain magic method to_python() in 
>> django.db.models.fields
>> Traceback is seen.
>>
>> суббота, 10 октября 2015 г., 6:25:50 UTC+5 пользователь Tim Graham 
>> написал:
>>>
>>> Here's the commit and ticket:
>>>
>>> https://github.com/django/django/commit/0f7f5bc9
>>> https://code.djangoproject.com/ticket/24161
>>>
>>> I think you'll probably have to fix this in your app, but if a change in 
>>> Django will help, let me know. Possibly your user model needs a CharField 
>>> for its primary key.
>>>
>>> On Friday, October 9, 2015 at 5:06:59 PM UTC-4, Petr Bondarenko wrote:

 Hi,

 when migrating code from version 1.7 to 1.8 I have a problem.
 We do not use standard authentication through ModelBackend.
 Authentication takes place on a different server protocol OAuth2.
 For the User, using fake-model RemoteApiUser. In which the primary key 
 is *access_token*.
 Acces_token is written to the standard key 
 *django.contrib.auth.SESSION_KEY*.
 It is used in RemoteAuthenticationBackend as *user_id* in *get_user()*
  function.
 This function generates a request to api-server  in which the token is 
 returned by the User.
 It is formed from the data object RemoteApiUser and return it.

 In version 1.7. everything worked fine, but when migrating to 1.8 there 
 is an error:

 Traceback (most recent call last):
 File "/usr/lib/python3.4/wsgiref/handlers.py", line 137, in run
 self.result = application(self.environ, self.start_response)
 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/contrib/staticfiles/handlers.py",
  
 line 63, in __call__
 return self.application(environ, start_response)   

 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/core/handlers/wsgi.py",
  
 line 189, in __call__
 response = self.get_response(request)
 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/core/handlers/base.py",
  
 line 218, in get_response
 response = self.handle_uncaught_exception(request, resolver, 
 sys.exc_info())
 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/core/handlers/base.py",
  
 line 261, in handle_uncaught_exception
 return debug.technical_500_response(request, *exc_info)
 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/views/debug.py",
  
 line 97, in technical_500_response
 html = reporter.get_traceback_html()
 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/views/debug.py",
  
 line 383, in get_traceback_html
 c = Context(self.get_traceback_data(), use_l10n=False)
 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/views/debug.py",
  
 line 328, in get_traceback_data
 frames = self.get_traceback_frames()  
 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/views/debug.py",
  
 line 501, in get_traceback_frames
 'vars': self.filter.get_traceback_frame_variables(self.request, 
 tb.tb_frame),
 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/views/debug.py",
  
 line 234, in get_traceback_frame_variables
 cleansed[name] = self.cleanse_special_types(request, value)   
 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/views/debug.py",
  
 line 189, in cleanse_special_types
 if isinstance(value, HttpRequest):
 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/utils/functional.py",
  
 line 225, in inner
 self._setup()
 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/utils/functional.py",
  
 line 365, in _setup
 self._wrapped = self._setupfunc()
 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/contrib/auth/middleware.py",
  
 line 22, in 
 request.user = SimpleLazyObject(lambda: get_user(request))
 File 
 "/root/django/envs/wallet/lib/python3.4/site-packages/django/contrib/au

RE: Django 1.8: subclass AbstractUser, App 'auth' doesn't have a 'myuser' model.

2015-10-14 Thread syl pingus
Hello Norberto,

In your first example, I think the name of your apps in the apps.py config file 
conflicts with the core Django auth module and it could explains the second 
exception you get.

When you use a custom model in Django, the "migrate" command always create 
additional table for group and user_permissions but they are never filled in 
throught the admin site. According to me, Django creates these tables but they 
are useless. Why ? I don't really know... Maybe it's depending on the table 
creation process.

If you want to use group and permissions with your custom model, it will be 
stored in auth_group, auth_group_permissions and auth_permissions tables.

Sorry, my answer doesn't really help you but that's is my understanding of 
custom user model process at this time.

Sylvain.
--
> From: nbe...@gmail.com
> Date: Wed, 14 Oct 2015 12:43:03 -0300
> Subject: Re: Django 1.8: subclass AbstractUser, App 'auth' doesn't have a 
> 'myuser' model.
> To: django-users@googlegroups.com
> 
> Hello Tim,
> 
> yes, I need to use the custom user model. The app is now in production
> (Django 1.6.11).
> 
> If I use settings.AUTH_USER_MODEL = 'auth.MyUser', I get the error
> described in my previous emails.
> 
> If I change to settings.AUTH_USER_MODEL = 'myauth.MyUser', I get the
> following tables created:
> 
> myauth_myuser
> myauth_myuser_groups
> myauth_myuser_user_permissions
> 
> Thanks,
> Norberto
> 
> 
> 2015-10-13 18:26 GMT-03:00 Tim Graham :
> > Do you want to use the custom user model or not? What extra tables are
> > created?
> >
> > On Tuesday, October 13, 2015 at 1:31:03 PM UTC-7, Norberto Bensa wrote:
> >>
> >> Hello,
> >>
> >> I'm re-posting this.
> >>
> >> Note that I already tried AUTH_USER_MODEL = "myauth.MyUser', and while
> >> that makes the problem disappear, the change also creates new tables
> >> in the database.
> >>
> >> What are my options? AFAIK 1.6 is deprecated for security reasons and
> >> I want to upgrade to 1.8.x.
> >>
> >> Thanks.
> >> Norberto
> >>
> >>
> >>
> >> -- Forwarded message --
> >> From: 술욱 
> >> Date: 2015-10-06 22:37 GMT-03:00
> >> Subject: Django 1.8: subclass AbstractUser, App 'auth' doesn't have a
> >> 'myuser' model.
> >> To: 'Tom 
> >>
> >>
> >> Hello,
> >>
> >> I'm trying to upgrade an app from Django 1.6 to 1.8 but I can't solve
> >> a problem apparently related to a custom user model.
> >>
> >> The project has an 'auth' app with its corresponding models.py and
> >> apps.py. The snippet pasted bellow reproduces the problem which I
> >> don't know how to fix.
> >>
> >> Many TIA,
> >> Norberto
> >>
> >>
> >> # auth/models.py
> >> from django.contrib.auth.models import AbstractUser
> >> from django.db import models
> >>
> >> class MyUser(AbstractUser):
> >> pass
> >>
> >>
> >> # auth/apps.py
> >> from django.apps import AppConfig
> >>
> >> class MyAuth(AppConfig):
> >> name = 'auth'
> >> label = 'myauth'
> >>
> >>
> >> # project/setting.py
> >>
> >> INSTALLED_APPS = (
> >> ...
> >> 'auth.apps.MyAuth',
> >> ...
> >> )
> >>
> >> AUTH_USER_MODEL = 'auth.MyUser'
> >>
> >>
> >> Note apps.py is there just because 'auth' collides with
> >> django.contrib.auth.
> >>
> >>
> >> $ ./manage.py makemigrations
> >> Traceback (most recent call last):
> >>   File
> >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/apps/config.py",
> >> line 159, in get_model
> >> return self.models[model_name.lower()]
> >> KeyError: 'myuser'
> >>
> >> During handling of the above exception, another exception occurred:
> >>
> >> Traceback (most recent call last):
> >>   File "./manage.py", line 10, in 
> >> execute_from_command_line(sys.argv)
> >>   File
> >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/__init__.py",
> >> line 351, in execute_from_command_line
> >> utility.execute()
> >>   File
> >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/__init__.py",
> >> line 343, in execute
> >> self.fetch_command(subcommand).run_from_argv(self.argv)
> >>   File
> >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/base.py",
> >> line 394, in run_from_argv
> >> self.execute(*args, **cmd_options)
> >>   File
> >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/base.py",
> >> line 444, in execute
> >> self.check()
> >>   File
> >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/base.py",
> >> line 482, in check
> >> include_deployment_checks=include_deployment_checks,
> >>   File
> >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/checks/registry.py",
> >> line 72, in run_checks
> >> new_errors = check(app_configs=app_configs)
> >>   File
> >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/contrib/auth/checks.py",
> >> line 12, in check_user_model
> >> cls = apps.get

Problem to upload image

2015-10-14 Thread Rosangela Oliveira
Hi,I need some help

I have a problem when I try to upload the image in a  django project, it's 
open the windows to upload the image twice.

in HTML I did:


   http://shackmanlab.org/wp-content/uploads/2013/07/person-placeholder.jpg"; 
width='125px' height='125px' style="float:left; margin-top:40px; 
margin-bottom:10px; margin-right:30px">
   
teste




in controller

}
$("input[type='image']").click(function () {
$("input[id='my_file']").click();
});
}


Thanks for helping

-- 
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/21b9a7a0-4a6f-4391-93b2-01fc727bc806%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.8: subclass AbstractUser, App 'auth' doesn't have a 'myuser' model.

2015-10-14 Thread 술욱
2015-10-14 15:21 GMT-03:00 syl pingus :
> Hello Norberto,
>
> In your first example, I think the name of your apps in the apps.py config
> file conflicts with the core Django auth module and it could explains the
> second exception you get.

Yes. I know, that's why I added label="myauth". The problem is Django
1.6 allowed to call it 'auth'. Yes, it was our fault, we should have
called it accounts or something else.


> When you use a custom model in Django, the "migrate" command always create
> additional table for group and user_permissions but they are never filled in
> throught the admin site. According to me, Django creates these tables but
> they are useless. Why ? I don't really know... Maybe it's depending on the
> table creation process.

I'm sorry, I think I'm not following you. Are you saying myauth_myuser
are not used?

If I migrate this app to 1.8.5, and I add label="myauth" to avoid
collision with django.contrib.auth, I lose the users. They're in the
auth_myuser table, myauth_myuser is empty. If I create a user, the
user is created in myauth_myuser table.


> Sorry, my answer doesn't really help you but that's is my understanding of
> custom user model process at this time.

Don't worry. I'll make a dB dump, change the tables by hand and import
everything with label='myauth'. I was hoping there was a "Django way"
to fix this problem.

Thanks,
Norberto

-- 
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/CADut3oCrCefSmnrzXg-Z20SjEvou2ob8Xr_47TGOMa7B_BrXbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating the testing db fails (django 1.8.5)

2015-10-14 Thread Mike Dewhirst

On 14/10/2015 11:34 PM, Uwe Schuerkamp wrote:

Hi folks,

this is my first posting in this group, so I'm sorry in advance if I'm
breaking any rules or missing some vital information.

My setup:Â

Ubuntu Server 14.04.x
Python 2.7.6
Django 1.8.4 (updated to 1.8.5 recently) installed via "pip"
MariaDB 5.5.44

I'm trying to set up a test framework for a little internal project
which I've been working on since the Django 1.3 days. I've recently
migrated the project to Django 1.8.4/5 via Django 1.7, and everything
appears to be working fine.Â

Trying to set up a testing framework for the first time to get out of my
bad "non-testing" habit and increase the test coverage above "0%" for
the first time ever, I've run into a problem when the manage.py script
tries to create the test database (permissions on the MySQL side are ok,
i've tested createdb, dropping, creating and changing tables in the test
db manually):Â

http://pastebin.com/XDRiqaqL


A quick glance at pastebin indicates the error is a failure to delete 
the test database.


Can you manually delete it prior to running the tests? That would skip 
the entire section (apparently) which raises the error.


Mike



I've been googling for quite some time and have tried creating the
migrations via "--fake-initial", but nothing has helped to work around
the problem.Â

I've read it could be some foreign key problem (MariaDB 5.5.x backend),
but I'm at a loss on how to analyze things further except for randomly
reordering my models which seems a bit silly. 8(Â

Thanks in advance for any pointers,Â

Uwe

--
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/6d0a3eee-fa06-4ba4-b8ac-5447c073e830%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/561F4E92.9030705%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.