Re: HTML video seek problem in django

2018-01-18 Thread Manjunatha
Hi Jason,

Thanks for your suggestion. I found a solution for the Video seek problem 
in django.
Make some changes in *django/views/static.py. *
*follow this link* : 
https://github.com/satchamo/django/commit/2ce75c5c4bee2a858c0214d136bfcd351fcde11d#diff-272f1bbef1bc0bce0b959da83acb366d

Regards,
Manjunatha


On Thursday, 11 January 2018 18:43:16 UTC+5:30, Jason wrote:
>
> An alternative is to use the django extensions runserverplus 
>  which 
> uses the Werkzeug debugger.  As you can see in this post on 
> django-developers 
> ,
>  
> this is used as an alternative.
>
> Regardless, I think the primary issue is you're serving the content in an 
> inappropriate manner.  Django should be used for dynamic requests, and 
> static files should be handled by an Apache or Nginx webserver that serves 
> up the static files and passes the dynamic requests to Django via mod_wsgi 
> or Gunicorn.
>

-- 
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/304d6edc-32ac-4669-8098-f29d30f182af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


unique_together does not work in django 2.0

2018-01-18 Thread FernandoJMM
Hello,
I have the following class:

==
class Silo(models.Model):
nave = models.ForeignKey(Nave, on_delete=models.CASCADE)
codSil = models.CharField(
'Código Silo', db_index=True, max_length=2, default='01')
notas = models.TextField(null=True, blank=True)

def __str__(self):
return "%s %s" % (self.nave, self.codSil)

class Meta:
order_with_respect_to = 'nave'
unique_together = ('nave', 'codSil')


But the option unique_together does not work because duplicate values 
​​exist in the SQLite database for nave and codSil.

To solve it, I have to create the index nave + codSil by hand in the SQLite 
database ???

Thank you

-- 
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/555b1903-b6f5-4af1-b7a2-a7921d1fdbac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: emulate desktop multi-windows

2018-01-18 Thread johnf
I believe I understand what you are saying.  But I was hoping that 
Django offered the javascript framework that allowed multi-windows.  To 
get what I want I will have to use a javascript framework - I 
understand.  But that said, I have been researching several of the 
javascript frameworks and they do in fact allow new tabs (using 
chrome).  Example: google mail will allow multi-pages (actually tabs) of 
contacts just with multi clicks on the GMAIL dropdown.  But that wasn't 
what I was hoping for - I want individual windows/forms that I can 
resize, move, Max, Min, etc... So far the only thing I have found was 
the electron  app I spoke about earlier.  The electron framework allowed 
windows that can be resized, moved about the screen, and closed.  I am 
still researching but so far only Electron.  BTW the Electron is really 
a desktop app using web tools (css, html, javascript, and nodejs).  I'm 
guessing (mostly from your emails) that there are javascript frameworks 
that will allow what I looking for - I  just haven't found it YET!


Johnf


On 01/18/2018 11:12 AM, Andréas Kühne wrote:

No John,

I don't think you understand what we are saying :-)

Like I said earlier - Django is a HTML framework - like ALL HTML 
framework, it renders the pages you are seeing on the backend and 
presents the information to the user. That is per design in the HTML 
world. You click on a link and then the server renders a new page and 
so on. There is no way to add "windows" in any other way than to open 
a new browser. That is the way HTML works.


If you want to add a fancy single page application (which is what you 
are suggesting) then the only way to do so is to use a Javascript 
framework of some kind. What that does is to add the ability to do 
windows and the like - just in the way you want to do it - and that is 
still within the "web UI wold". If you look at things like the google 
cloud engine interface or gmail or the amazon AWS interface, that is 
all done on the web, with a web UI. However all of those pages REQUIRE 
javascript to function.


So it is often requested and I am currently working on a single page 
application that uses django for the backend, but HTML cannot render 
the single page application - that is done in a javascript framework. 
So web UI is completely on par with a desktop application but it 
requires more components that you are willing to use :-)


Regards,

Andréas

2018-01-18 19:26 GMT+01:00 johnf >:


The reason I wanted Django was to insure that the data is valid
(using python).   When they enter the data and the submit button
is clicked I want to be able to modify the response using python.

So what I'm hearing from the list - is that in general - people
are not using the Django template system.  Is that right?

I have been doing a little research and have discovered a couple
of javascript tools that allow multi -
windows/forms/dialogs/frames.   But then - like you said - I'm
replacing the Django template system.

It seems that web UI is still not up to the desktop abilities. 
That's not good.  BTW I was looking at Electron and discovered
that it can easily match the desktop multi-window and it's using
web tech.  So I'm guessing it is possible but not often requested.

