Re: What is the proper workflow before first migration?

2019-04-12 Thread 'David Turner' via Django users
If you are using django allauth and include this in your settings.py
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'

then you will be good to go.
On Apr 12 2019, at 10:03 pm, Flip Matter  wrote:
> Django you so much, I believe having a separate Post model would be the way 
> to go. Recifes to get going on allauth and that's turning out to be way 
> easier than I expected so all of you have basically fixed everything so thank 
> you VERY much. Now I just need to figure out how to do email verification and 
> I'll be good to get the rest of the site done.
>
> On Wed, Apr 10, 2019, 12:34 PM 'dtdave' via Django users 
> mailto:django-users@googlegroups.com)> wrote:
> >
> > To me the way I build my models is so that if anyone looked at the code 
> > they would see exactly what the model represented. I had a great mentor in 
> > Daniel Greenfield of Two Scoops Fame.
> > So my models would be users and then a separate model for public posts.
> > The you have the following in your settings
> >
> > AUTH_USER_MODEL = 'users.CustomUser'
> > and everything would br fine.
> > You could then use this users modle elsewhere.
> > Also I have never seen the templates done your way. You can just have a 
> > single:
> > 'DIRS': [os.path.join(BASE_DIR, 'templates')],
> > Then you can either have your templates in under the relevant app name e.g
> > public_posts/templates/public_posts
> > or in one template folder split into the apps. Different people have there 
> > own ideal method so it is really up tp you.
> > Hope this helps
> >
> >
> > On Wednesday, 10 April 2019 13:45:27 UTC+1, Flip Matter wrote:
> > > Thank you very much for the resources! However it is installed in my 
> > > settings.py the exact line is... AUTH_USER_MODEL = 
> > > 'public_posts.CustomUser'
> > >
> > > Is there a different way to do it? This is the only way I have seen to 
> > > set your AUTH_USER_MODEL, or does my custom user model have to be in a 
> > > 'users' app?
> > >
> > >
> > >
> > > On Sat, Apr 6, 2019 at 10:26 AM 'dtdave' via Django users 
> > >  wrote:
> > > > The error you are getting is because the CustomUser is not included in 
> > > > your settings.py
> > > > Because I use a separte user model my settings.py has this line in it:
> > > > AUTH_USER_MODEL = 'users.CustomUser'
> > > > I would recommend that you have your Custom User as a separate user 
> > > > model.
> > > >
> > > > For good tutorials on user models have a look at these links:
> > > > https://wsvincent.com/django-tips-custom-user-model/
> > > > https://wsvincent.com/django-login-with-email-not-username/
> > > > https://wsvincent.com/django-custom-user-model-tutorial/
> > > >
> > > > Django All-Auth is a good app for customising your user models:
> > > > https://www.intenct.nl/projects/django-allauth/
> > > > Hope this helps!
> > > >
> > > >
> > > >
> > > > On Friday, 5 April 2019 15:58:19 UTC+1, silverst...@gmail.com wrote:
> > > > > Hello, I've been trying to make a social media site and know nothing 
> > > > > about django (i've been teaching myself using the documentation and 
> > > > > tutorials) I've had to redo the site three times and now have to do a 
> > > > > fourth because (even though I got AUTH_USER_MODEL in, all the forms 
> > > > > ect. ect. before first migration) for some reason it is saying that 
> > > > > "Manager is unavailable; auth.User has been swapped for 
> > > > > public_posts.CustomUser". I have not been able to find a decent 
> > > > > description on exactly how work flow NEEDS to be done. Obviously 
> > > > > create user models and set AUTH_USER_MODEL before first migration but 
> > > > > what about the Manager? I made my CustomUserManager at the same time 
> > > > > as everything else.
> > > > >
> > > > > I tried to use django-registration, then found out they upgraded to 
> > > > > django_registration, couldn't find ANY documentation on it until 
> > > > > almost a week afterwards. So now my code is partially a bunch of 
> > > > > tutorials and partially old (possibly deprecated) code, is there 
> > > > > somewhere that all of the new stuff and how to transfer to the new 
> > > > > stuff posted? This seems to be the hardest part about Django, for me 
> > > > > anyway. I've tried get_user_model where user comes up to no avail. I 
> > > > > have three apps, admin_posts, public_posts and accounts (get ready to 
> > > > > smirk cuz this was stupid of me) I have all my CustomUser stuff in 
> > > > > public_posts and have everything required by django_registration in 
> > > > > accounts. I'm positive that was a huge fail on my part but Where 
> > > > > SHOULD all of the user stuff go?? I have no been able to find 
> > > > > anything about that anywhere everything only says ' 
> > > > > appname.CustomUser' (example) leading me to believe that it doesn't 
> > > > > matter where you put them. but since django_registration has its own
 requirements and user dealings, will using django_registration and CustomUsers 
cancel each other out/mess up each others 

Guardar many to many Django

2019-04-12 Thread tatianamesa687


Hola, tengo una duda acerca de como guardar many to many en Django , 
agradecería mucho sus ayudas



