Re: Django and Live Chat

2018-04-10 Thread Daniel Ash
If I was going to tackle this, I would use XMPP as the protocol.  If it's 
internal only it will be easier than if there is a requirement to federate 
external to your environment.  Someone already did some of the work for you.
https://github.com/fpytloun/django-xmpp


On Tuesday, April 10, 2018 at 12:53:29 AM UTC-5, Haroon Ahmed wrote:
>
> Hi,
>
> I am using Django 1.9.8 and Python 3.4.4, will upgrade my django to 
> 1.11,
> I want to create Chat functionality in my project, My requirement is 
> that application users can Live chat with Admin users and maintain chat 
> history of each user!
> Please suggest some packages or solution that i can customize 
> according to my requirement!
> 
> Any kind of hep will be appreciated in advance.
>
> Regards,
> Haroon Ahmed
>

-- 
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/6115ef29-8777-40a8-9ec8-a4f33140a7e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: select_related() / prefetch_related() and sharding

2015-05-21 Thread Ash Christopher
Hi David,

*select_related* does a JOIN under the hood, and you can't do
cross-database joins in the databases supported by Django. For
prefetch_related, there is no way out of the box to perform a
cross-database join in Python (which is what prefetch_related is doing) but
perhaps there is some way to programatically make that happen. I haven't
put any effort into exploring that idea.

Thanks,

On Thu, May 21, 2015 at 3:42 PM, David  wrote:

> Dear List,
>
> I came about conflicting information (to my mind) concerning the use of
> select_related() and prefetch_related().
> My question is whether you can combine select_related() and
> prefetch_related() with sharding techniques. If so, how are you doing it?
>
> Background:
> I was watching various videos on Django under load and Django scaling,
> generally there comes a point at which they point at database sharding.
> Ash Christopher (https://www.youtube.com/watch?v=frlsGUHYu04) points out
> that as you use multiple databases with your Application,
> select_related() and prefetch_related() can no longer be used. In
> Christophe Pettus' videos I have not found such a comment, in fact
> select_related() and prefetch_related() seem to be habitually
> recommended to speed database connections up.
>
> Thanks for your insights!
>
> David
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJdxA4uqMB_-ovXehbiUnqaX6Co6LP7LPMKAf88fb-Zb6VW_%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there a way to use 'request.user' in a custom template tag without an inclusion tag?

2012-07-29 Thread Ash Courchene
Well holy crap!! context['user'] worked perfectly! I thought I would have 
to come up with some crazy workaround!
Thank you kindly sir.


On Sunday, 29 July 2012 15:03:13 UTC-4, Ash Courchene wrote:
>
> So I made a custom template tag that allows pieces of content to be edited 
> by the site administrator with the click of a link.
> For instance, if i put {% editable 'index_block_one' %}, it would return 
> whatever content is in the Placeholder model I created with the name 
> "index_block_one".
> The code below, for the template tag:
>
> from django import template
> from django.contrib.auth.models import User
> from cms.models import Placeholder
>
> register = template.Library()
>
> @register.tag(name="editable")
> def do_editable(parser, token):
> try:
> tag_name, location_name = token.split_contents()
> except ValueError:
> raise template.TemplateSyntaxError("%r tag requires a single argument." % 
> token.contents.split()[0])
> if not(location_name[0] == location_name[-1] and location_name[0] in ('"', 
> "'")):
> raise template.TemplateSyntaxError("%r tag's arguments should be in 
> quotes." % tag_name)
> return EditableNode(location_name, context)
>
>
> class EditableNode(template.Node):
>  def __init__(self, location_name):
> self.location_name = location_name.encode('utf-8').strip("'")
>  def render(self, context):
> obj = Placeholder.objects.filter(location=self.location_name)
> if request.user.is_authenticated():
> for x in obj:
> return "%sedit" % (x, self.location_name)
> else:
> for x in obj:
> return x
>
>
> I want this to return a link that says "Edit" if the site administrator is 
> logged in, and just the content if the administrator is not logged in. 
> However, I get an error saying "*global name 'request' is not defined*". 
> I did put django.core.context_processors.request and .auth in my settings 
> file. And still nothing.
>
> So I did some research that said that an inclusion tag is the way to go, 
> except I don't have an html file as a template, because this template tag 
> is returning a Model object(??). There's no html to show. SO. Is there 
> a way to use request.user in this template tag without the use of an 
> inclusion tag? If someone could point me in the right direction, that'd be 
> great And hopefully all this made sense. Thanks again.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/JI7BDqMOMw0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Is there a way to use 'request.user' in a custom template tag without an inclusion tag?

2012-07-29 Thread Ash Courchene
So I made a custom template tag that allows pieces of content to be edited 
by the site administrator with the click of a link.
For instance, if i put {% editable 'index_block_one' %}, it would return 
whatever content is in the Placeholder model I created with the name 
"index_block_one".
The code below, for the template tag:

from django import template
from django.contrib.auth.models import User
from cms.models import Placeholder

register = template.Library()

@register.tag(name="editable")
def do_editable(parser, token):
try:
tag_name, location_name = token.split_contents()
except ValueError:
raise template.TemplateSyntaxError("%r tag requires a single argument." % 
token.contents.split()[0])
if not(location_name[0] == location_name[-1] and location_name[0] in ('"', 
"'")):
raise template.TemplateSyntaxError("%r tag's arguments should be in 
quotes." % tag_name)
return EditableNode(location_name, context)


class EditableNode(template.Node):
 def __init__(self, location_name):
self.location_name = location_name.encode('utf-8').strip("'")
 def render(self, context):
obj = Placeholder.objects.filter(location=self.location_name)
if request.user.is_authenticated():
for x in obj:
return "%sedit" % (x, self.location_name)
else:
for x in obj:
return x


I want this to return a link that says "Edit" if the site administrator is 
logged in, and just the content if the administrator is not logged in. 
However, I get an error saying "*global name 'request' is not defined*". I 
did put django.core.context_processors.request and .auth in my settings 
file. And still nothing.

So I did some research that said that an inclusion tag is the way to go, 
except I don't have an html file as a template, because this template tag 
is returning a Model object(??). There's no html to show. SO. Is there 
a way to use request.user in this template tag without the use of an 
inclusion tag? If someone could point me in the right direction, that'd be 
great And hopefully all this made sense. Thanks again.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ALmVHBTUqQUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Help required :(

2011-02-21 Thread Ash
Hi , I am new to Python and Django.

Can some please let me know -

1) can I use Django framework for my existing Python application.
2) or do I need to write the whole application again,
3) If I can use , can someone tell me how to proceed?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Alternative model without Database

2009-11-25 Thread ash
I don't know your problem in detail, but as alternative
I recommend read about twisted framework. If you work
with xmlrpc servers and you need in call remote methods,
then it help you. Simple exmaples:
http://twistedmatrix.com/documents/current/web/howto/xmlrpc.html

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Remote login via XML-RPC or SOAP?

2009-09-16 Thread ash

I recommend the following, every client must will be run XMLRPC
server,
which allow access for your with their database. You must developed
skeleton this XMLRPC server with uniform set of public methods,
every client himself realised this methods, because their databases
may
be different.

Base XMLRPC server is twisted framework. Look at these simple
examples:
http://twistedmatrix.com/projects/web/documentation/howto/xmlrpc.html

Django-based website will be give access for their servers and managed
their accounts.

On Sep 16, 4:14 pm, Rodrigo Cea  wrote:
> > Why do we need such a mechanism for the relationship between
> > client database and the master server. Maybe you need something
> > else entirely. Could you tell more general idea.
>
> The general idea is to allow users to register and login on our
> server, but store all the users information on our client's server,
> including authentication info. The client will not give us direct
> access to their database, but are willing to allow us a limited form
> of access via XML-RPC or SOAP, basically logging in users and
> retrieving some of their profile information.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Remote login via XML-RPC or SOAP?

2009-09-16 Thread ash

Why do we need such a mechanism for the relationship between
client database and the master server. Maybe you need something
else entirely. Could you tell more general idea.

On Sep 15, 12:16 pm, "djfis...@gmail.com" 
wrote:
> SOAP and XMLRPC have quite a few tradeoffs, but without knowing
> exactly what your setup is (other than Python/Django) I'd advise you
> to go with XMLRPC. However, I'll lay out why I think so and perhaps
> SOAP does make more sense for you.
>
> SOAP is the successor to XMLRPC and some people -- notably people from
> the Java and .NET worlds -- think that SOAP is "better". In the Java
> and .NET worlds, SOAP is pretty common but a lot of the scripting
> language worlds are moving toward a third option REST which I won't
> get into here since it doesn't seem to be an option for you. With
> Python, XMLRPC is built into the standard library where you'll have to
> go to Pypi for a SOAP library. Rolling your own SOAP library is
> probably not a good idea since SOAP is complex and verbose. In
> addition, there are occasionally incompatibilities with .NET SOAP
> services or so I've been led to believe from others at work.
>
> While SOAP is certainly more complex, in some cases it can make up for
> it with type checking, code generation or object translation. SOAP
> services usually make use of a web service description language
> document (WSDL) that describes the service and can contain XML schemas
> that describe in great detail the properties of the objects in the
> service. Using this, a SOAP library may be able to automatically take
> native objects and send them in web service calls or take web service
> responses and translate them into objects. It is possible that with a
> good library, you may need to write less code with SOAP. In general,
> XMLRPC in Python will translate your objects into requests and
> responses into objects, but XMLRPC only supports a few data types
> (int, float, list, dict, datetime) compared with SOAP. Possibly
> because of this lack of complexity, XMLRPC is pretty well standardized
> between various clients and servers. If you just need to use a couple
> services that your client is exposing and those services accept just a
> couple primitive parameters, XMLRPC is your best bet.
>
> On Sep 14, 7:07 pm, Rodrigo Cea  wrote:
>
>
>
> > I am creating a Django website for a client who won't give me access
> > to their database or server, but will allow login / account creation
> > on their server via SOAP or XML-RPC from my server, where the Django-
> > based website will reside.
> > I would like to get an idea beforehand about which route, SOAP or XML-
> > RPC, is easier, more stable, less buggy, more widely used, etc.
>
> > The process will be:
> > a) user inputs new account info on my server (lets call it D for
> > Django).
> > b) account is created on client's server (lets call it C for client)
> > c) C responds with Success or Fail.
> > d) next morning, user logs in via D
> > e) C responds with Success or Fail, plus some user info such as name,
> > age and other info gleaned during step (a).
> > f) D stores this information to use during the session and logs in
> > user.
>
> > Any help, caveats, libraries or suggestions are much appreciated.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---