Re: A tricky query in one to many relationship - atleast for me:)

2016-08-30 Thread Web Architect
Hi Erik,

I tried your solution but there are some issues:

.filter(date_created=Max('a__b__date_created'))  - this is throwing error 
saying not proper use of group function.

If I remove the above, the result isn't correct where when I go through 
each 'a' in the result, associated latest B.text isn't always 'ABCD' - if 
there are multiple instances of B associated with an instance of A and one 
of the instances of B has text='ABCD' (might not be the latest 
date_created), that instance of B is also there in the query result.

Thanks.

On Tuesday, August 30, 2016 at 3:59:20 PM UTC+5:30, Erik Cederstrand wrote:
>
>
> > Den 30. aug. 2016 kl. 11.20 skrev Erik Cederstrand <
> erik+...@cederstrand.dk >: 
> > 
> > I'm not even sure that's possible to express in SQL, but it would 
> probably be quite convoluted if it is. Here's an easier-to-understand 
> solution: 
> > 
> > res = set() 
> > for b in 
> B.objects.all().select_related('a').annotate(Max('date_created')): 
> >if b.date_created != b.date_created__max: 
> >continue 
> >if b.text != 'ABCD': 
> >continue 
> >res.add(a) 
>
> I did some more experimenting. I think this actually does what you want: 
>
> res = [ 
> b.a for b in B.objects 
> .filter(date_created=Max('a__b__date_created')) 
> .annotate(Max('a__b__date_created')) 
> .filter(text='ABCD') 
> .select_related('a') 
> ] 
>
> which you can rewrite as: 
>
> A.objects.filter( 
> b__in=B.objects 
> .filter(date_created=Max('a__b__date_created')) 
> .annotate(Max('a__b__date_created')) 
> .filter(text='ABCD') 
> ) 
>
> Erik

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/13a40885-4cce-46af-ba50-368942608c37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1.7.9 deployment stubbornly won't create a test database

2016-08-30 Thread Adam Hirsch
And the answer turned out to be... we were/are using a multidb setup, which 
silently prevents the test suite from creating a test db. Setting 
DATABASE_ROUTERS 
= [] re-enabled the test db creation. Sigh. It's always the little things.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c5c8d9ed-77b5-4aa6-9487-42c5b971b977%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django template iterating through two dictionaries/variables

2016-08-30 Thread Aaron Weisberg
This is why i ask this group.

Everyone helped out, but  Nate's link pushed me in the right direction.

Sometimes I don't even know what to ask stack overflow, but the google 
group always helps out.

Thanks

On Tuesday, August 30, 2016 at 11:28:37 AM UTC-5, Nate Granatir wrote:
>
> You could also just join the dicts before passing them to the template. It 
> looks like it's relatively straightforward (scores is just a list that 
> contains dicts of a 'Number' and a 'score', right?) Then you could turn 
> scores into a dict, assuming Numbers are unique:
>
> scores_new = {score['Number']:score['score'] for score in scores}
>
> And then update the persons dict to include the score:
> for person in persons:
> person.update({'score': scores_new.get(person['Number'])})
>
> Then in your persons list in the template you'll just need to display 
> person.score.
>
> If you want to get really fancy (if, say, there's more than just a score 
> you need to pull from the dicts in scores) you can see how to merge two 
> lists of dicts on a common key here:
>
> http://stackoverflow.com/questions/5501810/join-two-lists-of-dictionaries-on-a-single-key
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/49018a13-680a-4b6d-8d1e-be5c5444c2d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django documentation release 1.10.1a1

2016-08-30 Thread Rich Shepard

On Tue, 30 Aug 2016, Tim Graham wrote:


I don't think there have been any recent changes to the styling, but if
you'd like to contribute, the place to look is probably
https://github.com/django/django/tree/master/docs/_theme.


Tim,

  I don't know what to do once I'm on that page but when time permits I'll
look around and see if I can find the source. Wonder if it's written in
LaTeX; if so, the typefaces can easily be change.

Thanks,

Rich


Re: Django documentation release 1.10.1a1

2016-08-30 Thread Tim Graham
I don't think there have been any recent changes to the styling, but if 
you'd like to contribute, the place to look is probably 
https://github.com/django/django/tree/master/docs/_theme.

On Tuesday, August 30, 2016 at 6:15:45 PM UTC-4, Rich Shepard wrote:
>
>   I don't know how this PDF displays in other viewers, but in xpdf, mupdf, 
> and acroread important strings in the text are very difficult to read 
> because they have very low contrast with the white background. 
>
>For example, comments are in a light grey and important strings are in 
> a 
> very pale yellow. Page 14 has many examples of this. 
>
>Perhaps for very young eyeballs it's not an issue, but for those of us 
> with many miles on our eyes it's extremely hard to read this light text on 
> the white background. 
>
>It would be very helpful if this situation was quickly remedied and a 
> revised version released. 
>
> Thanks in advance, 
>
> Rich 
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0708dd3c-bcb2-4fa8-addf-e6d7241446bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1.7.9 deployment stubbornly won't create a test database

2016-08-30 Thread M Hashmi
My bad...missed the version in original question.

You are right.

On Tue, Aug 30, 2016 at 4:59 PM, Andromeda Yelton <
andromeda.yel...@gmail.com> wrote:

> What are do the relevant parts of your settings file say? In particular,
> https://docs.djangoproject.com/en/1.7/topics/testing/overview/#the-
> test-database says "If you want to use a different database name, specify
> NAME in the TEST dictionary for any given database in DATABASES." - I would
> check there to see if someone has overridden the default. There's also a
> little section in the docs labeled "Finding data from your production
> database when running tests?" that might be relevant to you.
>
> (--keepdb is a great flag but sadly irrelevant as it was not introduced
> until 1.8.)
>
> On Mon, Aug 29, 2016 at 6:26 PM, Adam Hirsch 
> wrote:
>
>> I've been handed a fairly large and built-up django 1.7.9 installation
>> with several dozen pre-existing in-house modules and a lot of history.
>>
>> For some reason, any attempt to * manage.py test * any of the existing
>> modules runs tests against the live database specified in 
>> *DATABASES['default']
>> *rather than attempting to create a new test database.  I've written a
>> couple of simple unit tests for a given module, generated a small fixture
>> of data to apply to a blank schema for testing ... but I can't for the life
>> of me find why this installation isn't creating a test_db. No errors, no
>> failures ... just tests run against the production db.
>>
>> Anyone have a pointer to what might be going on, or concepts to look up?
>> A simple Hello World install using the same django version on the same
>> machine works exactly as the docs suggest it should: I see
>>
>> Creating test database for alias 'default' (':memory:')...
>> [...]
>> Destroying test database for alias 'default' (':memory:')...
>>
>>
>> ... but there are no such lines in my real installation.  I'm baffled.
>>
>> Adam
>>
>>
>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/ea373ba9-9c9e-4358-9c71-b3c0d1c4b3d9%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Andromeda Yelton
> Vice President/President-Elect, Library & Information Technology
> Association: http://www.lita.org
> http://andromedayelton.com
> @ThatAndromeda 
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAFE1XCbL_cm1pYGMpo-gv%3D3z0WkmeYaQZTsvLzHMR56gHpM7_
> A%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANoUts70zdo5tn7U%2B-tnOWf1SDT_G8q9tDDSdGPb0S9UghTahg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1.7.9 deployment stubbornly won't create a test database

2016-08-30 Thread Andromeda Yelton
What are do the relevant parts of your settings file say? In particular,
https://docs.djangoproject.com/en/1.7/topics/testing/overview/#the-test-database
says "If you want to use a different database name, specify NAME in the
TEST dictionary for any given database in DATABASES." - I would check there
to see if someone has overridden the default. There's also a little section
in the docs labeled "Finding data from your production database when
running tests?" that might be relevant to you.

(--keepdb is a great flag but sadly irrelevant as it was not introduced
until 1.8.)

On Mon, Aug 29, 2016 at 6:26 PM, Adam Hirsch 
wrote:

> I've been handed a fairly large and built-up django 1.7.9 installation
> with several dozen pre-existing in-house modules and a lot of history.
>
> For some reason, any attempt to * manage.py test * any of the existing
> modules runs tests against the live database specified in 
> *DATABASES['default']
> *rather than attempting to create a new test database.  I've written a
> couple of simple unit tests for a given module, generated a small fixture
> of data to apply to a blank schema for testing ... but I can't for the life
> of me find why this installation isn't creating a test_db. No errors, no
> failures ... just tests run against the production db.
>
> Anyone have a pointer to what might be going on, or concepts to look up? A
> simple Hello World install using the same django version on the same
> machine works exactly as the docs suggest it should: I see
>
> Creating test database for alias 'default' (':memory:')...
> [...]
> Destroying test database for alias 'default' (':memory:')...
>
>
> ... but there are no such lines in my real installation.  I'm baffled.
>
> Adam
>
>
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/ea373ba9-9c9e-4358-9c71-b3c0d1c4b3d9%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Andromeda Yelton
Vice President/President-Elect, Library & Information Technology
Association: http://www.lita.org
http://andromedayelton.com
@ThatAndromeda 

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


Re: 1.7.9 deployment stubbornly won't create a test database

2016-08-30 Thread M Hashmi
Try this:

python manage.py test --keepdb


On Mon, Aug 29, 2016 at 3:26 PM, Adam Hirsch 
wrote:

> I've been handed a fairly large and built-up django 1.7.9 installation
> with several dozen pre-existing in-house modules and a lot of history.
>
> For some reason, any attempt to * manage.py test * any of the existing
> modules runs tests against the live database specified in 
> *DATABASES['default']
> *rather than attempting to create a new test database.  I've written a
> couple of simple unit tests for a given module, generated a small fixture
> of data to apply to a blank schema for testing ... but I can't for the life
> of me find why this installation isn't creating a test_db. No errors, no
> failures ... just tests run against the production db.
>
> Anyone have a pointer to what might be going on, or concepts to look up? A
> simple Hello World install using the same django version on the same
> machine works exactly as the docs suggest it should: I see
>
> Creating test database for alias 'default' (':memory:')...
> [...]
> Destroying test database for alias 'default' (':memory:')...
>
>
> ... but there are no such lines in my real installation.  I'm baffled.
>
> Adam
>
>
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/ea373ba9-9c9e-4358-9c71-b3c0d1c4b3d9%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANoUts4gRa9tdroug%2BcGk-36iv_GHFT1HpUQxZtiW-WekPN_PA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: help designing a fallback django paralel server

2016-08-30 Thread M Hashmi
Not sure what exactly you want because why would you want your workers to
access server on speed of internet when you have them locally connected.

However, as far as I understood is that you can have one machine setup as
remote with some firewall that will open up ports based on local IP
addresses. If you mean you have multiple django projects then you can
assign separate ports to each project and use gunicorn or any other same
functionality based application. What gunicorn do is that it associates
your internal port to a socket that can be accessed from local network or
web. You can then let the django admin/authorization system handle
authentication based on provided credentials.

Again I have no idea what architecture you are using but let's assume to
keep it simple you have NT implemented network, then you can set profilings
attached to connection states after implementing any firewall software.