En la tabla de artículos cargo los datos, luego quiero asociarlos con la 
tabla temas, pero cuando hago el save me sale este error


Guardo primero todos los articulos.


*TypeError: Direct assignment to the forward side of a many-to-many set is 
prohibited. Use articulo.set() instead.*


Busque el error y ya instacio el id del articulo que guarde, pero me sigue 
saliendo el mismo error:

 de esta manero lo guardo

   


 articulo_data = Articulo.objects.get(id=dato) #instancia de articulo


#TAGS

taglist =  []

for tag in tags: 

tags = Tag.objects.get(id=tag)

taglist.append(tags)

print(taglist)


#TEMAS

temalist =  [] 

for topic in topics_array:

tema = Tema.objects.get(nombre=topic)

temalist.append(tema)

print(temalist)


save = 
Articulo_Consolidacion.objects.create(articulo=articulo_data,tagicNone, 
tono=array_tono, tema__id=None)





Estos son mis modelos

--

class Articulo(models.Model):

titulo = models.CharField(max_length=255, blank=True)

texto = models.TextField()

url = models.CharField(max_length=255)

fuente = models.ForeignKey(Fuente, on_delete=models.CASCADE)

fecha = models.DateTimeField(null=True)

created_at = models.DateTimeField(auto_now_add=True, auto_now=False, 
verbose_name=u'Fecha de creación')

ubicacion = models.CharField(max_length=255)

tipo_facebook = models.CharField(max_length=255)

id_articulo_facebook = models.CharField(max_length=255,blank=True, 
null=True)

proyecto = models.ManyToManyField('Proyecto')

finished = models.BooleanField(verbose_name=u'Finalizado', 
default=False)

asignado = models.BooleanField(verbose_name=u'Asignado', default=False)

state = models.BooleanField(verbose_name=u'Para borrar', default=False)

recategorisation = models.BooleanField(verbose_name=u'Recategorizar', 
default=False)

history = HistoricalRecords()

--


class Articulo_Consolidacion(models.Model):

state = models.BooleanField(verbose_name=u'Prueba', default=False)

articulo = models.ManyToManyField('Articulo')

tag = models.ManyToManyField('tag')

tema = models.ManyToManyField('Tema')

tono = models.ManyToManyField('Tono')

narrativa = models.ManyToManyField('Narrativa')

nivelpromocion = models.ManyToManyField('NivelPromocion')

posicion = models.ManyToManyField('Posicion')

brand_love = models.ManyToManyField('BrandLove')

promocion = models.ManyToManyField('Promocion')

created_at = models.DateTimeField(auto_now_add=True)

updated_at = models.DateTimeField(auto_now=True)

history = HistoricalRecords()

id_comentario = models.CharField(max_length=255,null=True)
--
class Tema(models.Model):
nombre = models.CharField(max_length=255)
history = HistoricalRecords()
-





[image: Captura de pantalla de 2019-04-12 18-07-56.png] 


-- 
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/743469b3-1fbf-4002-8d9e-4dd01e37e948%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is the proper workflow before first migration?

2019-04-12 Thread Flip Matter
Django you so much, I believe having a separate Post model would be the way
to go. Recifes to get going on allauth and that's turning out to be way
easier than I expected so all of you have basically fixed everything so
thank you VERY much. Now I just need to figure out how to do email
verification and I'll be good to get the rest of the site done.

On Wed, Apr 10, 2019, 12:34 PM 'dtdave' via Django users <
django-users@googlegroups.com> wrote:

>
> To me the way I build my models is so that if anyone looked at the code
> they would see exactly what the model represented. I had a great mentor in
> Daniel Greenfield of Two Scoops Fame.
> So my models would be users and then a separate model for public posts.
> The you have the following in your settings
> AUTH_USER_MODEL = 'users.CustomUser'
> and everything would br fine.
> You could then use this users modle elsewhere.
> Also I have never seen the templates done your way. You can just have a
> single:
> 'DIRS': [os.path.join(BASE_DIR, 'templates')],
> Then you can either have your templates in under the relevant app name e.g
> public_posts/templates/public_posts
> or in one template folder split into the apps. Different people have there
> own ideal method so it is really up tp you.
> Hope this helps
>
> On Wednesday, 10 April 2019 13:45:27 UTC+1, Flip Matter wrote:
>>
>> Thank you very much for the resources! However it is installed in my
>> settings.py the exact line is...  AUTH_USER_MODEL =
>> 'public_posts.CustomUser'
>> Is there a different way to do it? This is the only way I have seen to
>> set your AUTH_USER_MODEL, or does my custom user model have to be in a
>> 'users' app?
>>
>>
>> On Sat, Apr 6, 2019 at 10:26 AM 'dtdave' via Django users <
>> django...@googlegroups.com> wrote:
>>
>>> The error you are getting  is because the CustomUser is not included in
>>> your settings.py
>>> Because I use a separte user model my settings.py has this line in it:
>>> AUTH_USER_MODEL = 'users.CustomUser'
>>> I would recommend that you have your Custom User as a separate user
>>> model.
>>> For  good tutorials on user models have a look at these links:
>>> https://wsvincent.com/django-tips-custom-user-model/
>>> https://wsvincent.com/django-login-with-email-not-username/
>>> https://wsvincent.com/django-custom-user-model-tutorial/
>>>
>>> Django All-Auth is a good app for customising your user models:
>>> https://www.intenct.nl/projects/django-allauth/
>>> Hope this helps!
>>>
>>>
>>> On Friday, 5 April 2019 15:58:19 UTC+1, silverst...@gmail.com wrote:

 Hello, I've been trying to make a social media site and know nothing
 about django (i've been teaching myself using the documentation and
 tutorials) I've had to redo the site three times and now have to do a
 fourth because (even though I got AUTH_USER_MODEL in, all the forms ect.
 ect. before first migration) for some reason it is saying that "Manager is
 unavailable; auth.User has been swapped for public_posts.CustomUser". I
 have not been able to find a decent description on exactly how work flow
 NEEDS to be done. Obviously create user models and set AUTH_USER_MODEL
 before first migration but what about the Manager? I made my
 CustomUserManager at the same time as everything else.

 I tried to use django-registration, then found out they upgraded to
 django_registration, couldn't find ANY documentation on it until almost a
 week afterwards. So now my code is partially a bunch of tutorials and
 partially old (possibly deprecated) code, is there somewhere that all of
 the new stuff and how to transfer to the new stuff posted? This seems to be
 the hardest part about Django, for me anyway. I've tried get_user_model
 where user comes up to no avail.  I have three apps, admin_posts,
 public_posts and accounts (get ready to smirk cuz this was stupid of me) I
 have all my CustomUser stuff in public_posts and have everything required
 by django_registration in accounts. I'm positive that was a huge fail on my
 part but Where SHOULD all of the user stuff go?? I have no been able to
 find anything about that anywhere everything only says '
 appname.CustomUser' (example) leading me to believe that it doesn't matter
 where you put them. but since django_registration has its own requirements
 and user dealings, will using django_registration and CustomUsers cancel
 each other out/mess up each others managers?

 Everything I have done has only been in my project(s) and not in the
 root dir. Also, if anyo contributors to django read this, thank you for
 making such a freaking amazing framework, I mean this thing is just a pure
 beauty so thank you!!! Y'all be some geniuses! I hope to be good enough to
 contribute.

 Thank you for making it to the end and thank you for any responses.
 P.S I only post as a last resort, I've spent HOURS researching this to
 no avail, not 

Re: fesherstructural error

2019-04-12 Thread Joseph Jones
Hello,
First thank you very much for the advice and I apologize for the response
delay. just to make sure I understand the advice correctly I would install
Django on
Hypotheticalprojetfolder/bin/env? Please let me know. Thank you,
Joseph

On Tue, Apr 9, 2019 at 3:30 PM Julio Cojom  wrote:

> If you're using virtualenv, then u need to activate before running
> manage.py, to activate, use workon .
>
> Maybe you only installed Django in your virtualenv and not in your system.
>
> Regards!
>
> El mar., 9 abr. 2019 a las 13:20, sachin thakur (<
> sachin.thakur9...@gmail.com>) escribió:
>
>> Create your virtual machine  in any or directory
>>
>>
>>  Then install the django in that virtual machine n create your project
>>
>> Regards
>> Sachin Thakur
>>
>> On Wed 10 Apr, 2019, 12:47 AM Joseph Jones,  wrote:
>>
>>> Hello fellow Django community members,
>>> I seem to be having quite a bit of trouble fixing my error in calling
>>> the manage.py directory in my project. I've received of a hint in that my
>>> code launcher  indicates that "Django is not importable into this
>>> environment" so it would appear as well as the error in the structure I
>>> have made an additional error to give an picture of the structure of my
>>> project. it is
>>> C:/users/Joseph
>>> C:/users/Joseph/Anaconda3
>>> C:/users/Joseph/Anaconda3 /lib
>>> C:/users/Joseph/Anaconda3 /lib/site-packages
>>> Any advice on the step I seem to be missing would be  appreciated. Thank
>>> you, Joseph
>>>
>>> --
>>> 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/CAJGsC5Oy9HdXqHSe4qj2mShPjktyV2GsM2rY9qsQ4NZeKw_g8g%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/CA%2BLmcYtMi3wsgGVtDpDmV19bAUJHDS3TNfX5Z5gyQgELAsy8xw%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/CAHRQUH%3D1XLhLx%3DShNtYRkW16E8hEKEN7DJhPtTW1cxMWp-HRKw%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/CAJGsC5Oo_Y40ZQapA8c6n86KTgeZ87kL01AX9taBuxky1oeaow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Video time line manipulation

2019-04-12 Thread dp Audiovisual
Hello. Anyone know how to make comments in a specific time of the video. 
Fir example I see in the second 28 of the video I want to comment 
something, I want to create the comment and when other users see the video 
can see the comments. with python or Django package maybe?

-- 
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/986a0985-4b82-4a8e-be15-b162f0827f0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Complex query on inner join - case for __ne?