Johnf


On 01/18/2018 09:48 AM, Andréas Kühne wrote:

Hi,

I think you are not thinking this completely through correctly.

Django is a framework used to generate HTML pages. HTML pages
render one page at a time in one webbrowser window. That is the
way HTML works.

You can via javascript do some funky things, like Single page
applications - but then most of the templating engine in django
isn't used. You could create templates on the backend and send
them via ajax to the frontend but that is mainly used for
rendering partial pages and not for complete pages. Also, it
would be really cumbersome to write the code.

If you already have a REST backend, why do you need django at
all? Django isn't the best framework for getting information from
a REST API and then publishing the information. You really should
be looking into running a single page application in that case...

Django can be used to create a REST backend for the single page
application however.

Regards,

Andréas

2018-01-18 17:25 GMT+01:00 johnf >:

I have the backend covered with REST.   When I try to google
hybrid google comes up with hybrid mobile apps.  I did find
fragment.js but I don't see any type of real information on
how to use it.   I did find some info on javascript and
multi-windows but here again it looks like it wants to
replace the template system that Django uses.

It just seems to me that this issue must have come up in the

Re: emulate desktop multi-windows

2018-01-18 Thread Karol Bujaček



On 01/18/2018 05:25 PM, johnf wrote:


I have the backend covered with REST.   When I try to google hybrid 
google comes up with hybrid mobile apps.  I did find fragment.js but I 
don't see any type of real information on how to use it.   I did find 
some info on javascript and multi-windows but here again it looks like 
it wants to replace the template system that Django uses.


It just seems to me that this issue must have come up in the past.  
There must be a solution provided by Django without replacing parts of 
the Django framework


Johnf



Dear Johnf,

You can also take a look at django-jstemplate at 
. From their page:


   A templatetag framework for easier integration of mustache.js
   , dust.js
   , handlebars.js
   , or other JavaScript templates with
   Django templates.


Best regards,
Karol

--
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/0e0a3f5c-5177-d3ec-5501-486b431de837%40fossilgroup.net.
For more options, visit https://groups.google.com/d/optout.


Re: emulate desktop multi-windows

2018-01-18 Thread Andréas Kühne
No John,

I don't think you understand what we are saying :-)

Like I said earlier - Django is a HTML framework - like ALL HTML framework,
it renders the pages you are seeing on the backend and presents the
information to the user. That is per design in the HTML world. You click on
a link and then the server renders a new page and so on. There is no way to
add "windows" in any other way than to open a new browser. That is the way
HTML works.

If you want to add a fancy single page application (which  is what you are
suggesting) then the only way to do so is to use a Javascript framework of
some kind. What that does is to add the ability to do windows and the like
- just in the way you want to do it - and that is still within the "web UI
wold". If you look at things like the google cloud engine interface or
gmail or the amazon AWS interface, that is all done on the web, with a web
UI. However all of those pages REQUIRE javascript to function.

So it is often requested and I am currently working on a single page
application that uses django for the backend, but HTML cannot render the
single page application - that is done in a javascript framework. So web UI
is completely on par with a desktop application but it requires more
components that you are willing to use :-)

Regards,

Andréas

2018-01-18 19:26 GMT+01:00 johnf :

