Re: django-modeltranslation latest stable release not supporting Django 2.0

2018-07-31 Thread Andréas Kühne
Hi,

This is not an issue for the django-users group, but rather, as you already
have done, open an issue on the repository itself. What you also can do is
go through the code and issue a PR to fix the changes required for
supporting django 2.0 - the developer will probably happily accept the
changes.

The django users mailgroup is for helping you in using django - and the
problems that you get with django usage. Not for asking other people to fix
software in the django environment.

Good luck!

Andréas

2018-07-31 18:37 GMT+02:00 Uri Even-Chen :

> Hi,
>
> We are using django-modeltranslation for Speedy Net and Speedy Match (
> https://github.com/urievenchen/speedy-net). We are
> using django-modeltranslation as well as other packages. I noticed
> that django-modeltranslation latest stable release (0.12.2, from Jan. 26,
> 2018, see https://pypi.org/project/django-modeltranslation/#history)
> still doesn't support Django 2.0. There is a beta release which supports
> Django 2.0 but we don't want to use beta releases in our project. I opened
> an issue on GitHub (https://github.com/deschler/django-modeltranslation/
> issues/472) and I'm waiting for a stable release
> of django-modeltranslation which supports Django 2.0. This is the only
> package we use which still doesn't support Django 2.0 with a stable
> release. Can you help / join the project and release a stable release which
> supports Django 2.0? We want to upgrade our project to Django 2.0 and we
> can't do it due to this issue.
>
> Thanks,
> Uri.
>
> *Uri Even-Chen*
> [image: photo] Phone: +972-54-3995700
> Email: u...@speedy.net
> Website: http://www.speedysoftware.com/uri/en/
> 
> 
>  
> 
>
> --
> 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/CAMQ2MsH%2B95Vai_hLDBMOXx8Eb5KEUGL7HyPC0c9C5K_
> s8SEVBA%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/CAK4qSCepZH0NfYE%2Bw4Pm%2BTGHFvbuchMG6i5GNrxmwE-Qaif0rg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with sending django channels event from models

2018-07-31 Thread Andrew Godwin
Yes, you can't just call "group_send" without awaiting it, or you'll get
those warnings. You need async_to_sync, I'm afraid. Otherwise, you're not
actually waiting for the group_send function to finish and you'll start
getting some unreliable test results.

Andrew

On Tue, Jul 31, 2018 at 6:14 AM luan fonceca  wrote:

> Hello Andrew, sorry for the lack of traceback on the gist. I have changed
> my code a bit, i was using the `async_to_sync` but now i'm using this way
> inside my User save method:
>
> channel_layer = get_channel_layer()
> channel_layer.group_send(
> 'users_{}'.format(self.pk), {
> 'type': 'users.post_save',
> 'user_pk': self.pk
> }
> )
>
> And everything works fine, but my tests are raising warnings on each test,
> like this, if you want to see the full traceback of my test, click here
> 
> :
>
> users/tests/test_consumers.py::test_user_consumer
>   /Users/luan/Sources/channels-test/users/models.py:56: RuntimeWarning:
> coroutine 'RedisChannelLayer.group_send' was never awaited
> 'user_pk': self.pk
>
> I have update my gist, if you want to see something else, but in general
> i'm using py.test, as you can see in here
> 
> .
>
> https://gist.github.com/luanfonceca/dafecba067d4caa8bfcf22d683409531
>
>
> Thanks for everything, Andrew.
>
> Em sex, 27 de jul de 2018 às 19:30, Andrew Godwin 
> escreveu:
>
>> You need to post the full traceback, not just the last section. I suspect
>> what you are doing is calling model methods directly in an async function,
>> but I can't confirm that without a full traceback.
>>
>> Andrew
>>
>> On Thu, Jul 26, 2018 at 1:10 PM luan fonceca 
>> wrote:
>>
>>> Hello, i'm trying to implement a "post_save" signal wherever some user
>>> are update. I setup everything by following the documentation and some
>>> tutorials for Channels 2. I wrote a test using "py.test" to assert that
>>> everything is working as expected but i'm getting a exception
>>> 
>>> .
>>>
>>> On this link i have posted a gist.
>>> 
>>>
>>> Thanks in advance.
>>>
>>> --
>>>
>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>
>>
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/3f42ad5c-c737-4a5e-baad-54023261d7f5%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/3hZUiOvhSfE/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFwN1uomro%2B1-qkGC8ThJw6ehz%3DHTenXwUqx-xM%3DkzzTqNgQdg%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/CAPqSnxuydxQaBGb0FkS%3DWvyxN5TwuuPmnJ5Yx3msBDNR36%3Dx0A%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+uns

RE: Validating count + property of a Many2Many with a through table

2018-07-31 Thread Matthew Pava
Hi Sanjay,
You may want to try signals.
https://docs.djangoproject.com/en/2.0/topics/signals/


-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Sanjay Bhangar
Sent: Tuesday, July 31, 2018 1:09 PM
To: django-users@googlegroups.com
Subject: Validating count + property of a Many2Many with a through table

Hello!

This is more of a code organization question than a "something is not working" 
question - it might get slightly rambling, so if this kind of question is not 
your cup of tea, you have been warned :-)

So - I have a set of models like this (highly simplified):

class Item(models.Model):
  title = models.CharField(...)
  price = models.IntegerField(...)
  tags = models.ManyToManyField(Tag, through=ItemTag)

class Tag(models.Model):
  name = models.CharField(...)

class ItemTag(models.Model):
  item = models.ForeignKey(Item)
  tag = models.ForeignKey(Tag)
  is_primary = models.BooleanField()


So, I have an Item model that has some properties - it has a ManyToMany 
relationship with Tag, and one or more tags can be selected as "is_primary" 
tags for the model.

Now, to validate properties on the Item model, I call validation methods inside 
a "clean" method on the Item model, something like:

  def clean(self):
if self.price > 1:
  raise ValidationError('Price cannot be so high!")

This is simplified, but you get the idea - this works great, errors are 
propagated in the Admin, as well as raised when I import data via a CSV file 
for example. I know there's a few different places one can define validations - 
I personally like to have them in the model, but I would love to hear alternate 
view-points if this is not the best place to put them.

So, coming to the problem: there is now a requirement to validate that a model 
cannot have more than 3 primary tags associated with it - i.e.
cannot be associated with more than 3 tags with the through table specifying 
is_primary=True.

This, of course, cannot really go in the `clean` method of the Item model. The 
ItemTag relationships don't exist yet, and I don't have the data I need to be 
able to validate a maximum of 3 tags.

The problem is, I cannot seem to be able to do this kind of validation in the 
ItemTag model either, since it depends on knowing how many existing ItemTag 
relationships to Item there are - and before the entire transaction is 
committed to the database, a single ItemTag doesn't know whether the total 
exceeds the allowed 3.

The only place to put it that worked (and made sense) was in the Formset 
definition for the inline form in the admin.

So, we landed up over-riding the formset used for the ItemTag inline in the 
admin, adding our validations to the `clean` method - roughly
like:

class ItemImageInlineFormset(forms.models.BaseInlineFormSet):
def clean(self):
image_count = 0
for form in self.forms:
if form.cleaned_data.get('primary') == True:
image_count += 1
if image_count > 3:
raise ValidationError('Cannot have more than 3 primary tags')


This works. However, it seems a bit strange to have validations split between a 
model method, and a subclass of a formset of an admin form.
It seems confusing in terms of maintainability - also, writing tests for the 
validations in the model seemed a lot more straightforward when validations 
were just in the model's `clean` method.

I can see why this is so. Am just wondering if I'm getting something wrong in 
terms of patterns here / if there is a way other folks solve this, to, ideally, 
be able to have all the validation that pertains to a particular model in one 
place, and be able to test all model validations in a consistent manner.

Thank you to whoever read this far :-)

-Sanjay

--
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/CAG3W7ZFZnemOSOwDRjDN--JLKdF94QEJNrbuTw2MCPoK1QxP7Q%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/981a20654ff4b41e32c600464ddd%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Validating count + property of a Many2Many with a through table

2018-07-31 Thread Sanjay Bhangar
Hello!

This is more of a code organization question than a "something is not
working" question - it might get slightly rambling, so if this kind of
question is not your cup of tea, you have been warned :-)