2019-04-12 Thread Michael Thomas
Naimur: I am - that SQL was in response to  Aldian's question :)

On Fri, Apr 12, 2019 at 8:23 PM naimur rahman 
wrote:

> use ORM istead of SQL
>
> On Fri, Apr 12, 2019, 7:42 PM Michael Thomas <
> michael.thomas.s...@gmail.com> wrote:
>
>> SELECT
>> "app_foo"."id",
>> "app_foo"."name"
>> FROM "app_foo"
>> INNER JOIN "app_bar" ON (
>> "app_foo"."id" = "app_bar"."foo_id"
>> )
>> WHERE (
>> NOT (
>> "app_foo"."id" IN (
>> SELECT
>> U1."foo_id"
>> FROM "app_bar" U1
>> WHERE U1."attribute_1" = 1
>> )
>> )
>> AND "app_bar"."attribute_2" = 2
>> )
>>
>> On Fri, Apr 12, 2019 at 6:59 PM Aldian Fazrihady 
>> wrote:
>>
>>> What's the result of
>>>
>>> print(Foo.objects.exclude(bar__attribute=1).filter(
>>> bar__attribute_2=2).query)
>>>
>>> On Fri, 12 Apr 2019, 20:10 Michael Thomas, <
>>> michael.thomas.s...@gmail.com> wrote:
>>>
 Hello everyone,

 I've run into what I believe is a limitation of the ORM that other
 people must be dealing with somehow, but I can't seem to figure out a
 sensible solution.

 I think it's easiest to describe the problem with code.

 For the following models:

 class Foo(models.Model):
 name = models.CharField(max_length=64)


 class Bar(models.Model):
 foo = models.ForeignKey(Foo, on_delete=models.CASCADE)
 attribute_1 = models.IntegerField()
 attribute_2 = models.IntegerField()

 I want to select all Foo() that have 1 or more bar with attribute_1 not
 equal to 1, and attribute_2 equal to 2.

 Eg. SQL something like this:

 SELECT
 "app_foo"."id",
 "app_foo"."name"
 FROM "app_foo"
 INNER JOIN "app_bar" ON (
 "app_foo"."id" = "app_bar"."foo_id"
 )
 WHERE (
 "app_bar"."attribute_1" <> 1
 AND "app_bar"."attribute_2" = 2
 )

 However, here's what I end up with...


 print(Foo.objects.exclude(bar__attribute_1=1).filter(bar__attribute_2=2).query)
 SELECT
 "app_foo"."id",
 "app_foo"."name"
 FROM "app_foo"
 INNER JOIN "app_bar" ON (
 "app_foo"."id" = "app_bar"."foo_id"
 )
 WHERE (
 NOT (
 "app_foo"."id" IN (
 SELECT
 U1."foo_id"
 FROM "app_bar" U1
 WHERE U1."attribute_1" = 1
 )
 )
 AND "app_bar"."attribute_2" = 2
 )

 print(Foo.objects.filter(~Q(bar__attribute_1=1),
 bar__attribute_2=2).query)
 Exact same SQL output as above

 Interestingly enough, a simple query for attribute_1=1 and
 attribute_2=2 works as expected, so it would be trivial to do this with a
 __ne operator (if it existed), without any other changes to the ORM:

 print(Foo.objects.filter(bar__attribute_1=1, bar__attribute_2=2).query)
 SELECT
 "app_foo"."id",
 "app_foo"."name"
 FROM "app_foo"
 INNER JOIN "app_bar" ON (
 "app_foo"."id" = "app_bar"."foo_id"
 )
 WHERE (
 "app_bar"."attribute_1" = 1
 AND "app_bar"."attribute_2" = 2
 )

 Am I missing something here? How are other people tackling this?

 Kind Regards,
 Michael Thomas

 --
 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/d852fc10-5f5a-43e8-8dab-c796404867a8%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/CAN7EoAaXupYqNoPcHOcZ3OoA_07N--D4EPoEfZvkSWL%2BeLbD6A%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 

Re: Complex query on inner join - case for __ne?

2019-04-12 Thread naimur rahman
use ORM istead of SQL

On Fri, Apr 12, 2019, 7:42 PM Michael Thomas 
wrote:

> SELECT
> "app_foo"."id",
> "app_foo"."name"
> FROM "app_foo"
> INNER JOIN "app_bar" ON (
> "app_foo"."id" = "app_bar"."foo_id"
> )
> WHERE (
> NOT (
> "app_foo"."id" IN (
> SELECT
> U1."foo_id"
> FROM "app_bar" U1
> WHERE U1."attribute_1" = 1
> )
> )
> AND "app_bar"."attribute_2" = 2
> )
>
> On Fri, Apr 12, 2019 at 6:59 PM Aldian Fazrihady 
> wrote:
>
>> What's the result of
>>
>> print(Foo.objects.exclude(bar__attribute=1).filter(
>> bar__attribute_2=2).query)
>>
>> On Fri, 12 Apr 2019, 20:10 Michael Thomas, 
>> wrote:
>>
>>> Hello everyone,
>>>
>>> I've run into what I believe is a limitation of the ORM that other
>>> people must be dealing with somehow, but I can't seem to figure out a
>>> sensible solution.
>>>
>>> I think it's easiest to describe the problem with code.
>>>
>>> For the following models:
>>>
>>> class Foo(models.Model):
>>> name = models.CharField(max_length=64)
>>>
>>>
>>> class Bar(models.Model):
>>> foo = models.ForeignKey(Foo, on_delete=models.CASCADE)
>>> attribute_1 = models.IntegerField()
>>> attribute_2 = models.IntegerField()
>>>
>>> I want to select all Foo() that have 1 or more bar with attribute_1 not
>>> equal to 1, and attribute_2 equal to 2.
>>>
>>> Eg. SQL something like this:
>>>
>>> SELECT
>>> "app_foo"."id",
>>> "app_foo"."name"
>>> FROM "app_foo"
>>> INNER JOIN "app_bar" ON (
>>> "app_foo"."id" = "app_bar"."foo_id"
>>> )
>>> WHERE (
>>> "app_bar"."attribute_1" <> 1
>>> AND "app_bar"."attribute_2" = 2
>>> )
>>>
>>> However, here's what I end up with...
>>>
>>>
>>> print(Foo.objects.exclude(bar__attribute_1=1).filter(bar__attribute_2=2).query)
>>> SELECT
>>> "app_foo"."id",
>>> "app_foo"."name"
>>> FROM "app_foo"
>>> INNER JOIN "app_bar" ON (
>>> "app_foo"."id" = "app_bar"."foo_id"
>>> )
>>> WHERE (
>>> NOT (
>>> "app_foo"."id" IN (
>>> SELECT
>>> U1."foo_id"
>>> FROM "app_bar" U1
>>> WHERE U1."attribute_1" = 1
>>> )
>>> )
>>> AND "app_bar"."attribute_2" = 2
>>> )
>>>
>>> print(Foo.objects.filter(~Q(bar__attribute_1=1),
>>> bar__attribute_2=2).query)
>>> Exact same SQL output as above
>>>
>>> Interestingly enough, a simple query for attribute_1=1 and attribute_2=2
>>> works as expected, so it would be trivial to do this with a __ne operator
>>> (if it existed), without any other changes to the ORM:
>>>
>>> print(Foo.objects.filter(bar__attribute_1=1, bar__attribute_2=2).query)
>>> SELECT
>>> "app_foo"."id",
>>> "app_foo"."name"
>>> FROM "app_foo"
>>> INNER JOIN "app_bar" ON (
>>> "app_foo"."id" = "app_bar"."foo_id"
>>> )
>>> WHERE (
>>> "app_bar"."attribute_1" = 1
>>> AND "app_bar"."attribute_2" = 2
>>> )
>>>
>>> Am I missing something here? How are other people tackling this?
>>>
>>> Kind Regards,
>>> Michael Thomas
>>>
>>> --
>>> 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/d852fc10-5f5a-43e8-8dab-c796404867a8%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/CAN7EoAaXupYqNoPcHOcZ3OoA_07N--D4EPoEfZvkSWL%2BeLbD6A%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
> 

Re: Failed to understand syntax

2019-04-12 Thread Test Bot
The part you want to understand is same as ORDER BY clause in SQL. The
slicing will provide only the top 5 results. By default the order_by sorts
in ascending order only. But providing a "-" would make it to sort in
descending order.

On Fri, Apr 12, 2019, 6:56 PM Mayur Bagul  wrote:

> Hello coders,
>
> I'm here to understand line of code which im unable to understand how it
> work.
> i'm looking forward to get help from you.
>
> code is given below :
>
>
> from django.shortcuts import render
>
> from .models import Question
>
>
> def index(request):
> latest_question_list = Question.objects.order_by*('-pub_date')[:5]*
> context = {'latest_question_list': latest_question_list}
> return render(request, 'polls/index.html', context)
>
>
>
>
> - in the code above i'm looking forward to know about bold and highlighted
> part how it work ?
>
> --
> 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/bbc7142c-bf46-4fb4-8e25-bbe7a2594c9f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

On Fri, Apr 12, 2019, 6:56 PM Mayur Bagul  wrote:

> Hello coders,
>
> I'm here to understand line of code which im unable to understand how it
> work.
> i'm looking forward to get help from you.
>
> code is given below :
>
>
> from django.shortcuts import render
>
> from .models import Question
>
>
> def index(request):
> latest_question_list = Question.objects.order_by*('-pub_date')[:5]*
> context = {'latest_question_list': latest_question_list}
> return render(request, 'polls/index.html', context)
>
>
>
>
> - in the code above i'm looking forward to know about bold and highlighted
> part how it work ?
>
> --
> 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/bbc7142c-bf46-4fb4-8e25-bbe7a2594c9f%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/CAD%3DM5eTqF%2B-AKXxG5QADXsouGPCsRNWfsM1tLahFiL7DzGKtUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Complex query on inner join - case for __ne?