For a precise answer please send some diagram with information about your
network architecture.

Regards,
Mudassar

On Tue, Aug 30, 2016 at 1:02 AM, Marco Silva 
wrote:

> Hello,
>
> I have several critical systems, each run a django server witch users use
> trough the local network(192.168.xxx.xxx)  to control and monitor the
> system. The goal would be to create a more powerfull remote server, that
> could unify several local servers, so that regular use would be only trough
> this remote server, and local access should be only available for when
> internet connection would fail.
>
> How should i implement this systems? how would the DB sync?
> Also, some services should run on the local server, like some celery based
> scheduled tasks.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/de599153-2adc-4fd4-a5f4-b04f5149b4fd%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANoUts61RvOtnPd3New_q7S1dAP7SQx2ZdcMQU_STehsXD6jrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create a database for my website in Django

2016-08-30 Thread M Hashmi
Hi,

First of all as far as creation of database is concerned there is
comprehensive documentation at djagnoproject.com in tutorial section. Once
you've created database then you can use "forms" to get data from the front
end to save it in db. Before you go through all this exercise I would
suggest you to choose a tutorial of small app on youtube.com to build some
basic djagno application. You will learn it quickly this way because with
posting messages for each step it will take  a lot time for you to
understand things.

Pick up a tutorial of your choice video or documented tutorial and repeat
it at least thrice for the first time.

Next if you can't understand some sections of tutorial you can post on this
group and people will love to help you out. Same tutorial might fit your
exact needs and a video tutorial won't take long to get you up to the point
you intend to raise yourself.

Regards,
Mudassar

On Tue, Aug 30, 2016 at 3:23 PM, Jeff Goes 
wrote:

> I have little knowledge when it comes to the creation of databases. I
> would like to know if someone can help me set a database for my website
> step by step since I have a deadline due to next month to finish a project
> that requires that kind of knowledge. The idea is to input information on
> the website and save them into an internal database. I already have MySql
> and Sequel Pro installed but don't know how to link them to my website.
>
> I appreciate it.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/500d5d57-6c92-4f3e-947d-cfb5d74092d9%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANoUts6U9zHYrrQrAvPOmruxAxQPFneTtef5qdrsdm%2BqvzTz2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to create a database for my website in Django

2016-08-30 Thread Jeff Goes
I have little knowledge when it comes to the creation of databases. I would 
like to know if someone can help me set a database for my website step by 
step since I have a deadline due to next month to finish a project that 
requires that kind of knowledge. The idea is to input information on the 
website and save them into an internal database. I already have MySql and 
Sequel Pro installed but don't know how to link them to my website.

I appreciate it.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/500d5d57-6c92-4f3e-947d-cfb5d74092d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Multi Table Inheritance and Preserving Child and Child History

2016-08-30 Thread Malik Rumi
Note: I originally posted this 
to 
http://dba.stackexchange.com/questions/147680/django-multi-table-inheritance-and-preserving-child-and-child-history,
 
 but 7 days and ZERO responses is not working for me. 

Place can have many different one to one fields, that’s why it can have 
bookstore, restaurant, and hardware store. But can the same place be both a 
bookstore and a restaurant at the same time? Now if the bookstore and 
restaurant tables don't have the same pk as place, I would think the answer 
is yes. But I also know that unless you put parent_link=True on it, erasing 
the child row automatically deletes the parent row.


My use case is to preserve the history of Restaurant despite it’s having 
now become a Bookstore, and if a Restaurant is simultaneously a Bookstore, 
to be able to keep both places in my db. Is the best way to do this with a 
fk to each of the bookstores, restaurants and hardware stores instead of 
either a OneToOne or multi table inheritance? Or is there some other way 
I’m not aware of? 


This has to be a solved problem, but so far I haven't found it. I'm 
currently looking at NFL databases because players can be on more than one 
team, (albeit not at the same time), and they have a recorded history of 
their team and individual stats - to see if I can hack those into what I 
want.


I'm even willing to consider an ArrayField or Hstore. I'm on Postgres 9.4 
and trying to maintain 3NF. All wisdom accepted. 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3be1a01c-5682-429b-b461-0cfbcccbc795%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'treebeard.templatetags.admin_tree_list': cannot import name 'patterns'

2016-08-30 Thread Richard C
On second thoughts I just tried django 1.9.9 and it worked like a charm.
Good luck with the 1.10 porting everyone!


On Tuesday, 30 August 2016 21:22:19 UTC+1, Richard C wrote:
>
> Hi,
>
> I'm pretty new to this and (probably naively) trying to get django-shop 
> working with django 1.10.
> I have run into a few libraries that needed patterns() removing which I've 
> done and raised issues with the appropriate owners, but now have run into 
> this:
>
> django.template.library.InvalidTemplateLibrary: Invalid template library 
>> specified. ImportError raised when trying to load 
>> 'treebeard.templatetags.admin_tree_list': cannot import name 'patterns'
>>
>
> I've been through treebeard and the django backend but can't seem to find 
> any reference to patterns. What am I doing wrong?
>
> Thanks in advance for the clues!
>
> pip freeze:
>
>  beautifulsoup4==4.5.1
>> defusedxml==0.4.1
>> Django==1.10
>> django-admin-sortable2==0.6.4
>> django-allauth==0.27.0
>> django-angular==0.8.4
>> django-appconf==1.0.2
>> django-classy-tags==0.8.0
>> django-cms==3.3.2
>> django-compressor==2.1
>> django-filer==1.2.4
>> django-filter==0.14.0
>> django-formtools==1.0
>> django-fsm==2.4.0
>> django-fsm-admin==1.2.3
>> django-haystack==2.5.dev1
>> django-ipware==1.1.5
>> django-mptt==0.8.6
>> django-parler==1.6.5
>> django-polymorphic==1.0b1
>> django-post-office==2.0.8
>> django-rest-auth==0.8.1
>> django-sass-processor==0.4.6
>> django-sekizai==0.10.0
>> Django-Select2==5.8.9
>> -e git+
>> https://github.com/awesto/django-shop@c8b7f1fe0db4aa0e16c39e0ceff736a964fa7a3a#egg=django_shop
>> django-treebeard==4.0.1
>> djangocms-admin-style==1.2.3
>> djangocms-bootstrap3==0.1.1
>> djangocms-cascade==0.9.2
>> djangocms-text-ckeditor==3.2.0rc3
>> djangorestframework==3.4.6
>> djangoshop-stripe==0.1.4
>> drf-haystack==1.5.6
>> easy-thumbnails==2.3
>> elasticsearch==2.4.0
>> html5lib==0.99
>> jsonfield==1.0.3
>> libsass==0.11.1
>> oauthlib==1.1.2
>> Pillow==3.3.1
>> pluggy==0.3.1
>> py==1.4.31
>> Pygments==2.1.3
>> python-dateutil==2.5.3
>> python-openid==2.2.5
>> python3-openid==3.0.10
>> pytz==2016.6.1
>> rcssmin==1.0.6
>> requests==2.11.1
>> requests-oauthlib==0.6.2
>> rjsmin==1.0.12
>> six==1.10.0
>> stripe==1.37.0
>> Unidecode==0.4.19
>> urllib3==1.16
>> webencodings==0.5
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7ce3fc48-01da-4896-a2fa-718841bee023%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ti possible CommaSeparatedIpField

2016-08-30 Thread Jorge Cadena
Hi

I have a idea CommaSeparatedIpField, it possible ?

this for validacion IP ACL list in FreeSWITCH.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9d5d8359-ce30-41c8-8d88-2733b32ad76d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django documentation release 1.10.1a1

2016-08-30 Thread Rich Shepard

  I don't know how this PDF displays in other viewers, but in xpdf, mupdf,
and acroread important strings in the text are very difficult to read
because they have very low contrast with the white background.

  For example, comments are in a light grey and important strings are in a
very pale yellow. Page 14 has many examples of this.

  Perhaps for very young eyeballs it's not an issue, but for those of us
with many miles on our eyes it's extremely hard to read this light text on
the white background.

  It would be very helpful if this situation was quickly remedied and a
revised version released.

Thanks in advance,

Rich


django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'treebeard.templatetags.admin_tree_list': cannot import name 'patterns'

2016-08-30 Thread Richard C
Hi,

I'm pretty new to this and (probably naively) trying to get django-shop 
working with django 1.10.
I have run into a few libraries that needed patterns() removing which I've 
done and raised issues with the appropriate owners, but now have run into 
this:

django.template.library.InvalidTemplateLibrary: Invalid template library 
> specified. ImportError raised when trying to load 
> 'treebeard.templatetags.admin_tree_list': cannot import name 'patterns'
>

I've been through treebeard and the django backend but can't seem to find 
any reference to patterns. What am I doing wrong?

Thanks in advance for the clues!

pip freeze:

 beautifulsoup4==4.5.1
> defusedxml==0.4.1
> Django==1.10
> django-admin-sortable2==0.6.4
> django-allauth==0.27.0
> django-angular==0.8.4
> django-appconf==1.0.2
> django-classy-tags==0.8.0
> django-cms==3.3.2
> django-compressor==2.1
> django-filer==1.2.4
> django-filter==0.14.0
> django-formtools==1.0
> django-fsm==2.4.0
> django-fsm-admin==1.2.3
> django-haystack==2.5.dev1
> django-ipware==1.1.5
> django-mptt==0.8.6
> django-parler==1.6.5
> django-polymorphic==1.0b1
> django-post-office==2.0.8
> django-rest-auth==0.8.1
> django-sass-processor==0.4.6
> django-sekizai==0.10.0
> Django-Select2==5.8.9
> -e 
> git+https://github.com/awesto/django-shop@c8b7f1fe0db4aa0e16c39e0ceff736a964fa7a3a#egg=django_shop
> django-treebeard==4.0.1
> djangocms-admin-style==1.2.3
> djangocms-bootstrap3==0.1.1
> djangocms-cascade==0.9.2
> djangocms-text-ckeditor==3.2.0rc3
> djangorestframework==3.4.6
> djangoshop-stripe==0.1.4
> drf-haystack==1.5.6
> easy-thumbnails==2.3
> elasticsearch==2.4.0
> html5lib==0.99
> jsonfield==1.0.3
> libsass==0.11.1
> oauthlib==1.1.2
> Pillow==3.3.1
> pluggy==0.3.1
> py==1.4.31
> Pygments==2.1.3
> python-dateutil==2.5.3
> python-openid==2.2.5
> python3-openid==3.0.10
> pytz==2016.6.1
> rcssmin==1.0.6
> requests==2.11.1
> requests-oauthlib==0.6.2
> rjsmin==1.0.12
> six==1.10.0
> stripe==1.37.0
> Unidecode==0.4.19
> urllib3==1.16
> webencodings==0.5

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/04eb579f-b873-477e-a35c-0d1909cfa36e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: error in installing django[argon2] -regarding

2016-08-30 Thread Ricardo Daniel Quiroga
argon2 required lidfi

in ubuntu install manuall

$ sudo apt-get install libffi5 libffi-dev


2016-08-28 13:43 GMT-03:00 sabari rangan :