> The reason I wanted Django was to insure that the data is valid (using
> python).   When they enter the data and the submit button is clicked I want
> to be able to modify the response using python.
>
> So what I'm hearing from the list - is that in general - people are not
> using the Django template system.  Is that right?
>
> I have been doing a little research and have discovered a couple of
> javascript tools that allow multi - windows/forms/dialogs/frames.   But
> then - like you said - I'm replacing the Django template system.
>
> It seems that web UI is still not up to the desktop abilities.  That's not
> good.  BTW I was looking at Electron and discovered that it can easily
> match the desktop multi-window and it's using web tech.  So I'm guessing it
> is possible but not often requested.
>
> Johnf
>
> On 01/18/2018 09:48 AM, Andréas Kühne wrote:
>
> Hi,
>
> I think you are not thinking this completely through correctly.
>
> Django is a framework used to generate HTML pages. HTML pages render one
> page at a time in one webbrowser window. That is the way HTML works.
>
> You can via javascript do some funky things, like Single page applications
> - but then most of the templating engine in django isn't used. You could
> create templates on the backend and send them via ajax to the frontend but
> that is mainly used for rendering partial pages and not for complete pages.
> Also, it would be really cumbersome to write the code.
>
> If you already have a REST backend, why do you need django at all? Django
> isn't the best framework for getting information from a REST API and then
> publishing the information. You really should be looking into running a
> single page application in that case...
>
> Django can be used to create a REST backend for the single page
> application however.
>
> Regards,
>
> Andréas
>
> 2018-01-18 17:25 GMT+01:00 johnf :
>
>> I have the backend covered with REST.   When I try to google hybrid
>> google comes up with hybrid mobile apps.  I did find fragment.js but I
>> don't see any type of real information on how to use it.   I did find some
>> info on javascript and multi-windows but here again it looks like it wants
>> to replace the template system that Django uses.
>>
>> It just seems to me that this issue must have come up in the past.  There
>> must be a solution provided by Django without replacing parts of the Django
>> framework
>>
>> Johnf
>>
>> On 01/18/2018 06:22 AM, Jani Tiainen wrote:
>>
>> Hi.
>>
>> Yes and no. Usually you do SPA, a single page application, that just
>> talks to backend, Django in this case, using some means. REST api and JSON
>> data is quite common.
>>
>> So basically you need only one template that fires up rest of your
>> interface.
>>
>> There are though alternative approaches like using hybrid of JS library
>> to request HTML fragments and render them using JS. Fragments then are
>> generated using templates.
>>
>> 18.1.2018 15.46 "johnf"  kirjoitti:
>>
>> But doesn't Django provide the template system?  Do you replace the
>> template system with DoyuoToolkit?
>>
>> Johnf
>>
>>
>>
>> On 01/18/2018 05:43 AM, Jani Tiainen wrote:
>>
>>> Hi,
>>>
>>> This actually doesn't have anything to do with Django, but frontend.
>>> Basically you need to pick some Javascript UI framework that supports
>>> features you're after.
>>>
>>> Personally I've only used Dojotoolkit (free, nicely licensed) and ExtJS
>>> (commercial).
>>>
>>> On 18.1.2018 15.07, johnf wrote:
>>>
 Hi,

 I have a desktop CRUD application that allows the same form to be
 opened 

Re: emulate desktop multi-windows

2018-01-18 Thread johnf
The reason I wanted Django was to insure that the data is valid (using 
python).   When they enter the data and the submit button is clicked I 
want to be able to modify the response using python.


So what I'm hearing from the list - is that in general - people are not 
using the Django template system.  Is that right?


I have been doing a little research and have discovered a couple of 
javascript tools that allow multi - windows/forms/dialogs/frames.   But 
then - like you said - I'm replacing the Django template system.


It seems that web UI is still not up to the desktop abilities. That's 
not good.  BTW I was looking at Electron and discovered that it can 
easily match the desktop multi-window and it's using web tech.  So I'm 
guessing it is possible but not often requested.


Johnf


On 01/18/2018 09:48 AM, Andréas Kühne wrote:

Hi,

I think you are not thinking this completely through correctly.

Django is a framework used to generate HTML pages. HTML pages render 
one page at a time in one webbrowser window. That is the way HTML works.


You can via javascript do some funky things, like Single page 
applications - but then most of the templating engine in django isn't 
used. You could create templates on the backend and send them via ajax 
to the frontend but that is mainly used for rendering partial pages 
and not for complete pages. Also, it would be really cumbersome to 
write the code.


If you already have a REST backend, why do you need django at all? 
Django isn't the best framework for getting information from a REST 
API and then publishing the information. You really should be looking 
into running a single page application in that case...


Django can be used to create a REST backend for the single page 
application however.


Regards,

Andréas

2018-01-18 17:25 GMT+01:00 johnf >:


I have the backend covered with REST.   When I try to google
hybrid google comes up with hybrid mobile apps.  I did find
fragment.js but I don't see any type of real information on how to
use it.   I did find some info on javascript and multi-windows but
here again it looks like it wants to replace the template system
that Django uses.

It just seems to me that this issue must have come up in the
past.  There must be a solution provided by Django without
replacing parts of the Django framework

Johnf


On 01/18/2018 06:22 AM, Jani Tiainen wrote:

Hi.

Yes and no. Usually you do SPA, a single page application, that
just talks to backend, Django in this case, using some means.
REST api and JSON data is quite common.

So basically you need only one template that fires up rest of
your interface.

There are though alternative approaches like using hybrid of JS
library to request HTML fragments and render them using JS.
Fragments then are generated using templates.

18.1.2018 15.46 "johnf" > kirjoitti:

But doesn't Django provide the template system?  Do you
replace the template system with DoyuoToolkit?

Johnf



On 01/18/2018 05:43 AM, Jani Tiainen wrote:

Hi,

This actually doesn't have anything to do with Django,
but frontend. Basically you need to pick some Javascript
UI framework that supports features you're after.

Personally I've only used Dojotoolkit (free, nicely
licensed) and ExtJS (commercial).

On 18.1.2018 15.07, johnf wrote:

Hi,

I have a desktop CRUD application that allows the
same form to be opened many times.  Example: I can
open a customer's (A) record in one window/form and
then from the first window/form (customer A's) open a
second or third window to process customer B or
customer C etc... all without closing any of the
windows/forms. IOW I can have many windows open at
the same time all using the same form with different
customer records.

How can I do this with Django?  I would like to
replace the desktop app with a web app using Django.


Johnf



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

Re: emulate desktop multi-windows

2018-01-18 Thread Andréas Kühne
Hi,

I think you are not thinking this completely through correctly.

Django is a framework used to generate HTML pages. HTML pages render one
page at a time in one webbrowser window. That is the way HTML works.

You can via javascript do some funky things, like Single page applications
- but then most of the templating engine in django isn't used. You could
create templates on the backend and send them via ajax to the frontend but
that is mainly used for rendering partial pages and not for complete pages.
Also, it would be really cumbersome to write the code.

If you already have a REST backend, why do you need django at all? Django
isn't the best framework for getting information from a REST API and then
publishing the information. You really should be looking into running a
single page application in that case...

Django can be used to create a REST backend for the single page application
however.

Regards,

Andréas

2018-01-18 17:25 GMT+01:00 johnf :

> I have the backend covered with REST.   When I try to google hybrid google
> comes up with hybrid mobile apps.  I did find fragment.js but I don't see
> any type of real information on how to use it.   I did find some info on
> javascript and multi-windows but here again it looks like it wants to
> replace the template system that Django uses.
>
> It just seems to me that this issue must have come up in the past.  There
> must be a solution provided by Django without replacing parts of the Django
> framework
>
> Johnf
>
> On 01/18/2018 06:22 AM, Jani Tiainen wrote:
>
> Hi.
>
> Yes and no. Usually you do SPA, a single page application, that just talks
> to backend, Django in this case, using some means. REST api and JSON data
> is quite common.
>
> So basically you need only one template that fires up rest of your
> interface.
>
> There are though alternative approaches like using hybrid of JS library to
> request HTML fragments and render them using JS. Fragments then are
> generated using templates.
>
> 18.1.2018 15.46 "johnf"  kirjoitti:
>
> But doesn't Django provide the template system?  Do you replace the
> template system with DoyuoToolkit?
>
> Johnf
>
>
>
> On 01/18/2018 05:43 AM, Jani Tiainen wrote:
>
>> Hi,
>>
>> This actually doesn't have anything to do with Django, but frontend.
>> Basically you need to pick some Javascript UI framework that supports
>> features you're after.
>>
>> Personally I've only used Dojotoolkit (free, nicely licensed) and ExtJS
>> (commercial).
>>
>> On 18.1.2018 15.07, johnf wrote:
>>
>>> Hi,
>>>
>>> I have a desktop CRUD application that allows the same form to be opened
>>> many times.  Example: I can open a customer's (A) record in one window/form
>>> and then from the first window/form (customer A's) open a second or third
>>> window to process customer B or customer C etc... all without closing any
>>> of the windows/forms.  IOW I can have many windows open at the same time
>>> all using the same form with different customer records.
>>>
>>> How can I do this with Django?  I would like to replace the desktop app
>>> with a web app using Django.
>>>
>>>
>>> Johnf
>>>
>>>
>>
> --
> 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/498b306e-72ae-ccc7-9e40-ec47c18082f8%40jfcomputer.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/CAHn91ofZjaRdNntVNGqf3EQwDDebE
> 3umWqM6qqwDf-Z4RSsa0w%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/
> 

Re: emulate desktop multi-windows

2018-01-18 Thread johnf
I have the backend covered with REST.   When I try to google hybrid 
google comes up with hybrid mobile apps.  I did find fragment.js but I 
don't see any type of real information on how to use it.   I did find 
some info on javascript and multi-windows but here again it looks like 
it wants to replace the template system that Django uses.


It just seems to me that this issue must have come up in the past.  
There must be a solution provided by Django without replacing parts of 
the Django framework


Johnf


On 01/18/2018 06:22 AM, Jani Tiainen wrote:

Hi.

Yes and no. Usually you do SPA, a single page application, that just 
talks to backend, Django in this case, using some means. REST api and 
JSON data is quite common.


So basically you need only one template that fires up rest of your 
interface.


There are though alternative approaches like using hybrid of JS 
library to request HTML fragments and render them using JS. Fragments 
then are generated using templates.


18.1.2018 15.46 "johnf" > kirjoitti:


But doesn't Django provide the template system?  Do you replace
the template system with DoyuoToolkit?

Johnf



On 01/18/2018 05:43 AM, Jani Tiainen wrote:

Hi,

This actually doesn't have anything to do with Django, but
frontend. Basically you need to pick some Javascript UI
framework that supports features you're after.

Personally I've only used Dojotoolkit (free, nicely licensed)
and ExtJS (commercial).

On 18.1.2018 15.07, johnf wrote:

Hi,

I have a desktop CRUD application that allows the same
form to be opened many times.  Example: I can open a
customer's (A) record in one window/form and then from the
first window/form (customer A's) open a second or third
window to process customer B or customer C etc... all
without closing any of the windows/forms. IOW I can have
many windows open at the same time all using the same form
with different customer records.

How can I do this with Django?  I would like to replace
the desktop app with a web app using Django.


Johnf



-- 
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/498b306e-72ae-ccc7-9e40-ec47c18082f8%40jfcomputer.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/CAHn91ofZjaRdNntVNGqf3EQwDDebE3umWqM6qqwDf-Z4RSsa0w%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/7449fab6-b78a-bfd6-3003-dcaf0fb34827%40jfcomputer.com.
For more options, visit https://groups.google.com/d/optout.


Re: emulate desktop multi-windows

2018-01-18 Thread Jani Tiainen
Hi.

Yes and no. Usually you do SPA, a single page application, that just talks
to backend, Django in this case, using some means. REST api and JSON data
is quite common.

So basically you need only one template that fires up rest of your
interface.

There are though alternative approaches like using hybrid of JS library to
request HTML fragments and render them using JS. Fragments then are
generated using templates.

18.1.2018 15.46 "johnf"  kirjoitti:

But doesn't Django provide the template system?  Do you replace the
template system with DoyuoToolkit?

Johnf



On 01/18/2018 05:43 AM, Jani Tiainen wrote:

> Hi,
>
> This actually doesn't have anything to do with Django, but frontend.
> Basically you need to pick some Javascript UI framework that supports
> features you're after.
>
> Personally I've only used Dojotoolkit (free, nicely licensed) and ExtJS
> (commercial).
>
> On 18.1.2018 15.07, johnf wrote:
>
>> Hi,
>>
>> I have a desktop CRUD application that allows the same form to be opened
>> many times.  Example: I can open a customer's (A) record in one window/form
>> and then from the first window/form (customer A's) open a second or third
>> window to process customer B or customer C etc... all without closing any
>> of the windows/forms.  IOW I can have many windows open at the same time
>> all using the same form with different customer records.
>>
>> How can I do this with Django?  I would like to replace the desktop app
>> with a web app using Django.
>>
>>
>> Johnf
>>
>>
>
-- 
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/498b306e-72ae-ccc7-9e40-ec47c18082f8%40jfcomputer.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/CAHn91ofZjaRdNntVNGqf3EQwDDebE3umWqM6qqwDf-Z4RSsa0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reporting unwanted behaviours

2018-01-18 Thread Murat Sert
Hi,

I don't think a package is neccesary for this (or at least I haven't 
researched it) but from a very abstract perspective, inside the posts have 
a boolean reported field, then you can render a button next to each post 
and then when users click on it, you mark it as it is being reported. Then 
implement the neccesary admin logic. Thats it.

Regards

Murat

On Thursday, January 18, 2018 at 7:25:30 AM UTC, Kubilay Yazoğlu wrote:
>
> Hi. I want to implement a reporting system in which users report a post 
> simply by clicking the report button and later on, admins check it whether 
> the post is really against the policy of the website. However, when I make 
> a research about Django Reporting Systems, the results are not related to 
> this. I was not able to express myself clearly.
>
> So, is there any package I can use? Any tutorials I can follow? Anything 
> about this?
>

-- 
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/2c5952aa-5126-40e3-9807-67986b7e9d26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: emulate desktop multi-windows

2018-01-18 Thread johnf
But doesn't Django provide the template system?  Do you replace the 
template system with DoyuoToolkit?


Johnf


On 01/18/2018 05:43 AM, Jani Tiainen wrote:

Hi,

This actually doesn't have anything to do with Django, but frontend. 
Basically you need to pick some Javascript UI framework that supports 
features you're after.


Personally I've only used Dojotoolkit (free, nicely licensed) and 
ExtJS (commercial).


On 18.1.2018 15.07, johnf wrote:

Hi,

I have a desktop CRUD application that allows the same form to be 
opened many times.  Example: I can open a customer's (A) record in 
one window/form and then from the first window/form (customer A's) 
open a second or third window to process customer B or customer C 
etc... all without closing any of the windows/forms.  IOW I can have 
many windows open at the same time all using the same form with 
different customer records.


How can I do this with Django?  I would like to replace the desktop 
app with a web app using Django.



Johnf





--
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/498b306e-72ae-ccc7-9e40-ec47c18082f8%40jfcomputer.com.
For more options, visit https://groups.google.com/d/optout.


Re: emulate desktop multi-windows

2018-01-18 Thread johnf

Doesn't opening a new browser window imply using lots of memory?

Johnf


On 01/18/2018 05:11 AM, Andréas Kühne wrote:

Hi,

You would have to either write a single page application that handles 
the window creations (to make it more like an application). But the 
standard way would just to open a new browser window - You can use the 
target property on an a tag (for the link to the customer) to open a 
new page each time (target="_blank").


Regards,

Andréas

2018-01-18 14:07 GMT+01:00 johnf >:


Hi,

I have a desktop CRUD application that allows the same form to be
opened many times.  Example: I can open a customer's (A) record in
one window/form and then from the first window/form (customer A's)
open a second or third window to process customer B or customer C
etc... all without closing any of the windows/forms.  IOW I can
have many windows open at the same time all using the same form
with different customer records.

How can I do this with Django?  I would like to replace the
desktop app with a web app using Django.


Johnf

-- 
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/497247eb-313a-c0e6-0d1b-f10ece876f10%40jfcomputer.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/CAK4qSCccE9WsdQ4p3WiVQtix8SFGk6a4r%3D7XnbLgVAQmmWjABw%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/10457f9b-0045-b364-9e73-b28cc92578e3%40jfcomputer.com.
For more options, visit https://groups.google.com/d/optout.


Re: emulate desktop multi-windows

2018-01-18 Thread Jani Tiainen

Hi,

This actually doesn't have anything to do with Django, but frontend. 
Basically you need to pick some Javascript UI framework that supports 
features you're after.


Personally I've only used Dojotoolkit (free, nicely licensed) and ExtJS 
(commercial).


On 18.1.2018 15.07, johnf wrote:

Hi,

I have a desktop CRUD application that allows the same form to be 
opened many times.  Example: I can open a customer's (A) record in one 
window/form and then from the first window/form (customer A's) open a 
second or third window to process customer B or customer C etc... all 
without closing any of the windows/forms.  IOW I can have many windows 
open at the same time all using the same form with different customer 
records.


How can I do this with Django?  I would like to replace the desktop 
app with a web app using Django.



Johnf



--
Jani Tiainen

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


DJANGO timezone.now is diffefent to datetime.now after we set the timezone config in setting.py

2018-01-18 Thread Lau Louis
Hi 

I am confused about the timezone setting. I have my OS timezone set to 
'Asia/Shanghai', and my MYSQL/Mariadb is also using 'Asia/Shanghai' 
timezone. So i tried to configure the timezone in DJANGO settings.py

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Shanghai'

USE_I18N = True

USE_L10N = True

USE_TZ = True


And then i aware that after setting this, the time used in the models.py 
auto_now=True seems to be incorrect. but when i use datetime.datetime.now() 
the time should be correct, so i use the manage.py shell to check.

Below is the checking result

>>> timezone.get_current_timezone()

>>> timezone.now()
datetime.datetime(2018, 1, 18, 10, 11, 0, 936572, tzinfo=)
>>> datetime.datetime.now()
datetime.datetime(2018, 1, 18, 18, 20, 23, 722825)
>>>


Seems that the timezone.get_current_timezone has returned the right 
"Asia/Shanghai' timezone, but when i run timezone.now(), it is using UTC 
time, and when i use datetime.datetime.now(), it is using the correct time.

So it is quite weird behavoir. Can someone tell me if this is a bug or i 
had missed out some setting?

Louis

-- 
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/4086e2ee-f119-4278-911b-ce73d1bf1217%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: emulate desktop multi-windows

2018-01-18 Thread Andréas Kühne
Hi,

You would have to either write a single page application that handles the
window creations (to make it more like an application). But the standard
way would just to open a new browser window - You can use the target
property on an a tag (for the link to the customer) to open a new page each
time (target="_blank").

Regards,

Andréas

2018-01-18 14:07 GMT+01:00 johnf :

> Hi,
>
> I have a desktop CRUD application that allows the same form to be opened
> many times.  Example: I can open a customer's (A) record in one window/form
> and then from the first window/form (customer A's) open a second or third
> window to process customer B or customer C etc... all without closing any
> of the windows/forms.  IOW I can have many windows open at the same time
> all using the same form with different customer records.
>
> How can I do this with Django?  I would like to replace the desktop app
> with a web app using Django.
>
>
> Johnf
>
> --
> 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/497247eb-313a-c0e6-0d1b-f10ece876f10%40jfcomputer.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/CAK4qSCccE9WsdQ4p3WiVQtix8SFGk6a4r%3D7XnbLgVAQmmWjABw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


emulate desktop multi-windows

2018-01-18 Thread johnf

Hi,

I have a desktop CRUD application that allows the same form to be opened 
many times.  Example: I can open a customer's (A) record in one 
window/form and then from the first window/form (customer A's) open a 
second or third window to process customer B or customer C etc... all 
without closing any of the windows/forms.  IOW I can have many windows 
open at the same time all using the same form with different customer 
records.


How can I do this with Django?  I would like to replace the desktop app 
with a web app using Django.



Johnf

--
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/497247eb-313a-c0e6-0d1b-f10ece876f10%40jfcomputer.com.
For more options, visit https://groups.google.com/d/optout.


RequestContext instance passed to simpletag ?

2018-01-18 Thread Murat Sert
Hey,

I'm working on upgrading to Django 1.11 and have encountered an issue with 
simple_tags making use of context. I need to access the context within the 
tag so declare the decorator as follows.

@register.simple_tag(takes_context=True)


However when I print the type of context at this stage it is an instance of 
RequestContext. Is this expected behaviour? Because if you wanted todo a 
render_to_string at the end of the template tag, it'll throw an "unexpected 
type" error as context as required as a dict but not an instance of 
RequestContext

my return statement

renderedMessage = render_to_string(template, context)
return mark_safe(renderedMessage)


Regards

Murat

-- 
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/3f45cfb7-5028-46ea-8004-d340dbd6b995%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Two command-line questions. How do I get a list of model names? How do I match a user-inputted string with a model name?

2018-01-18 Thread Jani Tiainen

Hi,

You got answered otherwise but note that model name itself isn't unique. 
"appname.modelname" is unique pair.



On 18.1.2018 3.31, Tom Tanner wrote:

I've got the following in `management/commands/my_command.py`:

|
fromdjango.core.management.baseimportBaseCommand,CommandError
fromdjango.conf importsettings

importos.path,csv

fromtheme.models import*

classCommand(BaseCommand):
defhandle(self,*args,**options):
       modelName=raw_input("Enter model name: ")
print"you entered",modelName
|


I want to show the user a list of all model names. I want to take the 
user's input and see if's an existing model. How do I do this?

--
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/2d5a05da-27e1-40ba-9884-478aecb2efe5%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
Jani Tiainen

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


Re: Two command-line questions. How do I get a list of model names? How do I match a user-inputted string with a model name?

2018-01-18 Thread Larry Martell
import django.apps
django.apps.apps.get_models()

On Wed, Jan 17, 2018 at 8:31 PM, Tom Tanner
 wrote:
> I've got the following in `management/commands/my_command.py`:
>
> from django.core.management.base import BaseCommand, CommandError
> from django.conf import settings
>
> import os.path, csv
>
> from theme.models import *
>
> class Command(BaseCommand):
>   def handle(self, *args, **options):
>modelName= raw_input("Enter model name: ")
>print "you entered", modelName
>
>
> I want to show the user a list of all model names. I want to take the user's
> input and see if's an existing model. How do I do this?

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


InlineFormset Updating issues, after changing the value in the input

2018-01-18 Thread Paul


I have 2 models Product and Image:

class Image(models.Model):
product = models.ForeignKey(Product, related_name='images', on_delete=
models.CASCADE)
parent = models.ForeignKey('self', blank=True, null=True, 
verbose_name='original 
image', on_delete=models.CASCADE)
image = models.ImageField(upload_to=file_upload_to)
image_type = models.CharField(max_length=50)



parent is a Foreign Key to the original image

I use the Image Model in a formset:

ImageFormSet = inlineformset_factory(parent_model=Product, model=Image,
form=ImageModelForm, min_num=1, max_num=4, can_delete=True)



Steps:

Set the Product Form with the inlineformset for Image
Show and submit the creation form
save the original image(s)
after the original image is saved, create multiple image by cropping 
the original image, using a task
Edit/Update Form, show as image one of the cropped image (instead of 
original) by modifying(filter by image_type) the Formset queryset

An here appear the issue:

The {{form.id}} value in case of update, is the pk(id) of the cropped 
image, instead of the original image:





and when the image is updated, is replacing the cropped image in database 
instead of the original image, and the 'cropped' tasks after and insertion 
in database is wrong.

I tried to replace the value(using a custom widget) instead of the cropped 
image with the pk(id) of the original(parent_id).

but if I do, this, on updating/replacing an older image, the new replacing 
image, is ignored; the form submit with no errors, but the replace image is 
not replaced; the other new images are ok.

So I think is a mechanism that compares the value in the the input with 
what was passed to the form, and if doesn't correspond is jut ignoring.

-- 
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/bb636da0-293e-4427-9da4-966fc652dcc4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reporting unwanted behaviours

2018-01-18 Thread Karol Bujaček

On 01/18/2018 08:25 AM, Kubilay Yazoğlu wrote:


Hi. I want to implement a reporting system in which users report a 
post simply by clicking the report button and later on, admins check 
it whether the post is really against the policy of the website. 
However, when I make a research about Django Reporting Systems, the 
results are not related to this. I was not able to express myself clearly.


So, is there any package I can use? Any tutorials I can follow? 
Anything about this?





Dear Kubilay,

Can you explain detailed use case of this feature? How will 
administrators check the reported issue? Do you have any other 
expectations besides one 'report button'?



I’m asking these questions because I tempt to answer you that it will be 
easier and better to write one model, one form and add some stuff into 
django admin section, however, your requirements may be different.



Best regards,
Karol

--
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/f19004f2-940f-5377-1326-eae0c65ffcdd%40fossilgroup.net.
For more options, visit https://groups.google.com/d/optout.


Re: [django-channels] post-process message from Group

2018-01-18 Thread Tomáš Ehrlich
Hey Andrew,
that's great! I'll take a look today. For some reason, I didn't receive 
your response so I came up with a bit inefficient solution described in 
this 
[gist](https://gist.github.com/tricoder42/af3d0337c1b33d82c1b32d12bd0265ec).

I basically have another store with subscribers and then broadcast message 
manually.

Anyway, going to wipe it out and start over using Channels 2 :)


Thanks for a great library!

Cheers,
   Tom

Dne středa 17. ledna 2018 19:43:23 UTC+1 Andrew Godwin napsal(a):
>
> Hi Tom,
>
> In Channels 1, because of the way Groups work you cannot do 
> post-processing. The only fix for this is a complete rearchitecture which 
> is underway in Channels 2, where you get the ability to act on group 
> messages before they get sent back to the consumer.
>
> Channels 2 is not yet ready for production, but is close, and if you want 
> to start playing around with it now you can: 
> http://channels.readthedocs.io/en/2.0/
>
> Andrew
>
> On Wed, Jan 17, 2018 at 5:42 AM, Tomáš Ehrlich  > wrote:
>
>> Hello everyone,
>> I’m trying to connect django-channels with GraphQL subscriptions (using 
>> graphene and underlying graphql-core library).
>>
>> I’m basically doing sth similar to example in [docs](
>> https://channels.readthedocs.io/en/latest/concepts.html#groups):
>>
>> - I setup listener of post_save signal, passing instance PK to Group
>> - When subscription is requested, I add reply_channel to the Group I want 
>> to listen
>>
>> The problem is that with GraphQL I don’t know in advance what data client 
>> requests. 
>> Compared to DRF where I could simply serialize instance in post_save 
>> listener and send
>> serialized data to Group, here I’m only sending instance PK (each client 
>> might request different fields from
>> model and I can’t pass instances through channel). Ideally, instead of 
>> adding reply_channel
>> to the Group directly, I would like to add custom callback, which 1) gets 
>> instance by PK 2) serialize it using
>> given GraphQL query and finally 3) send data to reply_channel.
>>
>>
>> Other possible workaround: list channels in a group
>>
>> I think I could save query (== serializer) to channel_session and execute 
>> it (== serialize instance) when message is received. 
>> Then I need to add a consumer for a Group and for that I would need to 
>> list all channels in a Group.
>>
>>
>> Any ideas? GraphQL is still new in Djangoland and especially 
>> subscriptions are sth which needs to be figured out…
>>
>>
>> Thank you in advance!
>>
>> Cheers,
>>Tom
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@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/3506375B-E9B4-4F99-96D0-AD18F78B8CE9%40gmail.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/fd7ebbdf-c278-42a5-bd6c-f5d7ea3c9356%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.