So - I have a set of models like this (highly simplified):

class Item(models.Model):
  title = models.CharField(...)
  price = models.IntegerField(...)
  tags = models.ManyToManyField(Tag, through=ItemTag)

class Tag(models.Model):
  name = models.CharField(...)

class ItemTag(models.Model):
  item = models.ForeignKey(Item)
  tag = models.ForeignKey(Tag)
  is_primary = models.BooleanField()


So, I have an Item model that has some properties - it has a
ManyToMany relationship with Tag, and one or more tags can be selected
as "is_primary" tags for the model.

Now, to validate properties on the Item model, I call validation
methods inside a "clean" method on the Item model, something like:

  def clean(self):
if self.price > 1:
  raise ValidationError('Price cannot be so high!")

This is simplified, but you get the idea - this works great, errors
are propagated in the Admin, as well as raised when I import data via
a CSV file for example. I know there's a few different places one can
define validations - I personally like to have them in the model, but
I would love to hear alternate view-points if this is not the best
place to put them.

So, coming to the problem: there is now a requirement to validate that
a model cannot have more than 3 primary tags associated with it - i.e.
cannot be associated with more than 3 tags with the through table
specifying is_primary=True.

This, of course, cannot really go in the `clean` method of the Item
model. The ItemTag relationships don't exist yet, and I don't have the
data I need to be able to validate a maximum of 3 tags.

The problem is, I cannot seem to be able to do this kind of validation
in the ItemTag model either, since it depends on knowing how many
existing ItemTag relationships to Item there are - and before the
entire transaction is committed to the database, a single ItemTag
doesn't know whether the total exceeds the allowed 3.

The only place to put it that worked (and made sense) was in the
Formset definition for the inline form in the admin.

So, we landed up over-riding the formset used for the ItemTag inline
in the admin, adding our validations to the `clean` method - roughly
like:

class ItemImageInlineFormset(forms.models.BaseInlineFormSet):
def clean(self):
image_count = 0
for form in self.forms:
if form.cleaned_data.get('primary') == True:
image_count += 1
if image_count > 3:
raise ValidationError('Cannot have more than 3 primary tags')


This works. However, it seems a bit strange to have validations split
between a model method, and a subclass of a formset of an admin form.
It seems confusing in terms of maintainability - also, writing tests
for the validations in the model seemed a lot more straightforward
when validations were just in the model's `clean` method.

I can see why this is so. Am just wondering if I'm getting something
wrong in terms of patterns here / if there is a way other folks solve
this, to, ideally, be able to have all the validation that pertains to
a particular model in one place, and be able to test all model
validations in a consistent manner.

Thank you to whoever read this far :-)