> Collecting argon2-cffi>=16.1.0; extra == "argon2" (from django[argon2])
>   Downloading argon2_cffi-16.1.0.tar.gz (1.2MB)
> Complete output from command python setup.py egg_info:
> Package libffi was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libffi.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'libffi' found
> Package libffi was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libffi.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'libffi' found
> Package libffi was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libffi.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'libffi' found
> Package libffi was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libffi.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'libffi' found
> Package libffi was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libffi.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'libffi' found
> c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
> compilation terminated.
> Traceback (most recent call last):
>   File "/usr/lib/python3.5/distutils/unixccompiler.py", line 118, in
> _compile
> extra_postargs)
>   File "/usr/lib/python3.5/distutils/ccompiler.py", line 909, in spawn
> spawn(cmd, dry_run=self.dry_run)
>   File "/usr/lib/python3.5/distutils/spawn.py", line 36, in spawn
> _spawn_posix(cmd, search_path, dry_run=dry_run)
>   File "/usr/lib/python3.5/distutils/spawn.py", line 159, in
> _spawn_posix
> % (cmd, exit_status))
> distutils.errors.DistutilsExecError: command 'x86_64-linux-gnu-gcc'
> failed with exit status 1
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
> dist.run_commands()
>   File "/usr/lib/python3.5/distutils/dist.py", line 955, in
> run_commands
> self.run_command(cmd)
>   File "/usr/lib/python3.5/distutils/dist.py", line 974, in
> run_command
> cmd_obj.run()
>   File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py",
> line 161, in run
> cmd = self.call_command('install_lib', warn_dir=0)
>   File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py",
> line 147, in call_command
> self.run_command(cmdname)
>   File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
> self.distribution.run_command(command)
>   File "/usr/lib/python3.5/distutils/dist.py", line 974, in
> run_command
> cmd_obj.run()
>   File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py",
> line 23, in run
> self.build()
>   File "/usr/lib/python3.5/distutils/command/install_lib.py", line
> 109, in build
> self.run_command('build_ext')
>   File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
> self.distribution.run_command(command)
>   File "/usr/lib/python3.5/distutils/dist.py", line 974, in
> run_command
> cmd_obj.run()
>   File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py",
> line 49, in run
> _build_ext.run(self)
>   File "/usr/lib/python3.5/distutils/command/build_ext.py", line 338,
> in run
> self.build_extensions()
>   File "/usr/lib/python3.5/distutils/command/build_ext.py", line 447,
> in build_extensions
> self._build_extensions_serial()
>   File "/usr/lib/python3.5/distutils/command/build_ext.py", line 472,
> in _build_extensions_serial
> self.build_extension(ext)
>   File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py",
> line 174, in build_extension
> _build_ext.build_extension(self, ext)
>   File "/usr/lib/python3.5/distutils/command/build_ext.py", line 532,
> in build_extension
> depends=ext.depends)
>   File "/usr/lib/python3.5/distutils/ccompiler.py", line 574, in
> compile
> self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
>   File "/usr/lib/python3.5/distutils/unixccompiler.py", line 120, in
> _compile
> raise CompileError(msg)
> distutils.errors.CompileError: command 'x86_64-linux-gnu-gcc' failed
> with exit status 1
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line
> 154, in save_modules
> yield saved
> 

Re: beginner . problem simple form.

2016-08-30 Thread Jordi Fernandez
console no message, I see  in one second what form search in bad url , bad 
because I want to the same view.(url)  It's search 
in http://127.0.0.1:8000/crearasistenciaclasse/crearasistenciaclasse
 this  is incorrect the correct 
is http://127.0.0.1:8000/crearasistenciaclasse



El diumenge, 21 agost de 2016 15:41:07 UTC+2, ludovic coues va escriure:
>
> Do you have any message in the console where you run "python manage.py 
> runserver" ? 
>
> 2016-08-21 12:16 GMT+02:00 Jordi Fernandez  >: 
> > hi, 
> > 
> > I have my firts application django it's fine. . But! I have a problem 
> with a 
> > simple form. I  think this  is a problem the my experience of all entorn 
> ( 
> > html, form action, ..) 
> > 
> > the problem is when a submit my form is a eror -> ERROR LOADING PAGE 
> > 
> > if I test my script I not received a method post. why? 
> > 
> > 
> > 
> > thank you 
> > 
> > 
> > This is my template form 
> > 
> > {% csrf_token %} 
> > {{ form.name.errors }} 
> >  
> > 
> > {{form.as_p}} 
> > 
> >  
> >  
> > 
> >  
> > 
> > 
> > this is my wiew 
> > 
> > def crearasistenciaclasse(request): 
> > #return HttpResponse('ok') 
> > 
> > if request.method == "POST": 
> > form = CrearasistenciaclasseForm(request.POST) 
> > if form.is_valid(): 
> >Asistencia = form.save() 
> >return redirect('dojo.views.reportaralumnos') 
> > else: 
> > user = 6 
> > form = CrearasistenciaclasseForm(my_arg=user) 
> > 
> > return render_to_response('asistencias/crearasistenciaclasse.html', 
> > {'form': form}) 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > this is my form 
> > 
> > class CrearasistenciaclasseForm(forms.Form): 
> > alumnos = forms.ModelChoiceField(queryset=Alumno.objects.all()) 
> > classesobertes = 
> > forms.ModelChoiceField(queryset=Classe.objects.filter(estado='A')) 
> > def __init__(self, *args, **kwargs): 
> > my_arg = kwargs.pop('my_arg') 
> > super(CrearasistenciaclasseForm, self).__init__(*args, **kwargs) 
> > 
> > self.fields['classesobertes'].label = "Classe" 
> > 
> > self.fields['alumnos'].initial = my_arg 
> > 
> > -- 
> > 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 https://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/71bb6ab8-e14a-47aa-91ad-57d4ac29e6f0%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
>
> Cordialement, Coues Ludovic 
> +336 148 743 42 
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4cbcd76a-1d38-45cd-8680-438cde64ad17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: beginner . problem simple form.

2016-08-30 Thread Jordi Fernandez
the second is a comment

El dimarts, 30 agost de 2016 18:56:39 UTC+2, Jordi Fernandez va escriure:
>
>
> yes  , we are test
> El dilluns, 22 agost de 2016 22:38:39 UTC+2, ludovic coues va escriure:
>>
>> The second form tag is in an html comment. Everything inside  
>> won't be rendered. 
>>
>> 2016-08-22 14:31 GMT+02:00 Vijay Khemlani : 
>> > Also, why do you have two form tags in your html? 
>> > 
>> > On Sun, Aug 21, 2016 at 10:40 AM, ludovic coues  
>> wrote: 
>> >> 
>> >> Do you have any message in the console where you run "python manage.py 
>> >> runserver" ? 
>> >> 
>> >> 2016-08-21 12:16 GMT+02:00 Jordi Fernandez : 
>> >> > hi, 
>> >> > 
>> >> > I have my firts application django it's fine. . But! I have a 
>> problem 
>> >> > with a 
>> >> > simple form. I  think this  is a problem the my experience of all 
>> entorn 
>> >> > ( 
>> >> > html, form action, ..) 
>> >> > 
>> >> > the problem is when a submit my form is a eror -> ERROR LOADING PAGE 
>> >> > 
>> >> > if I test my script I not received a method post. why? 
>> >> > 
>> >> > 
>> >> > 
>> >> > thank you 
>> >> > 
>> >> > 
>> >> > This is my template form 
>> >> > 
>> >> > {% csrf_token 
>> %} 
>> >> > {{ form.name.errors }} 
>> >> >  
>> >> > 
>> >> > {{form.as_p}} 
>> >> > 
>> >> >  
>> >> >  
>> >> > 
>> >> >  
>> >> > 
>> >> > 
>> >> > this is my wiew 
>> >> > 
>> >> > def crearasistenciaclasse(request): 
>> >> > #return HttpResponse('ok') 
>> >> > 
>> >> > if request.method == "POST": 
>> >> > form = CrearasistenciaclasseForm(request.POST) 
>> >> > if form.is_valid(): 
>> >> >Asistencia = form.save() 
>> >> >return redirect('dojo.views.reportaralumnos') 
>> >> > else: 
>> >> > user = 6 
>> >> > form = CrearasistenciaclasseForm(my_arg=user) 
>> >> > 
>> >> > return 
>> render_to_response('asistencias/crearasistenciaclasse.html', 
>> >> > {'form': form}) 
>> >> > 
>> >> > 
>> >> > 
>> >> > 
>> >> > 
>> >> > 
>> >> > 
>> >> > 
>> >> > 
>> >> > this is my form 
>> >> > 
>> >> > class CrearasistenciaclasseForm(forms.Form): 
>> >> > alumnos = forms.ModelChoiceField(queryset=Alumno.objects.all()) 
>> >> > classesobertes = 
>> >> > forms.ModelChoiceField(queryset=Classe.objects.filter(estado='A')) 
>> >> > def __init__(self, *args, **kwargs): 
>> >> > my_arg = kwargs.pop('my_arg') 
>> >> > super(CrearasistenciaclasseForm, self).__init__(*args, **kwargs) 
>> >> > 
>> >> > self.fields['classesobertes'].label = "Classe" 
>> >> > 
>> >> > self.fields['alumnos'].initial = my_arg 
>> >> > 
>> >> > -- 
>> >> > 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 https://groups.google.com/group/django-users. 
>> >> > To view this discussion on the web visit 
>> >> > 
>> >> > 
>> https://groups.google.com/d/msgid/django-users/71bb6ab8-e14a-47aa-91ad-57d4ac29e6f0%40googlegroups.com.
>>  
>>
>> >> > For more options, visit https://groups.google.com/d/optout. 
>> >> 
>> >> 
>> >> 
>> >> -- 
>> >> 
>> >> Cordialement, Coues Ludovic 
>> >> +336 148 743 42 
>> >> 
>> >> -- 
>> >> 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 https://groups.google.com/group/django-users. 
>> >> To view this discussion on the web visit 
>> >> 
>> https://groups.google.com/d/msgid/django-users/CAEuG%2BTbsnWXo0iF0%2BaNwY3KV1AZXj74bCh4w3jrt86KL1RCTXQ%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...@googlegroups.com. 
>> > To post to this group, send email to django...@googlegroups.com. 
>> > Visit this group at https://groups.google.com/group/django-users. 
>> > To view this discussion on the web visit 
>> > 
>> https://groups.google.com/d/msgid/django-users/CALn3ei3ReDgYhXY4yabQ2v-QMNcLD5tzOadoxC9cxTaBcPP-cQ%40mail.gmail.com.
>>  
>>
>> > 
>> > For more options, visit https://groups.google.com/d/optout. 
>>
>>
>>
>> -- 
>>
>> Cordialement, Coues Ludovic 
>> +336 148 743 42 
>>
>

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

Re: beginner . problem simple form.

2016-08-30 Thread Jordi Fernandez