2019-04-12 Thread Michael Thomas
SELECT
"app_foo"."id",
"app_foo"."name"
FROM "app_foo"
INNER JOIN "app_bar" ON (
"app_foo"."id" = "app_bar"."foo_id"
)
WHERE (
NOT (
"app_foo"."id" IN (
SELECT
U1."foo_id"
FROM "app_bar" U1
WHERE U1."attribute_1" = 1
)
)
AND "app_bar"."attribute_2" = 2
)

On Fri, Apr 12, 2019 at 6:59 PM Aldian Fazrihady  wrote:

> What's the result of
>
> print(Foo.objects.exclude(bar__attribute=1).filter(
> bar__attribute_2=2).query)
>
> On Fri, 12 Apr 2019, 20:10 Michael Thomas, 
> wrote:
>
>> Hello everyone,
>>
>> I've run into what I believe is a limitation of the ORM that other people
>> must be dealing with somehow, but I can't seem to figure out a sensible
>> solution.
>>
>> I think it's easiest to describe the problem with code.
>>
>> For the following models:
>>
>> class Foo(models.Model):
>> name = models.CharField(max_length=64)
>>
>>
>> class Bar(models.Model):
>> foo = models.ForeignKey(Foo, on_delete=models.CASCADE)
>> attribute_1 = models.IntegerField()
>> attribute_2 = models.IntegerField()
>>
>> I want to select all Foo() that have 1 or more bar with attribute_1 not
>> equal to 1, and attribute_2 equal to 2.
>>
>> Eg. SQL something like this:
>>
>> SELECT
>> "app_foo"."id",
>> "app_foo"."name"
>> FROM "app_foo"
>> INNER JOIN "app_bar" ON (
>> "app_foo"."id" = "app_bar"."foo_id"
>> )
>> WHERE (
>> "app_bar"."attribute_1" <> 1
>> AND "app_bar"."attribute_2" = 2
>> )
>>
>> However, here's what I end up with...
>>
>>
>> print(Foo.objects.exclude(bar__attribute_1=1).filter(bar__attribute_2=2).query)
>> SELECT
>> "app_foo"."id",
>> "app_foo"."name"
>> FROM "app_foo"
>> INNER JOIN "app_bar" ON (
>> "app_foo"."id" = "app_bar"."foo_id"
>> )
>> WHERE (
>> NOT (
>> "app_foo"."id" IN (
>> SELECT
>> U1."foo_id"
>> FROM "app_bar" U1
>> WHERE U1."attribute_1" = 1
>> )
>> )
>> AND "app_bar"."attribute_2" = 2
>> )
>>
>> print(Foo.objects.filter(~Q(bar__attribute_1=1),
>> bar__attribute_2=2).query)
>> Exact same SQL output as above
>>
>> Interestingly enough, a simple query for attribute_1=1 and attribute_2=2
>> works as expected, so it would be trivial to do this with a __ne operator
>> (if it existed), without any other changes to the ORM:
>>
>> print(Foo.objects.filter(bar__attribute_1=1, bar__attribute_2=2).query)
>> SELECT
>> "app_foo"."id",
>> "app_foo"."name"
>> FROM "app_foo"
>> INNER JOIN "app_bar" ON (
>> "app_foo"."id" = "app_bar"."foo_id"
>> )
>> WHERE (
>> "app_bar"."attribute_1" = 1
>> AND "app_bar"."attribute_2" = 2
>> )
>>
>> Am I missing something here? How are other people tackling this?
>>
>> Kind Regards,
>> Michael Thomas
>>
>> --
>> 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/d852fc10-5f5a-43e8-8dab-c796404867a8%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/CAN7EoAaXupYqNoPcHOcZ3OoA_07N--D4EPoEfZvkSWL%2BeLbD6A%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/CAEdx1fpYmYHXX14iu3Enwc18Ojkk3%3DBfzTv3mGWVdf5BzZVv7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Complex query on inner join - case for __ne?

2019-04-12 Thread Aldian Fazrihady
What's the result of

print(Foo.objects.exclude(bar__attribute=1).filter(
bar__attribute_2=2).query)

On Fri, 12 Apr 2019, 20:10 Michael Thomas, 
wrote:

> Hello everyone,
>
> I've run into what I believe is a limitation of the ORM that other people
> must be dealing with somehow, but I can't seem to figure out a sensible
> solution.
>
> I think it's easiest to describe the problem with code.
>
> For the following models:
>
> class Foo(models.Model):
> name = models.CharField(max_length=64)
>
>
> class Bar(models.Model):
> foo = models.ForeignKey(Foo, on_delete=models.CASCADE)
> attribute_1 = models.IntegerField()
> attribute_2 = models.IntegerField()
>
> I want to select all Foo() that have 1 or more bar with attribute_1 not
> equal to 1, and attribute_2 equal to 2.
>
> Eg. SQL something like this:
>
> SELECT
> "app_foo"."id",
> "app_foo"."name"
> FROM "app_foo"
> INNER JOIN "app_bar" ON (
> "app_foo"."id" = "app_bar"."foo_id"
> )
> WHERE (
> "app_bar"."attribute_1" <> 1
> AND "app_bar"."attribute_2" = 2
> )
>
> However, here's what I end up with...
>
>
> print(Foo.objects.exclude(bar__attribute_1=1).filter(bar__attribute_2=2).query)
> SELECT
> "app_foo"."id",
> "app_foo"."name"
> FROM "app_foo"
> INNER JOIN "app_bar" ON (
> "app_foo"."id" = "app_bar"."foo_id"
> )
> WHERE (
> NOT (
> "app_foo"."id" IN (
> SELECT
> U1."foo_id"
> FROM "app_bar" U1
> WHERE U1."attribute_1" = 1
> )
> )
> AND "app_bar"."attribute_2" = 2
> )
>
> print(Foo.objects.filter(~Q(bar__attribute_1=1), bar__attribute_2=2).query)
> Exact same SQL output as above
>
> Interestingly enough, a simple query for attribute_1=1 and attribute_2=2
> works as expected, so it would be trivial to do this with a __ne operator
> (if it existed), without any other changes to the ORM:
>
> print(Foo.objects.filter(bar__attribute_1=1, bar__attribute_2=2).query)
> SELECT
> "app_foo"."id",
> "app_foo"."name"
> FROM "app_foo"
> INNER JOIN "app_bar" ON (
> "app_foo"."id" = "app_bar"."foo_id"
> )
> WHERE (
> "app_bar"."attribute_1" = 1
> AND "app_bar"."attribute_2" = 2
> )
>
> Am I missing something here? How are other people tackling this?
>
> Kind Regards,
> Michael Thomas
>
> --
> 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/d852fc10-5f5a-43e8-8dab-c796404867a8%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/CAN7EoAaXupYqNoPcHOcZ3OoA_07N--D4EPoEfZvkSWL%2BeLbD6A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: not getting desired output

2019-04-12 Thread Mayur Bagul
Hello Thomas,

thanks for your help.


On Friday, April 12, 2019 at 6:52:26 PM UTC+5:30, Michael Thomas wrote:
>
> You're not using a template, nor generating HTML in your views - where are 
> you expecting bullets to come from?
>

-- 
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/a6c54d6c-be47-45c3-ae56-53c492021dbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Failed to understand syntax

2019-04-12 Thread Mayur Bagul
Hello coders,

I'm here to understand line of code which im unable to understand how it 
work.
i'm looking forward to get help from you.

code is given below :


from django.shortcuts import render

from .models import Question


def index(request):
latest_question_list = Question.objects.order_by*('-pub_date')[:5]*
context = {'latest_question_list': latest_question_list}
return render(request, 'polls/index.html', context)




- in the code above i'm looking forward to know about bold and highlighted 
part how it work ?

-- 
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/bbc7142c-bf46-4fb4-8e25-bbe7a2594c9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: not getting desired output

2019-04-12 Thread Michael Thomas
You're not using a template, nor generating HTML in your views - where are
you expecting bullets to come from?

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


not getting desired output

2019-04-12 Thread Mayur Bagul
Hello there,

I have attached screenshot of django doc. which i follow in my ide code but 
when i run that code it doesnt showing desire output in the form of bullet 
format.

im looking for your solution to run my code perfectly.

thanking 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/72c615cc-7fae-4eac-9210-e7e8813720bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Complex query on inner join - case for __ne?

2019-04-12 Thread Michael Thomas
Hello everyone,

I've run into what I believe is a limitation of the ORM that other people 
must be dealing with somehow, but I can't seem to figure out a sensible 
solution.

I think it's easiest to describe the problem with code.

For the following models:

class Foo(models.Model):
name = models.CharField(max_length=64)


class Bar(models.Model):
foo = models.ForeignKey(Foo, on_delete=models.CASCADE)
attribute_1 = models.IntegerField()
attribute_2 = models.IntegerField()

I want to select all Foo() that have 1 or more bar with attribute_1 not 
equal to 1, and attribute_2 equal to 2.

Eg. SQL something like this:

SELECT 
"app_foo"."id", 
"app_foo"."name" 
FROM "app_foo" 
INNER JOIN "app_bar" ON (
"app_foo"."id" = "app_bar"."foo_id"
) 
WHERE (
"app_bar"."attribute_1" <> 1 
AND "app_bar"."attribute_2" = 2
)

However, here's what I end up with...

print(Foo.objects.exclude(bar__attribute_1=1).filter(bar__attribute_2=2).query)
SELECT 
"app_foo"."id", 
"app_foo"."name" 
FROM "app_foo" 
INNER JOIN "app_bar" ON (
"app_foo"."id" = "app_bar"."foo_id"
) 
WHERE (
NOT (
"app_foo"."id" IN (
SELECT 
U1."foo_id" 
FROM "app_bar" U1 
WHERE U1."attribute_1" = 1
)
) 
AND "app_bar"."attribute_2" = 2
)

print(Foo.objects.filter(~Q(bar__attribute_1=1), bar__attribute_2=2).query)
Exact same SQL output as above 

Interestingly enough, a simple query for attribute_1=1 and attribute_2=2 
works as expected, so it would be trivial to do this with a __ne operator 
(if it existed), without any other changes to the ORM:

print(Foo.objects.filter(bar__attribute_1=1, bar__attribute_2=2).query)
SELECT 
"app_foo"."id", 
"app_foo"."name" 
FROM "app_foo" 
INNER JOIN "app_bar" ON (
"app_foo"."id" = "app_bar"."foo_id"
) 
WHERE (
"app_bar"."attribute_1" = 1 
AND "app_bar"."attribute_2" = 2
)

Am I missing something here? How are other people tackling this?

Kind Regards,
Michael Thomas

-- 
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/d852fc10-5f5a-43e8-8dab-c796404867a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best way to modified third party app database restrictions?

2019-04-12 Thread Yongky Tria Putra
Almost forget. It thanks to Peterino comments on 
this https://stackoverflow.com/a/2357942/2579404

On Friday, April 12, 2019 at 6:16:04 PM UTC+7, Yongky Tria Putra wrote:
>
> I solve it with this two lines code in my models:
>
> from thirdparty.models import 
> ParentModelClassParentModelClass._meta.get_field('default_price').max_digits 
> = 9
>
> then makemigrations && migrate
>
> voila it work, but i don't know any downside using this tricks.
>
> Hope it will help others with similar situation as well.
>
> On Thursday, April 11, 2019 at 6:46:32 PM UTC+7, Yongky Tria Putra wrote:
>>
>> Hello everyone,
>>
>> What is the best way to modified database field restrictions in third 
>> party app (pretix)? Currently, i want to change max_digits=7  to 
>> max_digits=9  in database below.
>>
>> default_price = models.DecimalField(
>> decimal_places=2, max_digits=7,
>> null=True, blank=True,
>> verbose_name=_("Default price"),
>> )
>> Is it possible without modified the third party source code?
>> 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/9568dbc5-e859-41cb-b74b-fa7ecc2b0424%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best way to modified third party app database restrictions?

2019-04-12 Thread Yongky Tria Putra


I solve it with this two lines code in my models:

from thirdparty.models import 
ParentModelClassParentModelClass._meta.get_field('default_price').max_digits = 9

then makemigrations && migrate

voila it work, but i don't know any downside using this tricks.

Hope it will help others with similar situation as well.

On Thursday, April 11, 2019 at 6:46:32 PM UTC+7, Yongky Tria Putra wrote:
>
> Hello everyone,
>
> What is the best way to modified database field restrictions in third 
> party app (pretix)? Currently, i want to change max_digits=7  to 
> max_digits=9  in database below.
>
> default_price = models.DecimalField(
> decimal_places=2, max_digits=7,
> null=True, blank=True,
> verbose_name=_("Default price"),
> )
> Is it possible without modified the third party source code?
> 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/e6ca3e0a-02a0-4940-a2d0-ca3ac7e1728d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple Django projects using the same database

2019-04-12 Thread Hammi
Hi, other then the secret key, what should the two projects share ? i need 
to do this .. 

On Monday, March 30, 2015 at 4:25:41 AM UTC+1, Russell Keith-Magee wrote:
>
>
> On Mon, Mar 30, 2015 at 10:20 AM, Ien C. > 
> wrote:
>
>> Thanks Russ!
>>
>> Good point about the validation logic. Will definitely keep that in mind. 
>> And yes, my basic approach here is the same code base working on different 
>> subsets of data by default, with the ability for data to be optionally 
>> "seen" by both sites as needed. 
>>
>> One more question: there's no need to keep settings.SECRET_KEY the same 
>> across the sites, is there? In the context of this question, someone told 
>> me that SECRET_KEY is used for hashing db reads/writes, but that doesn't 
>> sound right to me and I don't see anything about that in the docs. The two 
>> sites can (and should) have different SECRET_KEY values, right?
>>
>  
> Depends on what your "secret" sharing policy is between the two sites. If 
> you want a truly shared login (as in - log into site A, login is recognised 
> on size B), or shared session payloads, you would need to have a shared 
> SECRET_KEY (along with some other cookie domain tweaks). However, if 
> they're independent sites, and you explicitly *want* someone to log into 
> site A and site B separately, then different SECRET_KEYs are advisable.
>
> I don't know what your "someone" meant about hashing db read/writes - 
> unless they were referring to the session table. It certainly isn't 
> something that is applied to *all* DB read/writes, or would prevent data 
> written with one site from being read by the second.
>
> Yours,
> Russ Magee %-)
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/67ab7620-7849-4446-883a-208166873e3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django soap client

2019-04-12 Thread oka M
Hai All,

Im php programer and i want to migration from php to pyhton in specific i 
want to use django for my webapps;

i have question 

how to import zeep module to my djanggo apps?

can give me example for my php code to django

http://localhost:8082/ws/live.php?wdslchace';
$client = new nusoap_client($url, true);

$proxy = $client->getProxy();

$username = 'username';
$password = 'password';

$result = $proxy ->GetToken($username, $password);

$token = $result;

?>

thanx

-- 
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/69dc3b5c-ff62-473c-9143-ec65268431a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.