How to include related_names in a mixing for a model?

2016-11-04 Thread Jonty Needham
So I have one model, which uses a ContentType to point to a collections of
models across separate apps.

I want to be able to "plug in" the functionality linking that model to the
other models in the separate app. So we have the follwing:


class MyModelMixin(models.Model):
""" Mixin to get the TheModel data into a MyModel
""
updated_date = models.DateTimeField(null=True, blank=True)
submission = GenericRelation(
TheModel,
related_query_name='the_related_name')
class Meta:
abstract = True



The main model model looks like this:

class TheModel(models.Model):
""" This tracks a specific submission of an SAQ by a specific site
"""
updated = models.DateTimeField()
status = models.CharField(max_length=32, blank=True, null=True)
final_score = models.DecimalField(
decimal_places=2, max_digits=30, default=-1,
)
config = models.ForeignKey(Config, blank=True, null=True)
content_type = models.ForeignKey(
ContentType,
blank=True,
null=True)
object_id = models.PositiveIntegerField(blank=True, null=True)
my_model_instance = GenericForeignKey()

And the mixin is included in the MyModel models, which are available in
many different apps.

so I've jsut realised that the related name on the GenericRelation will
only work for one model (at least it appears to, and I've had issues with
that before with related name clashes, which this would be. How should I
get round this? Updating the related_name will require a migration, so is
theer a way to do this dynamically using the mixin, or should it be
hardcoded per app in which it's referenced.

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


Re: Admin site - prepopulating field based on foreign key

2016-11-04 Thread Derek
You need a third-party app e.g.

https://github.com/digi604/django-smart-selects


On Thursday, 3 November 2016 19:21:14 UTC+2, dod...@gmail.com wrote:
>
> I'm having trouble with my admin site, would appreciate any pointers.
>
> I have these three models in my database with relationships as shown:
>
> class Customer(models.Model):
>   name=models.CharField(max_length=30)
>
> class Location(models.Model):
>   name=models.CharField(max_length=30)
>   customer = models.ForeignKey(Customer, on_delete = models.PROTECT)
>
> class License(models.Model):
>   location=models.ForeignKey(Location, on_delete=models.PROTECT)
>
>
> When the user creates a new License on the admin site, at the moment they 
> have to choose what location the License is at via a dropdown box (a very 
> long, confusing list), or create a new one if necessary.
>
> It would be much better if they could choose what Customer the license 
> belongs to, and then choose the Location from the list of locations that 
> have that customer as their foreign key.  They still may need to add a new 
> location or even a new customer when doing this.
>
> What is the easiest way to do this on the admin site?  
>
> I am thinking that I will have to create a new widget with two dropdowns, 
> and have the selection of the first make an AJAX query to populate the 
> second.  Am I on the right track?  How can I then tie in this custom widget 
> for the location field in License?
>
> I'm sure that this isn't a unique situation, but I haven't been able to 
> find any tutorial or solution showing how to handle a follow-the-foreign 
> key relationship.
>

-- 
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/3dddffa5-a4c1-4e64-a3fe-a15b0d39c701%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Negative User ID's

2016-11-04 Thread Nate Granatir
Or why not just assign certain Users to certain Groups? That seems like a 
much more clean and simple way of handling the problem. You'd be able to 
easily filter either set of users, and it would require very little custom 
code. Plus, doing something like assigning negative IDs disguises what 
you're actually trying to accomplish, whereas auto-assigning certain users, 
to, say, a group called "Service Accounts", is perfectly clear to anyone 
looking at the code.

Nate

On Wednesday, October 26, 2016 at 7:25:20 PM UTC-5, mic...@zanyblue.com 
wrote:
>
> Hi,
>
> The Django contrib User model is used to create accounts in Django 
> applications.  I would like to keep accounts associated with real people 
> separate from accounts created for mailing list and/or service accounts.  I 
> was planning on using negative ID's for these accounts and can't see any 
> issue with this from a Django or DB point of view (would need to create and 
> manage my own sequence for this).
>
> Can anyone see any issue with this?
>
> Take care,
> Michael.
>

-- 
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/9b047cee-4208-42fa-bd1d-613403dc1a87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: SQLAchemy

2016-11-04 Thread Nate Granatir
Yes, why are you using SQLAlchemy instead of Django's built-in ORM? I don't 
see any reason to even attempt this unless you need to perform operations 
outside the context of Django. 

On Wednesday, November 2, 2016 at 2:09:18 AM UTC-5, pradam.programming 
wrote:
>
> hi,
> I am new to SqlAchemy.My questions are as follows:
> 1.When i write tables in sql achemy format i can't able to do 
> makemigrations and migrate..?
> 2.In SqlAchemy Explicitly i need to specify  database whenever i do CRUD 
> operations ?
> 3.Whats the main advantage over SQLAchemy vs Django OMR.?
>
>

-- 
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/57c94673-64b3-436f-ba70-5eb6921f9b7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Class Based Views VS DRY principle

2016-11-04 Thread Artem Bernatskyy
Hello.

Suppose i have a code (http://pastebin.com/6rUqKD8q)

And in CBV there are a bunch of methods with EXACTLY the same code.

My question is - can i somehow inherit them from ONE place, in order to be 
able to edit them from one place ?

Thanks for replies.

-- 
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/51ca427d-732a-4223-bf27-59fa7b346295%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Class Based Views VS DRY principle

2016-11-04 Thread Matthew Pava
Just create another CBV that factors out all of the similarities between all of 
the other CBVs.  Then inherit from your new CBV to create your more specific 
ones.  Basically instead of inheriting from the Django CBVs, you will inherit 
from your own.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Artem Bernatskyy
Sent: Friday, November 4, 2016 10:56 AM
To: Django users
Subject: Class Based Views VS DRY principle

Hello.

Suppose i have a code (http://pastebin.com/6rUqKD8q)

And in CBV there are a bunch of methods with EXACTLY the same code.

My question is - can i somehow inherit them from ONE place, in order to be able 
to edit them from one place ?

Thanks for replies.
--
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/51ca427d-732a-4223-bf27-59fa7b346295%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/9498a12178a74e8a985b8d744d6e3403%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Django 1.10.3 with Oracle database and --keepdb

2016-11-04 Thread Carsten Fuchs

Dear Django fellows,

using Django 1.10.3 with Oracle database, is running

  ./manage.py test --keepdb

supposed to work without having an explicit test password set?

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.oracle',
# ...
'TEST': {
# --keepdb no longer works for me without this:
'PASSWORD': 'password',
}
}
}

In other words, without setting an explicit (non-random) password, database 
errors are expected when starting the tests with --keepdb ?


Best regards,
Carsten

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4742229b-49ae-0a1f-0757-e478239261fa%40cafu.de.
For more options, visit https://groups.google.com/d/optout.


How to handle Video/Audio streaming using Django Channels?

2016-11-04 Thread Sandro Salles
Hello Guys,

I can't find any documentation on how to handle video/audio streaming using 
Django Channels.


I've found an incomplete tutorial here:
https://artandlogic.com/2016/06/django-channels-ground-part-1/
https://artandlogic.com/2016/06/django-channels-ground-part-2/


But as i said, it's incomplete...


Can someone give-me a hand here? I really have absolutely no idea on how to 
implement this, although i think it's possible.


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/44eb8328-836c-4e52-843f-5e7ba5533b46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Related name with %(app_label)s being an actual field?

2016-11-04 Thread Jonty Needham
Hi,

In an attempt to fix my earlier query about related names etc, it would
appear that I've (half() fixed my issue.

I now have:

submission = GenericRelation(
MyModel,
related_query_name='%(app_label)s_related_name')

So that's good and gives me the related names. However, when I come to use
django filters, I get hit with the message:

FieldError: Cannot resolve keyword 'my_app_name_related_name into field.
Choices are: %(app_label)s_related_name, etc etc etc.


What is causing this and how do I not have 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/CANOQRby2u9f3-qR8nP1e%3DZBfzpT_NBX8RuwDrfd7_j5tfQuKYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to hook into the admin site to count login attempts with REST API / proxy?

2016-11-04 Thread Daniel Grace
Hello, I have a REST API which is not publicly accessible as it is behind a 
proxy.  However the admin site is publicly available through an NGINX 
server.  The REST API already has functionality to count failed login 
attempts and I would like to duplicate that functionality on the admin 
login page.  How do I hook into the admin login page and add the 
appropriate code?  Can I still use Django Axes or should I create my own 
login form as a replacement?
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/69ea593b-4c5e-4eb6-ab9f-fa4639d17445%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to handle Video/Audio streaming using Django Channels?

2016-11-04 Thread Andrew Godwin
Hi Sandro,

Could you highlight what the problems you're facing are? Channels is not
particularly designed for streaming large files - you're better doing that
using a CDN or dedicated file streaming software - so I'd be curious to
know what the particular issues you're facing are.

Andrew

On Fri, Nov 4, 2016 at 5:31 PM, Sandro Salles  wrote:

> Hello Guys,
>
> I can't find any documentation on how to handle video/audio streaming
> using Django Channels.
>
>
> I've found an incomplete tutorial here:
> https://artandlogic.com/2016/06/django-channels-ground-part-1/
> https://artandlogic.com/2016/06/django-channels-ground-part-2/
>
>
> But as i said, it's incomplete...
>
>
> Can someone give-me a hand here? I really have absolutely no idea on how
> to implement this, although i think it's possible.
>
>
> 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/44eb8328-836c-4e52-843f-5e7ba5533b46%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/CAFwN1uozrjLW2eNFoRAZLzkhu_RLkWBfnVUmvhq9GcB69893HQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to handle Video/Audio streaming using Django Channels?

2016-11-04 Thread Sandro Salles
Hey Andrew,

In fact i'm trying to implement a real-time video chat application, using
react native on a mobile app (iOS).

The app will capture the users video using a module
called react-native-webrtc, and send the live stream via websocket to a
Django application (using Django Channels) that will then stream that video
in real time to all clients that are connect to this video channel.

The problem is that i don't know how to handle the incoming video/audio
stream. All the examples i found for Django Channels are for text based
chats and things like that... but nothing about the ability to handle media
streams...

I know i could use NodeJS on the server-side, socket.io and some others
node modules, but i would really like to use Django to accomplish that.

Do you think this is even possibile?

Thanks again!

*Sandro Salles*
e-mail. san...@snippet.com.br
telefone. (11) 99203-9014 (cel/whatsapp)


On Fri, Nov 4, 2016 at 2:49 PM, Andrew Godwin  wrote:

> Hi Sandro,
>
> Could you highlight what the problems you're facing are? Channels is not
> particularly designed for streaming large files - you're better doing that
> using a CDN or dedicated file streaming software - so I'd be curious to
> know what the particular issues you're facing are.
>
> Andrew
>
> On Fri, Nov 4, 2016 at 5:31 PM, Sandro Salles 
> wrote:
>
>> Hello Guys,
>>
>> I can't find any documentation on how to handle video/audio streaming
>> using Django Channels.
>>
>>
>> I've found an incomplete tutorial here:
>> https://artandlogic.com/2016/06/django-channels-ground-part-1/
>> https://artandlogic.com/2016/06/django-channels-ground-part-2/
>>
>>
>> But as i said, it's incomplete...
>>
>>
>> Can someone give-me a hand here? I really have absolutely no idea on how
>> to implement this, although i think it's possible.
>>
>>
>> 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/ms
>> gid/django-users/44eb8328-836c-4e52-843f-5e7ba5533b46%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/CAFwN1uozrjLW2eNFoRAZLzkhu_RLkWBfnVUmvhq9GcB69893HQ%
> 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/CADJ0nrOOszYvvT40aZhYptMVqjrdd0yY-2T0ra-oNC%3DfuQwKgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Negative User ID's

2016-11-04 Thread michael
Hi,

The normal user table will be synced from another application that doesn't 
allow non-real users.  To support future integration, I need to ID's to be 
common across the two apps.  The positive ID range is, in a sense, not 
available at this time.  My real question was "is there any issue using 
negative IDs".

Take care,
Michael.

On Friday, November 4, 2016 at 8:37:30 AM UTC-7, Nate Granatir wrote:
>
> Or why not just assign certain Users to certain Groups? That seems like a 
> much more clean and simple way of handling the problem. You'd be able to 
> easily filter either set of users, and it would require very little custom 
> code. Plus, doing something like assigning negative IDs disguises what 
> you're actually trying to accomplish, whereas auto-assigning certain users, 
> to, say, a group called "Service Accounts", is perfectly clear to anyone 
> looking at the code.
>
> Nate
>
> On Wednesday, October 26, 2016 at 7:25:20 PM UTC-5, mic...@zanyblue.com 
> wrote:
>>
>> Hi,
>>
>> The Django contrib User model is used to create accounts in Django 
>> applications.  I would like to keep accounts associated with real people 
>> separate from accounts created for mailing list and/or service accounts.  I 
>> was planning on using negative ID's for these accounts and can't see any 
>> issue with this from a Django or DB point of view (would need to create and 
>> manage my own sequence for this).
>>
>> Can anyone see any issue with this?
>>
>> Take care,
>> Michael.
>>
>

-- 
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/395c3fd4-f3dc-48ca-a5cf-a38a78201f3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Negative User ID's

2016-11-04 Thread Javier Guerra Giraldez
On 4 November 2016 at 17:17,  wrote:

> To support future integration, I need to ID's to be common across the two
> apps.


that's what foreign keys are for


-- 
Javier

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


Re: Django ponycheckup check up results

2016-11-04 Thread Sandeep Patil
Dear all,

Noone else here who has this issue? Really would like to learn how this 
works.

Thanks,
Sandeep

On Saturday, September 17, 2016 at 9:29:29 PM UTC+2, Sandeep Patil wrote:
>
> Dear All,
>
> I checked my django site a security ponycheckup at ponycheckup.com and I 
> got 90%, which is good. However I am stuck at resolving the error "
> Web server allows TRACE
> Your web server allows the TRACE method. This is not good, as it rarely 
> serves a purpose, and can be used in cross-site scripting attacks."
>
> I tried to look around for answers and most of them had solutions for 
> modifying htaccess file. Since I use AWS EB, I dont want to manually modify 
> any server files (because they get overwritten and writing a EB command 
> looks very hacky). Is there a Django way of resolving this issue (some 
> setting in settings.py)?
>
>
>
>
>

-- 
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/1c3425eb-1e44-4297-8d3b-7925b5c24313%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Django ponycheckup check up results

2016-11-04 Thread Matthew Pava
I am just a regular user, but I don’t see how a Django setting could possibly 
modify some such a setting on the web server.  I would just learn how to write 
that EB command and take it from there.  …I suppose you could try writing a 
Python function or a Django command that will append your desired setting to 
the .htaccess file when you run it.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Sandeep Patil
Sent: Friday, November 4, 2016 12:27 PM
To: Django users
Subject: Re: Django ponycheckup check up results

Dear all,

Noone else here who has this issue? Really would like to learn how this works.

Thanks,
Sandeep

On Saturday, September 17, 2016 at 9:29:29 PM UTC+2, Sandeep Patil wrote:
Dear All,

I checked my django site a security ponycheckup at 
ponycheckup.com and I got 90%, which is good. However I 
am stuck at resolving the error "
Web server allows TRACE
Your web server allows the TRACE method. This is not good, as it rarely serves 
a purpose, and can be used in cross-site scripting attacks."

I tried to look around for answers and most of them had solutions for modifying 
htaccess file. Since I use AWS EB, I dont want to manually modify any server 
files (because they get overwritten and writing a EB command looks very hacky). 
Is there a Django way of resolving this issue (some setting in settings.py)?




--
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/1c3425eb-1e44-4297-8d3b-7925b5c24313%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/398c2ea5261b41e6a4f8fd10da750ab1%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Negative User ID's

2016-11-04 Thread Vinicius Assef
On 4 November 2016 at 15:17,   wrote:
> My real question was "is there any issue using
> negative IDs".


I'd check it with the database backend. I mean, read its documentation.

And make a double check on the django side. Maybe contacting one of
core developers.

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


Re: Negative User ID's

2016-11-04 Thread michael
Unfortunately, the apps are currently in different DB's.

On Friday, November 4, 2016 at 10:26:34 AM UTC-7, Javier Guerra wrote:
>
>
> On 4 November 2016 at 17:17, > wrote:
>
>> To support future integration, I need to ID's to be common across the two 
>> apps.
>
>
> that's what foreign keys are for
>
>
> -- 
> Javier
>

-- 
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/02af3f30-447a-4c9b-b5dd-2eaddca7f348%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin site - prepopulating field based on foreign key

2016-11-04 Thread Rafael E. Ferrero
Or you can filter the select with this



Rafael E. Ferrero

2016-11-04 12:36 GMT-03:00 Derek :

> You need a third-party app e.g.
>
> https://github.com/digi604/django-smart-selects
>
>
> On Thursday, 3 November 2016 19:21:14 UTC+2, dod...@gmail.com wrote:
>>
>> I'm having trouble with my admin site, would appreciate any pointers.
>>
>> I have these three models in my database with relationships as shown:
>>
>> class Customer(models.Model):
>>   name=models.CharField(max_length=30)
>>
>> class Location(models.Model):
>>   name=models.CharField(max_length=30)
>>   customer = models.ForeignKey(Customer, on_delete = models.PROTECT)
>>
>> class License(models.Model):
>>   location=models.ForeignKey(Location, on_delete=models.PROTECT)
>>
>>
>> When the user creates a new License on the admin site, at the moment they
>> have to choose what location the License is at via a dropdown box (a very
>> long, confusing list), or create a new one if necessary.
>>
>> It would be much better if they could choose what Customer the license
>> belongs to, and then choose the Location from the list of locations that
>> have that customer as their foreign key.  They still may need to add a new
>> location or even a new customer when doing this.
>>
>> What is the easiest way to do this on the admin site?
>>
>> I am thinking that I will have to create a new widget with two dropdowns,
>> and have the selection of the first make an AJAX query to populate the
>> second.  Am I on the right track?  How can I then tie in this custom widget
>> for the location field in License?
>>
>> I'm sure that this isn't a unique situation, but I haven't been able to
>> find any tutorial or solution showing how to handle a follow-the-foreign
>> key relationship.
>>
> --
> 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/3dddffa5-a4c1-4e64-a3fe-a15b0d39c701%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/CAJJc_8WdOBZ1m%2BO%3DA9KSCcch58N_u47rL7hEmbBaa76rEfM4fA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Class Based Views VS DRY principle

2016-11-04 Thread Artem Bernatskyy
TNX

On Friday, November 4, 2016 at 5:56:56 PM UTC+2, Artem Bernatskyy wrote:
>
> Hello.
>
> Suppose i have a code (http://pastebin.com/6rUqKD8q)
>
> And in CBV there are a bunch of methods with EXACTLY the same code.
>
> My question is - can i somehow inherit them from ONE place, in order to be 
> able to edit them from one place ?
>
> Thanks for replies.
>

-- 
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/f06fc25d-1a77-40e4-b6ba-0b987ed7f03f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django1.9 Mongodb support

2016-11-04 Thread Sudhir kumar Giri
Hello,
 I didn't find any documentation or tutorial for Django-1.9 with Mongodb.
Please suggest some docs about it.
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/03af85ac-951a-449d-8078-01433efd384d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django1.9 Mongodb support

2016-11-04 Thread Michal Petrucha
On Fri, Nov 04, 2016 at 12:33:51PM -0700, Sudhir kumar Giri wrote:
> Hello,
>  I didn't find any documentation or tutorial for Django-1.9 with Mongodb.
> Please suggest some docs about it.
> Thanks

Hi,

Django does not have any specific support for mongodb. Of course, you
can just use Django without its ORM, and simply use some other Python
library to access mongo.

There used to be a few projects trying to bring support for
nonrelational database (with most focus on mongo) to Django's ORM, but
the entire point of an ORM is sort of to serve as a layer on top of
relational data stores, and the last time I checked, neither of those
projects was maintained anymore.

May I ask if you have any specific reason to want to use mongo with
Django? If not, you're most likely better off using Postgres instead,
which has excellent support in Django.

Cheers,

Michal

-- 
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/20161104212437.GL8307%40konk.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Digital signature


Re: How to handle Video/Audio streaming using Django Channels?

2016-11-04 Thread Andrew Godwin
Hi Sandro,

Real-time video streaming is pretty intensive, and WebRTC already has some
part of this covered, though from what I recall it's in a peer-to-peer
fashion. You certainly could marshal it into binary websocket frames, but
WebSocket is a non-ideal protocol for video delivery due to the way it's
designed.

Really, to do something like this properly would require native WebRTC
support in Channels, and we don't have that (yet). I'd suggest looking into
other software solutions to relay video streams instead.

Andrew

On Fri, Nov 4, 2016 at 6:09 PM, Sandro Salles  wrote:

> Hey Andrew,
>
> In fact i'm trying to implement a real-time video chat application, using
> react native on a mobile app (iOS).
>
> The app will capture the users video using a module
> called react-native-webrtc, and send the live stream via websocket to a
> Django application (using Django Channels) that will then stream that video
> in real time to all clients that are connect to this video channel.
>
> The problem is that i don't know how to handle the incoming video/audio
> stream. All the examples i found for Django Channels are for text based
> chats and things like that... but nothing about the ability to handle media
> streams...
>
> I know i could use NodeJS on the server-side, socket.io and some others
> node modules, but i would really like to use Django to accomplish that.
>
> Do you think this is even possibile?
>
> Thanks again!
>
> *Sandro Salles*
> e-mail. san...@snippet.com.br
> telefone. (11) 99203-9014 (cel/whatsapp)
>
>
> On Fri, Nov 4, 2016 at 2:49 PM, Andrew Godwin  wrote:
>
>> Hi Sandro,
>>
>> Could you highlight what the problems you're facing are? Channels is not
>> particularly designed for streaming large files - you're better doing that
>> using a CDN or dedicated file streaming software - so I'd be curious to
>> know what the particular issues you're facing are.
>>
>> Andrew
>>
>> On Fri, Nov 4, 2016 at 5:31 PM, Sandro Salles 
>> wrote:
>>
>>> Hello Guys,
>>>
>>> I can't find any documentation on how to handle video/audio streaming
>>> using Django Channels.
>>>
>>>
>>> I've found an incomplete tutorial here:
>>> https://artandlogic.com/2016/06/django-channels-ground-part-1/
>>> https://artandlogic.com/2016/06/django-channels-ground-part-2/
>>>
>>>
>>> But as i said, it's incomplete...
>>>
>>>
>>> Can someone give-me a hand here? I really have absolutely no idea on how
>>> to implement this, although i think it's possible.
>>>
>>>
>>> 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/ms
>>> gid/django-users/44eb8328-836c-4e52-843f-5e7ba5533b46%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/ms
>> gid/django-users/CAFwN1uozrjLW2eNFoRAZLzkhu_RLkWBfnVUmvhq9Gc
>> B69893HQ%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/CADJ0nrOOszYvvT40aZhYptMVqjrdd0yY-2T0ra-oNC%3DfuQwKgw%
> 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 
t