yes  , we are test
El dilluns, 22 agost de 2016 22:38:39 UTC+2, ludovic coues va escriure:
>
> The second form tag is in an html comment. Everything inside  
> won't be rendered. 
>
> 2016-08-22 14:31 GMT+02:00 Vijay Khemlani >: 
>
> > Also, why do you have two form tags in your html? 
> > 
> > On Sun, Aug 21, 2016 at 10:40 AM, ludovic coues  > wrote: 
> >> 
> >> Do you have any message in the console where you run "python manage.py 
> >> runserver" ? 
> >> 
> >> 2016-08-21 12:16 GMT+02:00 Jordi Fernandez  >: 
> >> > hi, 
> >> > 
> >> > I have my firts application django it's fine. . But! I have a problem 
> >> > with a 
> >> > simple form. I  think this  is a problem the my experience of all 
> entorn 
> >> > ( 
> >> > html, form action, ..) 
> >> > 
> >> > the problem is when a submit my form is a eror -> ERROR LOADING PAGE 
> >> > 
> >> > if I test my script I not received a method post. why? 
> >> > 
> >> > 
> >> > 
> >> > thank you 
> >> > 
> >> > 
> >> > This is my template form 
> >> > 
> >> > {% csrf_token 
> %} 
> >> > {{ form.name.errors }} 
> >> >  
> >> > 
> >> > {{form.as_p}} 
> >> > 
> >> >  
> >> >  
> >> > 
> >> >  
> >> > 
> >> > 
> >> > this is my wiew 
> >> > 
> >> > def crearasistenciaclasse(request): 
> >> > #return HttpResponse('ok') 
> >> > 
> >> > if request.method == "POST": 
> >> > form = CrearasistenciaclasseForm(request.POST) 
> >> > if form.is_valid(): 
> >> >Asistencia = form.save() 
> >> >return redirect('dojo.views.reportaralumnos') 
> >> > else: 
> >> > user = 6 
> >> > form = CrearasistenciaclasseForm(my_arg=user) 
> >> > 
> >> > return 
> render_to_response('asistencias/crearasistenciaclasse.html', 
> >> > {'form': form}) 
> >> > 
> >> > 
> >> > 
> >> > 
> >> > 
> >> > 
> >> > 
> >> > 
> >> > 
> >> > this is my form 
> >> > 
> >> > class CrearasistenciaclasseForm(forms.Form): 
> >> > alumnos = forms.ModelChoiceField(queryset=Alumno.objects.all()) 
> >> > classesobertes = 
> >> > forms.ModelChoiceField(queryset=Classe.objects.filter(estado='A')) 
> >> > def __init__(self, *args, **kwargs): 
> >> > my_arg = kwargs.pop('my_arg') 
> >> > super(CrearasistenciaclasseForm, self).__init__(*args, **kwargs) 
> >> > 
> >> > self.fields['classesobertes'].label = "Classe" 
> >> > 
> >> > self.fields['alumnos'].initial = my_arg 
> >> > 
> >> > -- 
> >> > 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 https://groups.google.com/group/django-users. 
> >> > To view this discussion on the web visit 
> >> > 
> >> > 
> https://groups.google.com/d/msgid/django-users/71bb6ab8-e14a-47aa-91ad-57d4ac29e6f0%40googlegroups.com.
>  
>
> >> > For more options, visit https://groups.google.com/d/optout. 
> >> 
> >> 
> >> 
> >> -- 
> >> 
> >> Cordialement, Coues Ludovic 
> >> +336 148 743 42 
> >> 
> >> -- 
> >> 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 https://groups.google.com/group/django-users. 
> >> To view this discussion on the web visit 
> >> 
> https://groups.google.com/d/msgid/django-users/CAEuG%2BTbsnWXo0iF0%2BaNwY3KV1AZXj74bCh4w3jrt86KL1RCTXQ%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...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/CALn3ei3ReDgYhXY4yabQ2v-QMNcLD5tzOadoxC9cxTaBcPP-cQ%40mail.gmail.com.
>  
>
> > 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
>
> Cordialement, Coues Ludovic 
> +336 148 743 42 
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dfb01891-78d1-473e-b137-c774349988ea%40googlegroup

Re: get_available_name() got an unexpected keyword argument 'max_length'

2016-08-30 Thread Tim Graham
You need to update your own code or one of your dependencies as 
per 
https://docs.djangoproject.com/en/stable/releases/1.8/#support-for-the-max-length-argument-on-custom-storage-classes.

If you 
follow https://docs.djangoproject.com/en/stable/howto/upgrade-version/ with 
an older version of Django (1.8 or 1.9), you should see a helpful 
deprecation warning.

On Tuesday, August 30, 2016 at 9:39:46 AM UTC-4, manolo gomez wrote:
>
> Hi,
>
>I've updated from django 1.8 to 1.10, and now when save a ImageFile I'm 
> getting the next error:
>   
>get_available_name() got an unexpected keyword argument 'max_length'
>
>   
> This is the end of the Traceback:
> File "/home/dev/Documents/web/children/views/views.py" in post
>
>   73. ob.avatar.save(t[0], t[1])
>
>  File 
> "/home/securekids/Documents/enviroments/dev/local/lib/python2.7/site-packages/django/db/models/fields/files.py"
>  in save
>   91. self.name = self.storage.save(name, content, 
> max_length=self.field.max_length)
>
> File 
> "/home/securekids/Documents/enviroments/dev/local/lib/python2.7/site-packages/django/core/files/storage.py"
>  in save
>   53. name = self.get_available_name(name, max_length=max_length)
>
>
>   I've tried to remove  "max_length=max_length", and then it's working 
> fine, but I don't like so much to touch the django core :)
>   
>Anyone can help me? 
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dbc53072-d883-445f-a82a-37a4033cf0cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django template iterating through two dictionaries/variables

2016-08-30 Thread Nate Granatir
You could also just join the dicts before passing them to the template. It 
looks like it's relatively straightforward (scores is just a list that 
contains dicts of a 'Number' and a 'score', right?) Then you could turn 
scores into a dict, assuming Numbers are unique:

scores_new = {score['Number']:score['score'] for score in scores}

And then update the persons dict to include the score:
for person in persons:
person.update({'score': scores_new.get(person['Number'])})

Then in your persons list in the template you'll just need to display 
person.score.

If you want to get really fancy (if, say, there's more than just a score 
you need to pull from the dicts in scores) you can see how to merge two 
lists of dicts on a common key here:
http://stackoverflow.com/questions/5501810/join-two-lists-of-dictionaries-on-a-single-key

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7bef3019-5c6b-4aae-abaf-c18e9d034d49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: simple form, beginner

2016-08-30 Thread Jordi Fernandez
sorry a error es undefined and other is error loading page  (jquery)

El dimarts, 30 agost de 2016 17:44:00 UTC+2, Jordi Fernandez va escriure:
>
>
>  {% 
> csrf_token %}
>
>
>
>  {% csrf_token 
> %}
>
>
> the two instrucctions not working, my view not received nothing  post i 
> want a form with the same view.
>
> remember I am Beginner!
>
> thank you
>
>
> def crearasistenciaclasse(request):
> user = 6
> form = CrearasistenciaclasseForm(my_arg=user)
> if request.method == 'POST' :
>return HttpResponse('ok')
>form = CrearasistenciaclasseForm(request.POST)
>if form.is_valid():
>crearasistenciaclasse = Crearasistenciaclasse 
> (alumno=form_cleaned_data[alumnos],
>   
> classe=form_cleaned_data[classesobertes])
>crearasistenciaclasse.save()
>return redirect('dojo.views.reportaralumnos')
> else:
>#assert False, locals()
>user = 6
>form = CrearasistenciaclasseForm(my_arg=user)
>
>   
> return render_to_response('asistencias/crearasistenciaclasse.html', 
> {'form': form},
>  context_instance=RequestContext(request))
>
>
>
>
>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fc3437d7-8254-46b1-8c6a-6760041ec030%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


simple form, beginner

2016-08-30 Thread Jordi Fernandez

 {% csrf_token 
%}



 {% csrf_token 
%}


the two instrucctions not working, my view not received nothing  post i 
want a form with the same view.

remember I am Beginner!

thank you


def crearasistenciaclasse(request):
user = 6
form = CrearasistenciaclasseForm(my_arg=user)
if request.method == 'POST' :
   return HttpResponse('ok')
   form = CrearasistenciaclasseForm(request.POST)
   if form.is_valid():
   crearasistenciaclasse = Crearasistenciaclasse 
(alumno=form_cleaned_data[alumnos],
  
classe=form_cleaned_data[classesobertes])
   crearasistenciaclasse.save()
   return redirect('dojo.views.reportaralumnos')
else:
   #assert False, locals()
   user = 6
   form = CrearasistenciaclasseForm(my_arg=user)
   
  
return render_to_response('asistencias/crearasistenciaclasse.html', 
{'form': form},
 context_instance=RequestContext(request))





-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/af425b7a-a8cf-41b6-88c9-5ffcc3d3fb19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANNOUNCE] djangoCMS 3.4 RC 1 released

2016-08-30 Thread czpython
Hello all,

The django CMS core team just released the first release candidate for 
version 3.4.

Download: https://github.com/divio/django-cms/archive/3.4.0rc1.zip
Documentation: http://docs.django-cms.org/en/latest/index.html
Release notes: http://docs.django-cms.org/en/latest/upgrade/3.4.html
Source: https://github.com/divio/django-cms/tree/3.4.0rc1

Please report any issues you find with this release to our issue tracker at
https://github.com/divio/django-cms/issues, thank you.

The most significant change in this release is the removal of revision 
support (i.e. undo/redo/recover functionality on pages) from the core 
django CMS.
This functionality will be reinstated as an optional addon in due course, 
but in the meantime, that functionality is not available.

What’s new in 3.4

* Alias plugin improvements
* Refactored plugin rendering functionality to speed up loading time in 
both structure and content modes.
* Added a new Shift + Space shortcut to switch between structure and 
content mode while highlighting the current plugin, revealing its position.
* Added help modal about available shortcuts
* And lots more!

More information can be found on our blog 
https://www.django-cms.org/en/blog/2016/08/30/rc1-release-of-django-cms-3-4/

On behalf of the django CMS core developer team,

Paulo Alvarado

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/164e07bc-ef2e-44ff-86b3-62d721c16f3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


get_available_name() got an unexpected keyword argument 'max_length'

2016-08-30 Thread manolo gomez
Hi,
   
   I've updated from django 1.8 to 1.10, and now when save a ImageFile I'm 
getting the next error:
  
   get_available_name() got an unexpected keyword argument 'max_length'

  
This is the end of the Traceback:
File "/home/dev/Documents/web/children/views/views.py" in post

  73. ob.avatar.save(t[0], t[1])

 File 
"/home/securekids/Documents/enviroments/dev/local/lib/python2.7/site-packages/django/db/models/fields/files.py"
 in save
  91. self.name = self.storage.save(name, content, 
max_length=self.field.max_length)

File 
"/home/securekids/Documents/enviroments/dev/local/lib/python2.7/site-packages/django/core/files/storage.py"
 in save
  53. name = self.get_available_name(name, max_length=max_length)


  I've tried to remove  "max_length=max_length", and then it's working 
fine, but I don't like so much to touch the django core :)
  
   Anyone can help me? 

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3bc9d1f7-557e-4abf-9003-47aa7c6a415a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A tricky query in one to many relationship - atleast for me:)