-Sanjay

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


django-modeltranslation latest stable release not supporting Django 2.0

2018-07-31 Thread Uri Even-Chen
Hi,

We are using django-modeltranslation for Speedy Net and Speedy Match (
https://github.com/urievenchen/speedy-net). We are
using django-modeltranslation as well as other packages. I noticed
that django-modeltranslation latest stable release (0.12.2, from Jan. 26,
2018, see https://pypi.org/project/django-modeltranslation/#history) still
doesn't support Django 2.0. There is a beta release which supports Django
2.0 but we don't want to use beta releases in our project. I opened an
issue on GitHub (
https://github.com/deschler/django-modeltranslation/issues/472) and I'm
waiting for a stable release of django-modeltranslation which supports
Django 2.0. This is the only package we use which still doesn't support
Django 2.0 with a stable release. Can you help / join the project and
release a stable release which supports Django 2.0? We want to upgrade our
project to Django 2.0 and we can't do it due to this issue.

Thanks,
Uri.

*Uri Even-Chen*
[image: photo] Phone: +972-54-3995700
Email: u...@speedy.net
Website: http://www.speedysoftware.com/uri/en/
 
 


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


concurrency to request django multi url have problems

2018-07-31 Thread cnsongxiulu
concurrency to request two urls, django app get each url's header have 
problems.please jump to 
https://stackoverflow.com/questions/51606850/django-concurrency-request-two-url-each-request-header-is-wrong-to-each-url

-- 
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/53a07599-cbc3-4ae0-9686-2aeac9fe6207%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Live Streaming Video through WebCam

2018-07-31 Thread Pravin Yadav
*Hello Everyone, I'm using the Live Streaming Video through WebCam. It's
storing in .avi format. When i'm playing the Video. I'm not getting the
audio of that video. I hope that opencv does not provide the audio
features. Kindly let me know if you have any idea. Thanks,*


*Please find the below code:---*

import os.path
import numpy as np
import cv2, time
import random

def change_res(cap, width, height):
cap.set(3, width)
cap.set(4, height)

#Standard Video Dimensions Sizes
STD_DIMENSIONS = {
'480p': (640, 480),
'720p': (1280, 720),
'1080p': (1920, 1080),
'4k': (3840, 2160),
}

VIDEO_TYPE = {
'avi':cv2.VideoWriter_fourcc(*'XVID'),
'mp4':cv2.VideoWriter_fourcc(*'XVID'),
}

def get_video_type(filename):
ext = os.path.splitext(filename),
if ext in VIDEO_TYPE:
return VIDEO_TYPE[ext]
return VIDEO_TYPE['avi']

def get_dims(cap, res='480p'):
width, height = STD_DIMENSIONS['480p']
if res in STD_DIMENSIONS:
width, height = STD_DIMENSIONS[res]
change_res(cap, width, height)
return width, height

#--START LIVE VIDEO--#
random_id = random.randint(1,9)
livevideo_name = str('livevideo_'+str(random_id)+'.avi')
frames_per_second = 20.0  #..Frame Per Second
my_res = '480p'  #..Frame Size

# Capture video from camera
livevideos = '/livevideos/'+livevideo_name
cap = cv2.VideoCapture(-1)
dims = get_dims(cap, res=my_res)
video_type_cv2 = get_video_type(livevideos)

# Define the codec and create VideoWriter object
fourcc = cv2.VideoWriter_fourcc(*'XVID') # Be sure to use the lower case
out = cv2.VideoWriter(livevideos, video_type_cv2, frames_per_second, dims)
while(True):
ret, frame = cap.read()
if ret==True:
frame = cv2.flip(frame,1)
# Write the frame into the file
out.write(frame)
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break

# When everything done, release the video capture and video write objects
cap.release()
out.release()
# Closes all the frames
cv2.destroyAllWindows()

-- 
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/CAEr6%3DdzZyO44sDLkd-HPoqh-LCuuvvnRiXDfEeXWZduCxBuw4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Intregration Of on form submit user recive a sms in his phone

2018-07-31 Thread C. Kirby
Build your sms function in python. When the form is submitted fire off a 
celery task to send the sms

On Tuesday, July 31, 2018 at 9:32:02 AM UTC-4, im...@wsegames.com wrote:
>
> How to impement this feature Intregration Of on form submit user recive a 
> sms in his phone.
>

-- 
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/4ca48658-e48e-4af3-b24a-e04ecb3ca12e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Intregration Of on form submit user recive a sms in his phone

2018-07-31 Thread Aaron Jack
I use this company:

https://www.reach-interactive.com/

On Tuesday, 31 July 2018 14:32:02 UTC+1, im...@wsegames.com wrote:
>
> How to impement this feature Intregration Of on form submit user recive a 
> sms in his phone.
>

-- 
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/e818b28e-a933-4f5e-8759-4978e77e0605%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Intregration Of on form submit user recive a sms in his phone

2018-07-31 Thread imran
How to impement this feature Intregration Of on form submit user recive a 
sms in his phone.

-- 
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/aaa81e20-506b-4ac5-8767-c6e12b0b8b13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with sending django channels event from models

2018-07-31 Thread luan fonceca
Hello Andrew, sorry for the lack of traceback on the gist. I have changed
my code a bit, i was using the `async_to_sync` but now i'm using this way
inside my User save method:

channel_layer = get_channel_layer()
channel_layer.group_send(
'users_{}'.format(self.pk), {
'type': 'users.post_save',
'user_pk': self.pk
}
)

And everything works fine, but my tests are raising warnings on each test,
like this, if you want to see the full traceback of my test, click here

:

users/tests/test_consumers.py::test_user_consumer
  /Users/luan/Sources/channels-test/users/models.py:56: RuntimeWarning:
coroutine 'RedisChannelLayer.group_send' was never awaited
'user_pk': self.pk

I have update my gist, if you want to see something else, but in general
i'm using py.test, as you can see in here

.

https://gist.github.com/luanfonceca/dafecba067d4caa8bfcf22d683409531


Thanks for everything, Andrew.

Em sex, 27 de jul de 2018 às 19:30, Andrew Godwin 
escreveu:

> You need to post the full traceback, not just the last section. I suspect
> what you are doing is calling model methods directly in an async function,
> but I can't confirm that without a full traceback.
>
> Andrew
>
> On Thu, Jul 26, 2018 at 1:10 PM luan fonceca 
> wrote:
>
>> Hello, i'm trying to implement a "post_save" signal wherever some user
>> are update. I setup everything by following the documentation and some
>> tutorials for Channels 2. I wrote a test using "py.test" to assert that
>> everything is working as expected but i'm getting a exception
>> 
>> .
>>
>> On this link i have posted a gist.
>> 
>>
>> Thanks in advance.
>>
>> --
>>
> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>
>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/3f42ad5c-c737-4a5e-baad-54023261d7f5%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/3hZUiOvhSfE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFwN1uomro%2B1-qkGC8ThJw6ehz%3DHTenXwUqx-xM%3DkzzTqNgQdg%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/CAPqSnxuydxQaBGb0FkS%3DWvyxN5TwuuPmnJ5Yx3msBDNR36%3Dx0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Change the default route of a view

2018-07-31 Thread Andréas Kühne
For the view that I wrote, you won't need an id in the request or on the
url at all. It uses the currently logged in user for all of the requests.

You will need to pass some kind of token in the request - so that you know
which user is logged in.

But the url could be something like this:

urlpatterns = [
  path('/profile', views.UserProfileChangeAPIView.as_view(),
name='profile'),
]

That way the /profile url would be used for the view.

Regards,

Andréas

2018-07-30 17:35 GMT+02:00 Jason :

> its not a url, its a http verb.  rely on those for API requests.
>
> and it would be a user ID for that request.  if you're using oauth tokens,
> that should be handled in your view authenticator, not the view itself
>
> --
> 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/c36b4a7e-3c53-4805-9e45-35e22eb20357%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/CAK4qSCdcHGMe3inZKtM7A%2BzNiYjG%3DdQYVF7DvxF5rx0Mqfj-Vg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use multiple ForeignKeys

2018-07-31 Thread mottaz hejaze
put a foreign key in invoices model that points to vendor model .

On Tue, 31 Jul 2018, 00:38 Alexander Joseph, 
wrote:

> I'm building a Purchase Order app that uses a ForeignKey for Vendors. I
> want to be able to use another ForeignKey for invoices once a Vendor is
> selected. So the choices of Invoices would get filtered based on the users
> selection of the Vendor. How would I do this in the model? I assume I'd
> need ajax to load the invoices based on the Vendor in the template? 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/3c0e8bfb-30fb-467f-aa2f-58677e203480%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/CAHV4E-dSB2W2dAkAK_YtvLLyBj%3D33v8VaUtEH%2B1huXmRFu5jeA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.