why get_object_or_404 error is not using translation?

2024-05-18 Thread Hossein Mahdavipour
Hi. I am using DRF with django. In views I use get_object_or_404. When I get a 404, the exception detail is "No %s matches the given query." You can see the code here: https://github.com/django/django/blob/8f205acea94e93a463109e08814f78c09307f2b9/django/shortcuts.py#L88 My question is why it doe

Djnago User login

2017-03-01 Thread Hossein Torabi
is there any method that i have two kind of users that once log in with user name and password and other one login with just with user name? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving email

Re: how to use view function in another function of view in django

2016-06-15 Thread hossein
dn’t treat them as special/holy/uncallable. > > Best, > Gergely > On Jun 15, 2016 19:56, "hossein" wrote: > >> def base(request): >> j=Job.objects.all() >> a=Ab.objects.all() >> return render(request,'base.html',{'j

how to use view function in another function of view in django

2016-06-15 Thread hossein
def base(request): j=Job.objects.all() a=Ab.objects.all() return render(request,'base.html',{'j':j, 'a':a}) def index(request): base(request) x=X.objects.all() return render(request, 'index.html',{'x':x}) def list(request): base(request) z=Z.objects.all() ret

NoReverseMatch error in django 1.8

2015-09-27 Thread hossein
this is my views and url.py as long as use tag in my template show error url urlpatterns = [ url(r'^bookee/$', views.index, name='index'), url(r'^bookee/user/(?P[a-z0-9-._@+]\w+)/$', views.uprofile, name='userprofile'), url(r'^bookee/user/(?P[a-z0-9-._@+]\w+)/book/(?P\d)/$', views.

django-users@googlegroups.com

2015-02-24 Thread Hossein Rashnoo
I use below code to authenticate in SharePoint in my view: import sudsimport logging logging.basicConfig(level=logging.INFO) logging.getLogger('suds.client').setLevel(logging.DEBUG) from suds.client import Client url = 'http://portal:8080/rashno/_vti_bin/lists.asmx?WSDL' from suds.transport.ht

Redirect to external url with parameters in django

2015-01-26 Thread Hossein Rashnoo
I want when a user do something in my view then i redirect him to another website with some parameters as POST method Like when you submit a form. I think its may be something like this: return HttpResponseRedirect("url","parameters") How can i do that? -- You received this message because

Create Django token-based Authentication

2015-01-26 Thread Hossein Rashnoo
I have my authentication service on django. I want to role as web-service to gave other website a token and authenticate users with that token. This is my scenario: 1. user visit external website and try to login 2. when hit the login button that website redirect user to my site to u

Re: Using jquery ajax POST method with django

2015-01-17 Thread Hossein Rashnoo
dumps(response_data), content_type="application/json") *And i comment out django.middleware.csrf.CsrfViewMiddleware in setting* On Saturday, January 17, 2015 at 9:16:32 AM UTC+3:30, Hossein Rashnoo wrote: > > I use this code to send a request: > > function checkuser() { > $.aj

Using jquery ajax POST method with django

2015-01-16 Thread Hossein Rashnoo
I use this code to send a request: function checkuser() { $.ajax({ url: 'http://10.252.84.159/ajaxrecivelogin', //type: 'POST', data: "{'username': 'aa', 'password' : 'bb'}", context: this, dataType: 'json', success: function (data) {

Re: I can send mail with shell but can't sent mail via view

2015-01-09 Thread Hossein Rashnoo
l ESMTP..." line, you should be in good shape. Normally I would >> expect to see "250-STARTTLS" as one of the options (indicating TLS is >> supported). >> >> Another option would be to try using the IP rather than the name for >> EMAIL_HOST. In t

Re: I can send mail with shell but can't sent mail via view

2015-01-08 Thread Hossein Rashnoo
esponse means that the domain is either typed incorrectly, or > just doesn't exist out on the wild Internet (or wherever your DNS server > recursively looks for you) > > That command should work on Windows and most Linux distributions (some > Linux systems include th

I can send mail with shell but can't sent mail via view

2015-01-08 Thread Hossein Rashnoo
Hi I use this settings to send email: settings.py EMAIL_HOST = "mail.xx.ir" EMAIL_PORT = "25" EMAIL_HOST_USER = "xx...@xxx.ir" EMAIL_HOST_PASSWORD = "" EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' DEFAULT_FROM_EMAIL = 'xx...@xxx.ir' and in python shell: from django.c

Re: Create an OAuth2 Client Application problem

2014-12-31 Thread Hossein Rashnoo
I did a stupid mistake. I use oauth2 before using django auth and create user. On Wednesday, December 31, 2014 10:33:34 AM UTC+3:30, Hossein Rashnoo wrote: > > Hi > I follow this tutorial and here > <https://django-oauth-toolkit.readthedocs.org/en/0.7.0/tutorial/tutorial_01

Create an OAuth2 Client Application problem

2014-12-30 Thread Hossein Rashnoo
Hi I follow this tutorial and here i got error. when i try to access http://localhost:8000/o/applications/ its redirect to http://localhost:8000

Re: uni-code error in python : 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

2014-12-28 Thread Hossein Rashnoo
I Solved that with this code: fname = fname.encode('ascii', 'xmlcharrefreplace') xml = r"""my XML code with unicode {0} """.format(fname) On Monday, December 29, 2014 11:03:49 AM UTC+3:30, Hossein Rashnoo wrote: > > Hi > I use djan

uni-code error in python : 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

2014-12-28 Thread Hossein Rashnoo
Hi I use django and in my view i need to send a request as XML with some uni-code character that received from html page with post method. I tried these (Note that i save that input in fname variable) : xml = r"""my XML code with uni-code {0} """.format(fname) And fname = u"%s".encod

problem with using suds and sharepoint

2014-12-19 Thread Hossein Rashnoo
I tried to add attachment to a sharepoint document library with this command: result = client.service.AddAttachment("new doc","2","ab.ds","QUJDREVGR0hJSktMTU5PUA==") but i got this error: DEBUG:suds.client:sending to (http://portal:8080/rashno/_vti_bin/lists.asmx) message: http://schemas.xmls

Using django-nocaptcha-recaptcha problem

2014-12-17 Thread Hossein Rashnoo
Hi, I use *django-nocaptcha-recaptcha* in my site and it worked perfect. But after that i tried several times for fill a form , google not recognize me as human with a click and tried to show me a challenge image. *The problem is **challenge image not appear.*I attached the photo of this pro

Open a url with user and password

2014-12-07 Thread Hossein Rashnoo
I want to create a web-service for connection to sharepoint that do something like create a list and ... So at first step because we use sharepoint with local ip i want to check if i can connect to our sharepoint portal via my server or not. So i looking for something like : urllib2.urlopen("htt

Re: Connect django project with sharepoint 2013

2014-12-06 Thread Hossein Rashnoo
he url http:// portal:8080. I assume that you can't > visit that url from the browser either > On 07/12/2014 3:46 pm, "Hossein Rashnoo" > > wrote: > >> I need this connection for adding list items and save my users data on >> sharepoint database. I ran i

Re: Connect django project with sharepoint 2013

2014-12-06 Thread Hossein Rashnoo
, in do_open raise URLError(err) URLError: On Saturday, December 6, 2014 4:19:45 PM UTC+3:30, François Schiettecatte wrote: > > Ok, but I am not sure what this has to do with Django ? Maybe you should > ask on a SharePoint mailing list ? And did you try running the code in a >

Connect django project with sharepoint 2013

2014-12-06 Thread Hossein Rashnoo
I need to connect my project to sharepoint. So i installed "sharepoint 0.4.1" package and then use this code in my view : from sharepoint import SharePointSite, basic_auth_opener def userloginres(request): server_url = "http://portal:8080/"; site_url = server_url + "rashno/" opener = basic_auth_

Re: Django install packages using pip

2014-11-24 Thread Hossein Rashnoo
the problem was i use python2.6 with django 1.7 and when install django 1.6 problem solved -- 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

Re: Useing non-ascii character in django

2014-11-09 Thread Hossein Rashnoo
Writing my code with linux editor cause the problem,I wrote that with notepad and save it as 'utf8' and my problem solved. On Saturday, November 8, 2014 11:49:10 AM UTC+3:30, Hossein Rashnoo wrote: > > When i return Persian characters in view.py (same as Arabic characters) i >

Useing non-ascii character in django

2014-11-08 Thread Hossein Rashnoo
When i return Persian characters in view.py (same as Arabic characters) i got an error , So i add this line to top of view.py: # encoding=utf-8 And now my Persian word is like this : � And when i add 'u' before my word again i got error,I run django on Linux with Apache. Please help me and s

os.system not working for me!

2011-08-02 Thread dR Hossein
Hi every body! I want to get backup from my db with os.system command. but it's not work for me. \ this is the code that I'm using: * os.system("mysqldump --user root password=123 test_db > d:/test.sql") * any body know about this issue? -- You received this message because you are subscribed

Re: SQL Join in Django

2008-11-07 Thread Hossein
Thanks for your help. I am so close to what I want. The output that I want is an XML file. So I try: reporter = Reporter.objects.get(id=10) arts = reporter.article_set.all() xmlout = serialize('xml',arts,fields=('date','reporter.name')) However, it writes date but it does not w

Re: SQL Join in Django

2008-11-07 Thread Hossein
Many thanks tim for your quick reply. You are right I meant inner join not cart product. I tried your suggested solution and instead of printing the result I use Django serializer to create an XML file. But it seems that something is taking too long and my browser just stalls. Is it because of sel

SQL Join in Django

2008-11-07 Thread Hossein
Hi, I am a newbie and am trying to select fields from two table related to each other using a foreign key: class Reporter() id primary key name e-mail ... class Article() reporter = model.ForeignKey(reporter) date ... Now I want to implement the following SQL s