2016-08-30 Thread Web Architect
Thanks Erik. Will try out the solution you mentioned.

On Tuesday, August 30, 2016 at 3:59:20 PM UTC+5:30, Erik Cederstrand wrote:
>
>
> > Den 30. aug. 2016 kl. 11.20 skrev Erik Cederstrand <
> erik+...@cederstrand.dk >: 
> > 
> > I'm not even sure that's possible to express in SQL, but it would 
> probably be quite convoluted if it is. Here's an easier-to-understand 
> solution: 
> > 
> > res = set() 
> > for b in 
> B.objects.all().select_related('a').annotate(Max('date_created')): 
> >if b.date_created != b.date_created__max: 
> >continue 
> >if b.text != 'ABCD': 
> >continue 
> >res.add(a) 
>
> I did some more experimenting. I think this actually does what you want: 
>
> res = [ 
> b.a for b in B.objects 
> .filter(date_created=Max('a__b__date_created')) 
> .annotate(Max('a__b__date_created')) 
> .filter(text='ABCD') 
> .select_related('a') 
> ] 
>
> which you can rewrite as: 
>
> A.objects.filter( 
> b__in=B.objects 
> .filter(date_created=Max('a__b__date_created')) 
> .annotate(Max('a__b__date_created')) 
> .filter(text='ABCD') 
> ) 
>
> Erik

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2dc0eaa1-1c80-454d-9e3d-9ba4cbcb8140%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Postcode Search

2016-08-30 Thread Christian Ledermann
also have a look at
http://stackoverflow.com/questions/19703975/django-sort-by-distance/35896358#35896358

On 25 August 2016 at 13:24, 'David Turner' via Django users
 wrote:
> Thanks for this. Exactly what I am looking for.
>
> On 25 August 2016 at 12:59, Christian Ledermann
>  wrote:
>>
>> have a look at https://github.com/cleder/os-opendata-edubase
>>
>> import of uk postcodes from ordonance survey:
>>
>> https://github.com/cleder/os-opendata-edubase/blob/master/fabric/fabfile.py#L286
>>
>> get points near to:
>>
>>
>> https://github.com/cleder/os-opendata-edubase/blob/master/django/schools/views.py#L63
>> or
>>
>> https://github.com/cleder/os-opendata-edubase/blob/master/django/schools/views.py#L120
>>
>> HTH
>>
>> On 25 August 2016 at 10:25, 'David Turner' via Django users
>>  wrote:
>> > Thanks for this but am looking for Uk Postcodes. Will continue my
>> > research.
>> >
>> > On 24 August 2016 at 15:10, Derek  wrote:
>> >>
>> >> The Google geocoding API can help - see:
>> >> https://developers.google.com/maps/documentation/geocoding/intro
>> >> Their example shows the ZIP code being returned in the JSON/XML
>> >> response.
>> >>
>> >> Or there is: https://www.zipcodeapi.com/
>> >>
>> >> Of course, you need to adhere to the terms&conditions of these service
>> >> providers.
>> >>
>> >>
>> >> On Tuesday, 23 August 2016 23:19:53 UTC+2, dtdave wrote:
>> >>>
>> >>> I am looking to add the facility to "find my nearest" by postcode to
>> >>> my
>> >>> django app.
>> >>>
>> >>> Does anyone have any recommendations for this facility?
>> >>>
>> >>> Many thanks in advance.
>> >>
>> >> --
>> >> 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/-DQWcH9zkbA/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 https://groups.google.com/group/django-users.
>> >> To view this discussion on the web visit
>> >>
>> >> https://groups.google.com/d/msgid/django-users/ca6a1b18-c6b7-4292-be7c-edafeaea156a%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 https://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/django-users/CALwQ%2B-tr%2Brz3NHLhwBA-tCXpguR5ozakyf7uo5Dedh-XYcD1rA%40mail.gmail.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Best Regards,
>>
>> Christian Ledermann
>>
>> Newark-on-Trent - UK
>> Mobile : +44 7474997517
>>
>> https://uk.linkedin.com/in/christianledermann
>> https://github.com/cleder/
>>
>>
>> <*)))>{
>>
>> If you save the living environment, the biodiversity that we have left,
>> you will also automatically save the physical environment, too. But If
>> you only save the physical environment, you will ultimately lose both.
>>
>> 1) Don’t drive species to extinction
>>
>> 2) Don’t destroy a habitat that species rely on.
>>
>> 3) Don’t change the climate in ways that will result in the above.
>>
>> }<(((*>
>>
>> --
>> 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/-DQWcH9zkbA/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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CABCjzWqJoyA454Grv0GbZ57KyAe%3D08E9hdaT78sCp7JRO0hnYg%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALwQ%2B-uX1q0FW77svsBn%3DJv2dJ0tjuxOxnapAd%2B3fBaDYjFiVw%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 
Best Regards,

Christian L

Finally stable release of Django JET - responsive and fresh admin interface

2016-08-30 Thread Denis Kildishev
Finally stable release of Django JET - responsive and fresh admin interface
http://jet.geex-arts.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6e563d61-c64b-450f-b7d2-6c115ca4557b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


help designing a fallback django paralel server

2016-08-30 Thread Marco Silva
Hello,

I have several critical systems, each run a django server witch users use 
trough the local network(192.168.xxx.xxx)  to control and monitor the 
system. The goal would be to create a more powerfull remote server, that 
could unify several local servers, so that regular use would be only trough 
this remote server, and local access should be only available for when 
internet connection would fail.

How should i implement this systems? how would the DB sync?
Also, some services should run on the local server, like some celery based 
scheduled tasks.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/de599153-2adc-4fd4-a5f4-b04f5149b4fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A tricky query in one to many relationship - atleast for me:)

2016-08-30 Thread Marco Silva
Maybe this can help you 
https://docs.djangoproject.com/en/1.10/topics/db/aggregation/

terça-feira, 30 de Agosto de 2016 às 07:33:14 UTC+1, Web Architect escreveu:
>
> Hi,
>
> I am looking for an elegant and efficient mechanism to have a query filter 
> or a solution for the following one to many relationship model. Please note 
> the following is just an illustration of the models - hope it should 
> provide what I am looking for:
>
> class A(models.Model):
>
> name = models.CharField(_("Name"), max_length=255, unique=True)
>
>
> class B(models.Model):
>
> text = models.CharField(_("Text"), max_length=255, unique=True)
>
> date_created = models.DateTimeField(_("Date Created"), auto_now_add=True) 
>
>  a = models.ForeignKey(A, related_name='b')
>
>
> To get all the instances of B associated with a specific instance of A 
> (say 'a'), I could do the following : a.b.all()
>
> The latest instance of B associated with 'a' would be : 
> a.b.latest('date_created')
>
> Now I would like to have a list of all instances of A where the latest 
> instance of B associated with each instance of A will have the 'text' field 
> as 'ABCD'. 
>
> A.objects.filter(b__text='ABCD') will give all instances of A where each 
> instance of A will have atleast one instance of B with 'text' = 'ABCD'.
>
> There could be a brute force way of getting a solution for the above where 
> in I can do A.objects.filter(b__text='ABCD')  and then go through each 
> instance  of A in a for loop over the queryset and check for the latest 
> instance of B for text='ABCD'.
>
> As mentioned earlier, I am looking for an elegant and optimal way (if any 
> in Django) for the above query.
>
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e9835e6c-c23c-47ec-af2d-b50938d2e250%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A tricky query in one to many relationship - atleast for me:)

2016-08-30 Thread Erik Cederstrand

> Den 30. aug. 2016 kl. 11.20 skrev Erik Cederstrand 
> :
> 
> I'm not even sure that's possible to express in SQL, but it would probably be 
> quite convoluted if it is. Here's an easier-to-understand solution:
> 
> res = set()
> for b in B.objects.all().select_related('a').annotate(Max('date_created')):
>if b.date_created != b.date_created__max:
>continue
>if b.text != 'ABCD':
>continue
>res.add(a)

I did some more experimenting. I think this actually does what you want:

res = [
b.a for b in B.objects
.filter(date_created=Max('a__b__date_created'))
.annotate(Max('a__b__date_created'))
.filter(text='ABCD')
.select_related('a')
]

which you can rewrite as:

A.objects.filter(
b__in=B.objects
.filter(date_created=Max('a__b__date_created'))
.annotate(Max('a__b__date_created'))
.filter(text='ABCD')
)

Erik

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/BE1AB708-D9DF-499D-92A4-950C11697778%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: A tricky query in one to many relationship - atleast for me:)

2016-08-30 Thread Web Architect
Hi Erik,

Thanks for the solution.

So, I understand we get all instances of B which are max (date created)  or 
latest (date created) for each instance of A and then we check b.text == 
'ABCD' and select the corresponding instance of A. 
Can't we add additional filter to check if text='ABCD' instead of running 
it through the for loop? I am still yet to catch up with all the concepts 
of Django ORM hence, not sure about it.

Also, if we use Max('a__b__date_created') , do we need the following 
condition still in the for loop? :
if b.date_created != b.date_created__max: 
continue 

Thanks.


On Tuesday, August 30, 2016 at 3:03:44 PM UTC+5:30, Erik Cederstrand wrote:
>
> > for b in 
> B.objects.all().select_related('a').annotate(Max('date_created')): 
>
> That should probably be: Max('a__b__date_created') instead. 
>
> Erik 
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/49ab42be-053d-442d-a9b9-51d5123529fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: iregex doesn't work properly

2016-08-30 Thread Sergiy Khohlov
 this one problem is not related  to the django. It is Mysql special
configuration.   Dot  is not working in your system as expected :
http://dev.mysql.com/doc/refman/5.7/en/regexp.html

 Looks like your localization is broking regular expression in MySQL.
In this case please ask this question in  MySQL topic not django.

Many thanks,

Serge


+380 636150445
skype: skhohlov

On Tue, Aug 30, 2016 at 1:00 PM, Denis Yu  wrote:

> Here is the results:
> mysql> SELECT id FROM `clients_order_process` WHERE
> `clients_order_process`.`step_description` REGEXP '^заказ роутер.$';
> Empty set (0,00 sec)
>
>
> while:
> mysql> SELECT id FROM `clients_order_process` WHERE
> `clients_order_process`.`step_description` REGEXP '^заказ роутер*а*$';
> +-+
> | id  |
> +-+
> | 241 |
> +-+
> 1 row in set (0,00 sec)
>
>
> вторник, 30 августа 2016 г., 15:31:51 UTC+6 пользователь Sergiy Khohlov
> написал:
>>
>> try to execute from console :
>>  SELECT id FROM `clients_order_process` WHERE  `clients_order_process`
>> .`step_description` REGEXP '^заказ роутер.$'
>>
>> Many thanks,
>>
>> Serge
>>
>>
>> +380 636150445
>> skype: skhohlov
>>
>> On Tue, Aug 30, 2016 at 11:58 AM, Denis Yu  wrote:
>>
>>>
>>> sorry, may be I explained the result of testing incorrectly(
>>> pls let me make another try):
>>>
>>> here is the record in log table:
>>> | 2016-08-28 14:14:17.188990 | crm[crm] @ localhost [] |   934 |
>>>  0 | Query| SELECT COUNT(*) AS `__count` FROM
>>> `clients_order_process` WHERE (`clients_order_process`.`step` = 1 AND
>>> `clients_order_process`.`step_description` REGEXP '^заказ роутер.$')
>>>
>>>
>>> Django doesn't return any data. But I'm checking the record in table and
>>> it exists:
>>>
>>> mysql> select id, step, step_description from clients_order_process
>>> where id =241;
>>> +-+--+---+
>>> | id  | step | step_description  |
>>> +-+--+---+
>>> | 241 |1 | заказ роутера |
>>> +-+--+---+
>>> 1 row in set (0,00 sec)
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> вторник, 30 августа 2016 г., 14:37:24 UTC+6 пользователь Sergiy Khohlov
>>> написал:

 You are making me confused.
 1) Django  send data to db and SQL is correct
 2) MySQL returns correct result
 3) Django shows right data

  Which one step has issue ?

 Many thanks,

 Serge


 +380 636150445
 skype: skhohlov

 On Tue, Aug 30, 2016 at 10:51 AM, Denis Yu  wrote:

> Yes, i've seen.
>
> could you pls say one more ideas to check?
>
>
>
>
> воскресенье, 28 августа 2016 г., 21:11:56 UTC+6 пользователь Sergiy
> Khohlov написал:
>>
>> I've made mistake : "$" should be in request not "%"
>>
>>  this request "SELECT COUNT(*) AS `__count` FROM
>> `clients_order_process` WHERE (`clients_order_process`.`step` = 1
>> AND `clients_order_process`.`step_description` REGEXP '^заказ
>> роутер.$')"  informs that django sends data correctly.
>>
>> Many thanks,
>>
>> Serge
>>
>>
>> +380 636150445
>> skype: skhohlov
>>
>> On Sun, Aug 28, 2016 at 2:18 PM, Denis Yu  wrote:
>>
>>>
>>>1. Here is the result in logging table:
>>>
>>>
>>> mysql> select * from mysql.general_log;
>>> 
>>> | 2016-08-28 14:14:17.188990 | crm[crm] @ localhost [] |   934
>>> | 0 | Query| SELECT COUNT(*) AS `__count` FROM
>>> `clients_order_process` WHERE (`clients_order_process`.`step` = 1
>>> AND `clients_order_process`.`step_description` REGEXP '^заказ
>>> роутер.$')
>>> 
>>>
>>>
>>>
>>>
>>> the record exists in table:
>>> mysql> select id, step, step_description from clients_order_process
>>> where id =241;
>>> +-+--+---+
>>> | id  | step | step_description  |
>>> +-+--+---+
>>> | 241 |1 | заказ роутера |
>>> +-+--+---+
>>> 1 row in set (0,00 sec)
>>>
>>>
>>>
>>>
>>>1. the result of query  SELECT id from Order_process WHERE
>>>step_description REGEXP BINARY '^заказ роутера%'; :
>>>
>>>
>>> mysql>  SELECT id from clients_order_process WHERE step_description
>>> REGEXP BINARY '^заказ роутера%';
>>> Empty set (0,00 sec)
>>>
>>>
>>>
>>> mysql> select * from mysql.general_log;
>>> ++-+
>>> ---+---+--+-
>>> 
>>> +
>>> | event_time | user_host   | thread_id |
>>> server_id | command_type | argument
>>> |
>

Re: iregex doesn't work properly

2016-08-30 Thread Denis Yu
Here is the results:
mysql> SELECT id FROM `clients_order_process` WHERE  
`clients_order_process`.`step_description` REGEXP '^заказ роутер.$';
Empty set (0,00 sec)


while:
mysql> SELECT id FROM `clients_order_process` WHERE  
`clients_order_process`.`step_description` REGEXP '^заказ роутер*а*$';
+-+
| id  |
+-+
| 241 |
+-+
1 row in set (0,00 sec)


вторник, 30 августа 2016 г., 15:31:51 UTC+6 пользователь Sergiy Khohlov 
написал:
>
> try to execute from console : 
>  SELECT id FROM `clients_order_process` WHERE 
>  `clients_order_process`.`step_description` REGEXP '^заказ роутер.$'
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
> On Tue, Aug 30, 2016 at 11:58 AM, Denis Yu  > wrote:
>
>>
>> sorry, may be I explained the result of testing incorrectly(
>> pls let me make another try):
>>
>> here is the record in log table:
>> | 2016-08-28 14:14:17.188990 | crm[crm] @ localhost [] |   934 |  
>>0 | Query| SELECT COUNT(*) AS `__count` FROM 
>> `clients_order_process` WHERE (`clients_order_process`.`step` = 1 AND 
>> `clients_order_process`.`step_description` REGEXP '^заказ роутер.$')
>>
>>
>> Django doesn't return any data. But I'm checking the record in table and 
>> it exists:
>>
>> mysql> select id, step, step_description from clients_order_process where 
>> id =241;
>> +-+--+---+
>> | id  | step | step_description  |
>> +-+--+---+
>> | 241 |1 | заказ роутера |
>> +-+--+---+
>> 1 row in set (0,00 sec)
>>
>>
>>
>>
>>
>>
>>
>>
>> вторник, 30 августа 2016 г., 14:37:24 UTC+6 пользователь Sergiy Khohlov 
>> написал:
>>>
>>> You are making me confused. 
>>> 1) Django  send data to db and SQL is correct
>>> 2) MySQL returns correct result
>>> 3) Django shows right data
>>>
>>>  Which one step has issue ? 
>>>
>>> Many thanks,
>>>
>>> Serge
>>>
>>>
>>> +380 636150445
>>> skype: skhohlov
>>>
>>> On Tue, Aug 30, 2016 at 10:51 AM, Denis Yu  wrote:
>>>
 Yes, i've seen.

 could you pls say one more ideas to check?




 воскресенье, 28 августа 2016 г., 21:11:56 UTC+6 пользователь Sergiy 
 Khohlov написал:
>
> I've made mistake : "$" should be in request not "%"
>
>  this request "SELECT COUNT(*) AS `__count` FROM 
> `clients_order_process` WHERE (`clients_order_process`.`step` = 1 AND 
> `clients_order_process`.`step_description` REGEXP '^заказ роутер.$')" 
>  informs that django sends data correctly.
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
> On Sun, Aug 28, 2016 at 2:18 PM, Denis Yu  wrote:
>
>>
>>1. Here is the result in logging table:
>>
>>
>> mysql> select * from mysql.general_log;
>> 
>> | 2016-08-28 14:14:17.188990 | crm[crm] @ localhost [] |   934 |  
>>0 | Query| SELECT COUNT(*) AS `__count` FROM 
>> `clients_order_process` WHERE (`clients_order_process`.`step` = 1 AND 
>> `clients_order_process`.`step_description` REGEXP '^заказ роутер.$')
>> 
>>
>>
>>
>>
>> the record exists in table:
>> mysql> select id, step, step_description from clients_order_process 
>> where id =241;
>> +-+--+---+
>> | id  | step | step_description  |
>> +-+--+---+
>> | 241 |1 | заказ роутера |
>> +-+--+---+
>> 1 row in set (0,00 sec)
>>
>>
>>
>>
>>1. the result of query  SELECT id from Order_process WHERE 
>>step_description REGEXP BINARY '^заказ роутера%'; :
>>
>>
>> mysql>  SELECT id from clients_order_process WHERE step_description 
>> REGEXP BINARY '^заказ роутера%';
>> Empty set (0,00 sec)
>>
>>
>>
>> mysql> select * from mysql.general_log;
>>
>> ++-+---+---+--+-+
>> | event_time | user_host   | thread_id | 
>> server_id | command_type | argument  
>>   
>> |
>>
>> ++-+---+---+--+-+
>> | 2016-08-28 14:18:20.921420 | crm[crm] @ localhost [] |   857 |  
>>0 | Query| SELECT id from clients_order_process WHERE 
>> step_description REGEXP BINARY '^заказ роутера%'   
>>
>>
>> Pls, explain, what way do you recommend using raw string? 
>>
>>
>> thanks
>>>

Re: A tricky query in one to many relationship - atleast for me:)

2016-08-30 Thread Erik Cederstrand
> for b in B.objects.all().select_related('a').annotate(Max('date_created')):

That should probably be: Max('a__b__date_created') instead.

Erik

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/E911BFD1-0A2A-4943-AC80-E09D68C1A464%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: iregex doesn't work properly

2016-08-30 Thread Sergiy Khohlov
try to execute from console :
 SELECT id FROM `clients_order_process` WHERE
 `clients_order_process`.`step_description` REGEXP '^заказ роутер.$'

Many thanks,

Serge


+380 636150445
skype: skhohlov

On Tue, Aug 30, 2016 at 11:58 AM, Denis Yu  wrote:

>
> sorry, may be I explained the result of testing incorrectly(
> pls let me make another try):
>
> here is the record in log table:
> | 2016-08-28 14:14:17.188990 | crm[crm] @ localhost [] |   934 |
>0 | Query| SELECT COUNT(*) AS `__count` FROM
> `clients_order_process` WHERE (`clients_order_process`.`step` = 1 AND
> `clients_order_process`.`step_description` REGEXP '^заказ роутер.$')
>
>
> Django doesn't return any data. But I'm checking the record in table and
> it exists:
>
> mysql> select id, step, step_description from clients_order_process where
> id =241;
> +-+--+---+
> | id  | step | step_description  |
> +-+--+---+
> | 241 |1 | заказ роутера |
> +-+--+---+
> 1 row in set (0,00 sec)
>
>
>
>
>
>
>
>
> вторник, 30 августа 2016 г., 14:37:24 UTC+6 пользователь Sergiy Khohlov
> написал:
>>
>> You are making me confused.
>> 1) Django  send data to db and SQL is correct
>> 2) MySQL returns correct result
>> 3) Django shows right data
>>
>>  Which one step has issue ?
>>
>> Many thanks,
>>
>> Serge
>>
>>
>> +380 636150445
>> skype: skhohlov
>>
>> On Tue, Aug 30, 2016 at 10:51 AM, Denis Yu  wrote:
>>
>>> Yes, i've seen.
>>>
>>> could you pls say one more ideas to check?
>>>
>>>
>>>
>>>
>>> воскресенье, 28 августа 2016 г., 21:11:56 UTC+6 пользователь Sergiy
>>> Khohlov написал:

 I've made mistake : "$" should be in request not "%"

  this request "SELECT COUNT(*) AS `__count` FROM
 `clients_order_process` WHERE (`clients_order_process`.`step` = 1 AND
 `clients_order_process`.`step_description` REGEXP '^заказ роутер.$')"
  informs that django sends data correctly.

 Many thanks,

 Serge


 +380 636150445
 skype: skhohlov

 On Sun, Aug 28, 2016 at 2:18 PM, Denis Yu  wrote:

>
>1. Here is the result in logging table:
>
>
> mysql> select * from mysql.general_log;
> 
> | 2016-08-28 14:14:17.188990 | crm[crm] @ localhost [] |   934 |
>0 | Query| SELECT COUNT(*) AS `__count` FROM
> `clients_order_process` WHERE (`clients_order_process`.`step` = 1 AND
> `clients_order_process`.`step_description` REGEXP '^заказ роутер.$')
> 
>
>
>
>
> the record exists in table:
> mysql> select id, step, step_description from clients_order_process
> where id =241;
> +-+--+---+
> | id  | step | step_description  |
> +-+--+---+
> | 241 |1 | заказ роутера |
> +-+--+---+
> 1 row in set (0,00 sec)
>
>
>
>
>1. the result of query  SELECT id from Order_process WHERE
>step_description REGEXP BINARY '^заказ роутера%'; :
>
>
> mysql>  SELECT id from clients_order_process WHERE step_description
> REGEXP BINARY '^заказ роутера%';
> Empty set (0,00 sec)
>
>
>
> mysql> select * from mysql.general_log;
> ++-+
> ---+---+--+-
> 
> +
> | event_time | user_host   | thread_id |
> server_id | command_type | argument
> |
> ++-+
> ---+---+--+-
> 
> +
> | 2016-08-28 14:18:20.921420 | crm[crm] @ localhost [] |   857 |
>0 | Query| SELECT id from clients_order_process WHERE
> step_description REGEXP BINARY '^заказ роутера%'
>
>
> Pls, explain, what way do you recommend using raw string?
>
>
> thanks
>
>
>
>
> воскресенье, 28 августа 2016 г., 0:58:24 UTC+6 пользователь Sergiy
> Khohlov написал:
>>
>> Not sure that problem is related to character_set_server due to
>> highest priority of create table option.  I'm using postgres as default.
>> I'm proposing to check latin chars and turn on mysql debugging  in case 
>> of
>> your permission.
>>   localization coding  of MySql is  here http://dev.mysql.com/doc
>> /refman/5.7/en/charset-syntax.html
>>  It will be nice to check your sql by using this
>> http://stackoverflow.com/questions/650238/how-to-show-t
>> he-last-queries-executed-on-mysql
>

Re: A tricky query in one to many relationship - atleast for me:)

2016-08-30 Thread Erik Cederstrand
I'm not even sure that's possible to express in SQL, but it would probably be 
quite convoluted if it is. Here's an easier-to-understand solution:

res = set()
for b in B.objects.all().select_related('a').annotate(Max('date_created')):
if b.date_created != b.date_created__max:
continue
if b.text != 'ABCD':
continue
res.add(a)


You'll get too many B objects, but it's only one query. If you want a more 
optimal query, try to write it in SQL first. Maybe it's possible to express in 
the ORM.

I used set() because 'date_created' is not unique so there could be two B 
objects with the same 'a' and 'date_created' values.

Erik


> Den 30. aug. 2016 kl. 08.33 skrev Web Architect :
> 
> Hi,
> 
> I am looking for an elegant and efficient mechanism to have a query filter or 
> a solution for the following one to many relationship model. Please note the 
> following is just an illustration of the models - hope it should provide what 
> I am looking for:
> 
> class A(models.Model):
> name = models.CharField(_("Name"), max_length=255, unique=True)
> 
> 
> class B(models.Model):
> text = models.CharField(_("Text"), max_length=255, unique=True)
> date_created = models.DateTimeField(_("Date Created"), auto_now_add=True) 
>  a = models.ForeignKey(A, related_name='b')
> 
> To get all the instances of B associated with a specific instance of A (say 
> 'a'), I could do the following : a.b.all()
> 
> The latest instance of B associated with 'a' would be : 
> a.b.latest('date_created')
> 
> Now I would like to have a list of all instances of A where the latest 
> instance of B associated with each instance of A will have the 'text' field 
> as 'ABCD'. 
> 
> A.objects.filter(b__text='ABCD') will give all instances of A where each 
> instance of A will have atleast one instance of B with 'text' = 'ABCD'.
> 
> There could be a brute force way of getting a solution for the above where in 
> I can do A.objects.filter(b__text='ABCD')  and then go through each instance  
> of A in a for loop over the queryset and check for the latest instance of B 
> for text='ABCD'.
> 
> As mentioned earlier, I am looking for an elegant and optimal way (if any in 
> Django) for the above query.
> 
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/a9ea312a-578e-4a2f-a739-a38e87a4b15b%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/713734EC-F9E9-4CFC-B024-99DC693421D1%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: iregex doesn't work properly

2016-08-30 Thread Denis Yu

sorry, may be I explained the result of testing incorrectly(
pls let me make another try):

here is the record in log table:
| 2016-08-28 14:14:17.188990 | crm[crm] @ localhost [] |   934 |
 0 | Query| SELECT COUNT(*) AS `__count` FROM 
`clients_order_process` WHERE (`clients_order_process`.`step` = 1 AND 
`clients_order_process`.`step_description` REGEXP '^заказ роутер.$')


Django doesn't return any data. But I'm checking the record in table and it 
exists:

mysql> select id, step, step_description from clients_order_process where 
id =241;
+-+--+---+
| id  | step | step_description  |
+-+--+---+
| 241 |1 | заказ роутера |
+-+--+---+
1 row in set (0,00 sec)








вторник, 30 августа 2016 г., 14:37:24 UTC+6 пользователь Sergiy Khohlov 
написал:
>
> You are making me confused. 
> 1) Django  send data to db and SQL is correct
> 2) MySQL returns correct result
> 3) Django shows right data
>
>  Which one step has issue ? 
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
> On Tue, Aug 30, 2016 at 10:51 AM, Denis Yu  > wrote:
>
>> Yes, i've seen.
>>
>> could you pls say one more ideas to check?
>>
>>
>>
>>
>> воскресенье, 28 августа 2016 г., 21:11:56 UTC+6 пользователь Sergiy 
>> Khohlov написал:
>>>
>>> I've made mistake : "$" should be in request not "%"
>>>
>>>  this request "SELECT COUNT(*) AS `__count` FROM 
>>> `clients_order_process` WHERE (`clients_order_process`.`step` = 1 AND 
>>> `clients_order_process`.`step_description` REGEXP '^заказ роутер.$')" 
>>>  informs that django sends data correctly.
>>>
>>> Many thanks,
>>>
>>> Serge
>>>
>>>
>>> +380 636150445
>>> skype: skhohlov
>>>
>>> On Sun, Aug 28, 2016 at 2:18 PM, Denis Yu  wrote:
>>>

1. Here is the result in logging table:


 mysql> select * from mysql.general_log;
 
 | 2016-08-28 14:14:17.188990 | crm[crm] @ localhost [] |   934 |
  0 | Query| SELECT COUNT(*) AS `__count` FROM 
 `clients_order_process` WHERE (`clients_order_process`.`step` = 1 AND 
 `clients_order_process`.`step_description` REGEXP '^заказ роутер.$')
 




 the record exists in table:
 mysql> select id, step, step_description from clients_order_process 
 where id =241;
 +-+--+---+
 | id  | step | step_description  |
 +-+--+---+
 | 241 |1 | заказ роутера |
 +-+--+---+
 1 row in set (0,00 sec)




1. the result of query  SELECT id from Order_process WHERE 
step_description REGEXP BINARY '^заказ роутера%'; :


 mysql>  SELECT id from clients_order_process WHERE step_description 
 REGEXP BINARY '^заказ роутера%';
 Empty set (0,00 sec)



 mysql> select * from mysql.general_log;

 ++-+---+---+--+-+
 | event_time | user_host   | thread_id | 
 server_id | command_type | argument
 |

 ++-+---+---+--+-+
 | 2016-08-28 14:18:20.921420 | crm[crm] @ localhost [] |   857 |
  0 | Query| SELECT id from clients_order_process WHERE 
 step_description REGEXP BINARY '^заказ роутера%'   


 Pls, explain, what way do you recommend using raw string? 


 thanks




 воскресенье, 28 августа 2016 г., 0:58:24 UTC+6 пользователь Sergiy 
 Khohlov написал:
>
> Not sure that problem is related to character_set_server due to 
> highest priority of create table option.  I'm using postgres as default.  
> I'm proposing to check latin chars and turn on mysql debugging  in case 
> of 
> your permission. 
>   localization coding  of MySql is  here 
> http://dev.mysql.com/doc/refman/5.7/en/charset-syntax.html
>  It will be nice to check your sql by using this 
> http://stackoverflow.com/questions/650238/how-to-show-the-last-queries-executed-on-mysql
>
>
>  At this moment I propose do next : 
> 1)  check log for sql request from django to Mysql 
> 2) execute next sql from mysql :SELECT id from Order_process WHERE 
> step_description REGEXP BINARY '^заказ роутера%';
>
>
>  Why are you not using raw string in your regex ?
>
>
> Many thanks,
>
> Serge
>

Re: iregex doesn't work properly

2016-08-30 Thread Sergiy Khohlov
You are making me confused.
1) Django  send data to db and SQL is correct
2) MySQL returns correct result
3) Django shows right data

 Which one step has issue ?

Many thanks,

Serge


+380 636150445
skype: skhohlov

On Tue, Aug 30, 2016 at 10:51 AM, Denis Yu  wrote:

> Yes, i've seen.
>
> could you pls say one more ideas to check?
>
>
>
>
> воскресенье, 28 августа 2016 г., 21:11:56 UTC+6 пользователь Sergiy
> Khohlov написал:
>>
>> I've made mistake : "$" should be in request not "%"
>>
>>  this request "SELECT COUNT(*) AS `__count` FROM `clients_order_process`
>> WHERE (`clients_order_process`.`step` = 1 AND
>> `clients_order_process`.`step_description` REGEXP '^заказ роутер.$')"
>>  informs that django sends data correctly.
>>
>> Many thanks,
>>
>> Serge
>>
>>
>> +380 636150445
>> skype: skhohlov
>>
>> On Sun, Aug 28, 2016 at 2:18 PM, Denis Yu  wrote:
>>
>>>
>>>1. Here is the result in logging table:
>>>
>>>
>>> mysql> select * from mysql.general_log;
>>> 
>>> | 2016-08-28 14:14:17.188990 | crm[crm] @ localhost [] |   934 |
>>>  0 | Query| SELECT COUNT(*) AS `__count` FROM
>>> `clients_order_process` WHERE (`clients_order_process`.`step` = 1 AND
>>> `clients_order_process`.`step_description` REGEXP '^заказ роутер.$')
>>> 
>>>
>>>
>>>
>>>
>>> the record exists in table:
>>> mysql> select id, step, step_description from clients_order_process
>>> where id =241;
>>> +-+--+---+
>>> | id  | step | step_description  |
>>> +-+--+---+
>>> | 241 |1 | заказ роутера |
>>> +-+--+---+
>>> 1 row in set (0,00 sec)
>>>
>>>
>>>
>>>
>>>1. the result of query  SELECT id from Order_process WHERE
>>>step_description REGEXP BINARY '^заказ роутера%'; :
>>>
>>>
>>> mysql>  SELECT id from clients_order_process WHERE step_description
>>> REGEXP BINARY '^заказ роутера%';
>>> Empty set (0,00 sec)
>>>
>>>
>>>
>>> mysql> select * from mysql.general_log;
>>> ++-+
>>> ---+---+--+-
>>> 
>>> +
>>> | event_time | user_host   | thread_id |
>>> server_id | command_type | argument
>>> |
>>> ++-+
>>> ---+---+--+-
>>> 
>>> +
>>> | 2016-08-28 14:18:20.921420 | crm[crm] @ localhost [] |   857 |
>>>  0 | Query| SELECT id from clients_order_process WHERE
>>> step_description REGEXP BINARY '^заказ роутера%'
>>>
>>>
>>> Pls, explain, what way do you recommend using raw string?
>>>
>>>
>>> thanks
>>>
>>>
>>>
>>>
>>> воскресенье, 28 августа 2016 г., 0:58:24 UTC+6 пользователь Sergiy
>>> Khohlov написал:

 Not sure that problem is related to character_set_server due to highest
 priority of create table option.  I'm using postgres as default.  I'm
 proposing to check latin chars and turn on mysql debugging  in case of your
 permission.
   localization coding  of MySql is  here http://dev.mysql.com/doc
 /refman/5.7/en/charset-syntax.html
  It will be nice to check your sql by using this
 http://stackoverflow.com/questions/650238/how-to-show-t
 he-last-queries-executed-on-mysql


  At this moment I propose do next :
 1)  check log for sql request from django to Mysql
 2) execute next sql from mysql :SELECT id from Order_process WHERE
 step_description REGEXP BINARY '^заказ роутера%';


  Why are you not using raw string in your regex ?


 Many thanks,

 Serge


 +380 636150445
 skype: skhohlov

 On Sat, Aug 27, 2016 at 8:13 PM, Denis Yu  wrote:

> Sergiy,
>
> Thank you for reply
>
> I checked following parameters:
>
> mysql> show create table clients_order_process; (clients_order_process
> - it's my table)
>
> | clients_order_process | CREATE TABLE `clients_order_process` (
>   `id` int(11) NOT NULL AUTO_INCREMENT,
>   `step` int(11) NOT NULL,
>   `step_description` longtext NOT NULL,
>   `date_step` datetime NOT NULL,
>   `order_id` int(11) NOT NULL,
>   `manager_id` int(11),
>   PRIMARY KEY (`id`),
>   KEY `clients_order_proces_order_id_1eb697bf_fk_clients_order_id`
> (`order_id`),
>   KEY `clients_order_process_8784215c` (`manager_id`),
>   CONSTRAINT `clients_order_proces_order_id_1eb697bf_fk_clients_order_id`
> FOREIGN KEY (`order_id`) REFERENCES `clients_order` (`id`),
>   CONSTRAINT `clients_order_process_manager_id_f3e3fa60_fk_auth_user_id`
> FOREIGN KEY (`manager_id`) REFERENCES `auth_user` (`id`)
> ) ENGINE=In

Re: iregex doesn't work properly

2016-08-30 Thread Denis Yu
Yes, i've seen.

could you pls say one more ideas to check?




воскресенье, 28 августа 2016 г., 21:11:56 UTC+6 пользователь Sergiy Khohlov 
написал:
>
> I've made mistake : "$" should be in request not "%"
>
>  this request "SELECT COUNT(*) AS `__count` FROM `clients_order_process` 
> WHERE (`clients_order_process`.`step` = 1 AND 
> `clients_order_process`.`step_description` REGEXP '^заказ роутер.$')" 
>  informs that django sends data correctly.
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
> On Sun, Aug 28, 2016 at 2:18 PM, Denis Yu  > wrote:
>
>>
>>1. Here is the result in logging table:
>>
>>
>> mysql> select * from mysql.general_log;
>> 
>> | 2016-08-28 14:14:17.188990 | crm[crm] @ localhost [] |   934 |  
>>0 | Query| SELECT COUNT(*) AS `__count` FROM 
>> `clients_order_process` WHERE (`clients_order_process`.`step` = 1 AND 
>> `clients_order_process`.`step_description` REGEXP '^заказ роутер.$')
>> 
>>
>>
>>
>>
>> the record exists in table:
>> mysql> select id, step, step_description from clients_order_process where 
>> id =241;
>> +-+--+---+
>> | id  | step | step_description  |
>> +-+--+---+
>> | 241 |1 | заказ роутера |
>> +-+--+---+
>> 1 row in set (0,00 sec)
>>
>>
>>
>>
>>1. the result of query  SELECT id from Order_process WHERE 
>>step_description REGEXP BINARY '^заказ роутера%'; :
>>
>>
>> mysql>  SELECT id from clients_order_process WHERE step_description 
>> REGEXP BINARY '^заказ роутера%';
>> Empty set (0,00 sec)
>>
>>
>>
>> mysql> select * from mysql.general_log;
>>
>> ++-+---+---+--+-+
>> | event_time | user_host   | thread_id | 
>> server_id | command_type | argument
>> |
>>
>> ++-+---+---+--+-+
>> | 2016-08-28 14:18:20.921420 | crm[crm] @ localhost [] |   857 |  
>>0 | Query| SELECT id from clients_order_process WHERE 
>> step_description REGEXP BINARY '^заказ роутера%'   
>>
>>
>> Pls, explain, what way do you recommend using raw string? 
>>
>>
>> thanks
>>
>>
>>
>>
>> воскресенье, 28 августа 2016 г., 0:58:24 UTC+6 пользователь Sergiy 
>> Khohlov написал:
>>>
>>> Not sure that problem is related to character_set_server due to highest 
>>> priority of create table option.  I'm using postgres as default.  I'm 
>>> proposing to check latin chars and turn on mysql debugging  in case of your 
>>> permission. 
>>>   localization coding  of MySql is  here 
>>> http://dev.mysql.com/doc/refman/5.7/en/charset-syntax.html
>>>  It will be nice to check your sql by using this 
>>> http://stackoverflow.com/questions/650238/how-to-show-the-last-queries-executed-on-mysql
>>>
>>>
>>>  At this moment I propose do next : 
>>> 1)  check log for sql request from django to Mysql 
>>> 2) execute next sql from mysql :SELECT id from Order_process WHERE 
>>> step_description REGEXP BINARY '^заказ роутера%';
>>>
>>>
>>>  Why are you not using raw string in your regex ?
>>>
>>>
>>> Many thanks,
>>>
>>> Serge
>>>
>>>
>>> +380 636150445
>>> skype: skhohlov
>>>
>>> On Sat, Aug 27, 2016 at 8:13 PM, Denis Yu  wrote:
>>>
 Sergiy,

 Thank you for reply

 I checked following parameters:

 mysql> show create table clients_order_process; (clients_order_process 
 - it's my table)

 | clients_order_process | CREATE TABLE `clients_order_process` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `step` int(11) NOT NULL,
   `step_description` longtext NOT NULL,
   `date_step` datetime NOT NULL,
   `order_id` int(11) NOT NULL,
   `manager_id` int(11),
   PRIMARY KEY (`id`),
   KEY `clients_order_proces_order_id_1eb697bf_fk_clients_order_id` 
 (`order_id`),
   KEY `clients_order_process_8784215c` (`manager_id`),
   CONSTRAINT 
 `clients_order_proces_order_id_1eb697bf_fk_clients_order_id` FOREIGN KEY 
 (`order_id`) REFERENCES `clients_order` (`id`),
   CONSTRAINT 
 `clients_order_process_manager_id_f3e3fa60_fk_auth_user_id` FOREIGN KEY 
 (`manager_id`) REFERENCES `auth_user` (`id`)
 ) ENGINE=InnoDB AUTO_INCREMENT=249 DEFAULT CHARSET=utf8 |


 mysql> show variables like 'character_set%';
 +--++
 | Variable_name| Value  |
 +--++
 | character_set_client | utf8

Oracle Client Identifier

2016-08-30 Thread nisi242424
Hi Expert,

Oracle has the feature that it notifies application user id to connected
database session like this.

https://oracle-base.com/articles/misc/dbms_session#client_identifier

We could realize it for a new connection in Python, for example,

cursor = connection.cursor()
cursor.callproc('dbms_session.
set_identifier',['client_id'])
cursor.execute("SELECT * FROM EMP ORDER BY EMPNO")

I want to set client identifier to the connection used by Django data
model. Is it possible? I would appreciate it if you could give me any idea.

Thanks,
Katsuya

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/567e9b5f-ab8c-4375-8f1d-a99e5c1494db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A tricky query in one to many relationship - atleast for me:)

2016-08-30 Thread Web Architect
Hi Mike,

Thanks for your response. 

I am aware of chaining filters.

The latest() API in django queryset returns an object and not a queryset. 
Hence, I cannot add a filter to it. 

I had thought about using chaining filters but couldn't find a way.

On Tuesday, August 30, 2016 at 12:18:56 PM UTC+5:30, Mike Dewhirst wrote:
>
> On 30/08/2016 4:33 PM, Web Architect wrote: 
> > Hi, 
> > 
> > I am looking for an elegant and efficient mechanism to have a query 
> > filter or a solution for the following one to many relationship model. 
> > Please note the following is just an illustration of the models - hope 
> > it should provide what I am looking for: 
> > 
> > class A(models.Model): 
> > 
> > name = models.CharField(_("Name"), max_length=255, unique=True) 
> > 
> > 
> > class B(models.Model): 
> > 
> > text = models.CharField(_("Text"), max_length=255, unique=True) 
> > 
> > date_created = models.DateTimeField(_("Date Created"), 
> > auto_now_add=True)Â 
> > 
> > Â a =Â models.ForeignKey(A, related_name='b') 
> > 
> > 
> > To get all the instances of B associated with a specific instance of A 
> > (say 'a'), I could do the following : a.b.all() 
> > 
> > The latest instance of B associated with 'a' would be : 
> > a.b.latest('date_created') 
> > 
> > Now I would like to have a list of all instances of A where the latest 
> > instance of B associated with each instance of A will have the 'text' 
> > field as 'ABCD'. 
> > 
> > A.objects.filter(b__text='ABCD') will give all instances of A where 
> > each instance of A will have atleast one instance of B with 'text' = 
> > 'ABCD'. 
> > 
> > There could be a brute force way of getting a solution for the above 
> > where in I can do A.objects.filter(b__text='ABCD') Â and then go 
> > through each instance  of A in a for loop over the queryset and check 
> > for the latest instance of B for text='ABCD'. 
>
> HAve you looked at ... 
>
> https://docs.djangoproject.com/en/1.8/topics/db/queries/#chaining-filters 
>
>
> > 
> > As mentioned earlier, I am looking for an elegant and optimal way (if 
> > any in Django) for the above query. 
> > 
> > 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...@googlegroups.com  
> > . 
> > To post to this group, send email to django...@googlegroups.com 
>  
> > . 
> > Visit this group at https://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/a9ea312a-578e-4a2f-a739-a38e87a4b15b%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/django-users/a9ea312a-578e-4a2f-a739-a38e87a4b15b%40googlegroups.com?utm_medium=email&utm_source=footer>.
>  
>
> > 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/508c9991-7d21-4583-82e5-1abea0584511%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.