Re: Redirect to external url with parameters in django

2015-01-26 Thread Stephen J. Butler
Use django.utils urlencode. return HttpResponseRedirect(base_url + '?' + urlencode(params)) Note that a redirect is always turned into a GET request, never a POST. If you really need POST you'll have to construct a page with the proper form elements, and then either have the user submit it

Re: django views error

2015-01-26 Thread Stephen J. Butler
Not all your lines have the same indent level in your profile method. Line 52. On Tue, Jan 27, 2015 at 1:03 AM, Mosharof sabu wrote: > my view > > > def index(request): > category_list = Status.objects.filter(comment__startswith="d") > context_dict = {'categories':

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

Re: forloop

2015-01-26 Thread James Schneider
Instead of looping through the all() set of objects (which works quickly with small sets of objects, imagine >20K objects, that would be noticeably slower, probably seconds or more), you should just query the object you want directly using something like: obj =

django views error

2015-01-26 Thread Mosharof sabu
my view def index(request): category_list = Status.objects.filter(comment__startswith="d") context_dict = {'categories': category_list} return render(request, 'idesk/index.html', context_dict) it shows result in index.html page but when i try to show query in profile.html page like

Re: Django default auth user but unique email

2015-01-26 Thread James Schneider
If you want any sort of enforcement of a unique email address at the database level, you'll need a custom user model. If you don't care about that, all you'd need to do is override the user forms and create a custom clean_email function that checks for duplicates before saving the form data. Not

Re: iterate

2015-01-26 Thread Lachlan Musicman
Of course, although it depends on what your definition of "earliest" is (most likely you mean from a data entry perspective), and what fields and field types you have. You could sort by date, if you have a creation date field, you could sort by ID/PK if you haven't changed that field on the

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

iterate

2015-01-26 Thread sum abiut
is it possible to iterate through a number of rows to find out which row was the earliest to be enter. cheers, -- 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

read GET and POST simultaneously?

2015-01-26 Thread Eric Abrahamsen
As far as I can tell (testing with the Conkeror web browser), it's possible to read both GET and POST at once: if a user POSTs to a URL containing GET parameters, you can get them both in the view. Is this reliable behavior across browsers? Is it a dumb idea for reasons I haven't thought of? A

Re: Django default auth user but unique email

2015-01-26 Thread Bruce Li
To be more specific, I want the username and email in default user model both to be unique and not blank. On Tuesday, January 27, 2015 at 10:56:14 AM UTC+8, Bruce Li wrote: > > Hi, > > I want to build my user management based on default django users. But I > want emails to be unique as well. Is

Django default auth user but unique email

2015-01-26 Thread Bruce Li
Hi, I want to build my user management based on default django users. But I want emails to be unique as well. Is it possible to do that without the need to create a custom user model and user managment? Thanks, - Bruce -- You received this message because you are subscribed to the Google

Putting picture thumbnails within admin page

2015-01-26 Thread bradford li
I am trying to put thumbnail pictures of my photos within my admin page. I am currently running into the issue where the thumbnail isn't displayed, when I click on thumbnail I am redirected to the homepage of my project with this as the URL:

Re: forloop

2015-01-26 Thread sum abiut
Here is how it looks like, when a new row is added it display last. [image: Inline image 1] On Tue, Jan 27, 2015 at 10:51 AM, Stephen J. Butler < stephen.but...@gmail.com> wrote: > Do you have a default ordering on the Model object? That is, an > ordering option on newleave.Meta? Because

Re: forloop

2015-01-26 Thread Stephen J. Butler
Do you have a default ordering on the Model object? That is, an ordering option on newleave.Meta? Because otherwise this query "newleave.objects.all()" is not at all guaranteed to return rows in the order they were added. It may, by coincidence, in your current environment behave that way. But

Re: forloop

2015-01-26 Thread sum abiut
Thank you for your email. I am iterating all the row to find out which row was recently added. basically when a row is added to it become last. so i am trying to comparing a column on the last row. which is the row that was recently add if the condition of the column is exist. that is when i send

Re: forloop

2015-01-26 Thread Paul Royik
Inside view there is no forloop (unless you explicitly define it). forloop is defined only inside for loops in templates Actually your code is somewhat weird. You iterate all list until last without doing anything. It is more efficient to use slicing email = newleave.objects.all()[-1] # this

Re: Disorientated by too many google-maps django packages

2015-01-26 Thread Mario Gudelj
Hey Victor, Here's some basic JS I've used in a project to plot client locations, and to show their name and phone when the marker is clicked: var locations = {{ locations|safe }}; var map = new google.maps.Map(document.getElementById('map-canvas'), { zoom: 11, center: new

forloop

2015-01-26 Thread sum abiut
Hi, i am getting an error as below when iterating throw rows. Basically what i want to do is iterate through number of rows. When on the last row i want to compare a column then send out an email. here is the error that i am getting: global name 'forloop' is not defined here is my view.py:

Select Field With Other option

2015-01-26 Thread Paul Royik
I need to build a form field with a special select field. Select field should have option other on which text field is shown. After entering value in textfield, it should be validated, saved and then refered to initial form. How this can be done? I'm trying to override MultiValueField and

Re: Django + Bamboo

2015-01-26 Thread Cal Leeming
Doh, I thought bitbucket was hg only. *red face* Cal On Mon, Jan 26, 2015 at 6:08 PM, Daniel França wrote: > But it was using git, and I'm not on that project anymore anyway. > > Em Mon Jan 26 2015 at 7:06:54 PM, Cal Leeming escreveu: >> >> I'm almost

Re: Django + Bamboo

2015-01-26 Thread Daniel França
But it was using git, and I'm not on that project anymore anyway. Em Mon Jan 26 2015 at 7:06:54 PM, Cal Leeming escreveu: > I'm almost tempted to say "you should be using git", but that could > turn into a very lengthy thread indeed :) > > Cal > > On Mon, Jan 26, 2015 at 5:42 PM,

Re: Django + Bamboo

2015-01-26 Thread Cal Leeming
I'm almost tempted to say "you should be using git", but that could turn into a very lengthy thread indeed :) Cal On Mon, Jan 26, 2015 at 5:42 PM, Daniel França wrote: > I should try circleCI sometime, but that project was on a private bitbucket > repo, and circleCI

Re: Smoke tests

2015-01-26 Thread Cal Leeming
In-line comments below, but imho I'd recommend re-thinking your workflow as it doesn't make sense to me. On Mon, Jan 26, 2015 at 5:41 PM, Tomáš Ehrlich wrote: > Hello Cal, > thank you for your answer. > > I'm deploying my project to AWS, so I can't replicate whole

Re: Default auth with username but unique email, is it possible?

2015-01-26 Thread Daniel França
There's a solution referred here: http://stackoverflow.com/questions/1160030/how-to-make-email-field-unique-in-model-user-from-contrib-auth-in-django This solution basically override the *clean_email* method of the UserForm, and check if the email is unique, raising an error if it's not. But I

Re: Smoke tests

2015-01-26 Thread Tomáš Ehrlich
Hi Derek, the speed of tests isn't a problem I'm trying to solve. The problem is, the tests run in different environment (obviously), but I would like to run a subset of my tests in production environment. This subset should include only "safe" tests, which doesn't create objects in DB for

Re: Django + Bamboo

2015-01-26 Thread Daniel França
I should try circleCI sometime, but that project was on a private bitbucket repo, and circleCI didn't support this at that moment. Em Sun Jan 25 2015 at 2:27:00 PM, Cal Leeming escreveu: > CircleCI is also worthy of mentioning, I preferred them over Codeship > due to flexibility.

Re: Smoke tests

2015-01-26 Thread Tomáš Ehrlich
Hello Cal, thank you for your answer. I'm deploying my project to AWS, so I can't replicate whole production environment easily. I do deployment to "release" environment which is about the same as production one (hosted on AWS, created with the same scripts as production one), but still there

Re: A sample project showing server side rendering with React and Django

2015-01-26 Thread bobhaugen
Ustun, thanks a lot. I think I start to get it. So if I don't care about server-side rendering of React templates (which I will try avoid in the beginning stages, anyway), I can skip node.js. Learning React is on my todo list. Then I'll need to dig deeper. I suppose then I might change my

Default auth with username but unique email, is it possible?

2015-01-26 Thread Bruce Li
Hi, I'm using django's default auth settings in my app. All I want is to make email unique for each user. Is it possible to do that without creating a custom user model and user manager? Thanks. -- You received this message because you are subscribed to the Google Groups "Django users"

Re: Disorientated by too many google-maps django packages

2015-01-26 Thread George Silva
I would suggest a new approach here. Don't use a package that is out there. Since your task is quite simple, you should create you webmapp using JavaScript, and pull all the patient data from your django server using REST or use a map server, like GeoServer, to create and render your layers on

Re: Django for backend and frontend

2015-01-26 Thread Scot Hacker
On Sunday, January 25, 2015 at 4:29:00 AM UTC-8, Xiangyu Wu wrote: > > Hello, > > Shall I use Django for backend and frontend or is it a good idea to use > Angular JS for frontend and Django for backend. What are the advantages and > disadvantages? > Doing this means using Django as basically a

Disorientated by too many google-maps django packages

2015-01-26 Thread Victor
I'm working for a medical non-profit company for domiciliary assistance of ill people managed by means of a django app in production. One of the models is for patients and contains, among many other pieces of info, their addresses scattered all over Rome. I would like to use a google-maps

Re: A sample project showing server side rendering with React and Django

2015-01-26 Thread Ustun Ozgur
Hi Bob, On Sunday, January 25, 2015 at 5:52:00 PM UTC+2, bobhaugen wrote: > > Ustun, > > Please say more about the advantages? As in, what can you do by adding a > node.js server to the mix (and so requiring everybody else who wants to use > your Django project to do the same, learn and manage

Forms test run on development database instead of test database

2015-01-26 Thread Merouane Atig
Hi, I have a strange issue with a forms test and I would like to know if I'm doing something wrong or if it is a Django bug. I created a repo to reproduce the issue I have: https://github.com/merwan/django-choicefield I have a DomainForm class with a choice field populated from a table in the

Re: Smoke tests

2015-01-26 Thread Derek
The same article you refer to says" "A frequent characteristic of a smoke test is that it runs quickly, often in the order of a few minutes and thus provides much quicker feedback and faster turnaround than the running of full test suites which can take hours or even days." I would think that