I correct my code and it's worked. Thank you guys for your help.
Ajax Code:
function checkuser() {
var myObject = new Object();
myObject.username = $('#username').val();
myObject.password = $('#password').val();
$.ajax({
url: 'http://10.252.84.159/ajaxrecivelogin/',
On Sat, Jan 17, 2015 at 8:09 PM, James Schneider
wrote:
> You can definitely do it that way if all you need to do is check if values
> exist and provide a default if they don't. I do this all the time for my
> __str__() methods as well.
> You also mentioned similar situations that may require more
You can definitely do it that way if all you need to do is check if values
exist and provide a default if they don't. I do this all the time for my
__str__() methods as well.
You also mentioned similar situations that may require more logic checks
(variables depending on each other or printing com
Hi everyone,
In a formset I can use the .clean() method to validate data across the
formset. The formset.clean() method is run after all the form.clean()
methods - this makes sense. Raising a formset ValidationError alerts the
user to the problem with formset.non_form_errors.
I would like to a
On Sat, Jan 17, 2015 at 6:15 PM, Tim Chase
wrote:
> I'm pretty sure that getattr() takes an optional 3rd field for the
> default, so you could use
Great point, that's very useful. Thanks for clarifying!
It looks like attrgetter doesn't have similar functionality, but
there's this (found after a
I have been trying for two days to install django with Python 3.4 operating
in windows 7. Everything I try according to your instructions, fails. The
command "import django" seems to work but the command "print
(django.get_version()) does not. I am trting to get this to work so I can
install E
On 2015-01-17 12:01, Vijay Khemlani wrote:
> I don't think there is a way in Python to do that directly
>
> you could have a utility method that catches the exception, for
> example
>
> def get_fk_field(obj, fk_field):
> try:
> return getattr(obj, fk_field)
> except AttributeError
This was far too broad to answer but I'm posting the solution I'm currently
implementing in case anyone else comes across this.
I have two models in the back end.
The first model has a JSONmodelfield (
https://github.com/bradjasper/django-jsonfield) and four intfields to save
the columns num
On Sat, Jan 17, 2015 at 3:00 PM, James Schneider
wrote:
> Yes, it's a bit more verbose, but much easier to follow. Hope it helps.
Definitely! Thanks again!
Python rocks. :)
Cheers,
M
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubsc
Yes, it's a bit more verbose, but much easier to follow. Hope it helps.
-James
On Jan 17, 2015 2:58 PM, "Micky Hulse" wrote:
> Hi James! Thank you for the reply and for the example code!
>
> On Sat, Jan 17, 2015 at 2:52 PM, James Schneider
> wrote:
> > You can reroll your original example like
Hi James! Thank you for the reply and for the example code!
On Sat, Jan 17, 2015 at 2:52 PM, James Schneider
wrote:
> You can reroll your original example like this:
> Much more pythonic, IMO.
Ah, that's great! I was actually wondering what the pythonic way of
doing this might be. While it's mor
You can reroll your original example like this:
def __str__(self):
pk = self.pk
customer_name = None
customer_phone = None
try:
customer_name = self.lead.customer_name
customer_phone = self.lead.customer_phone
except AttributeError:
pass
return _(
On Sat, Jan 17, 2015 at 12:58 PM, Micky Hulse wrote:
> Great, that's what I wanted to know. Thank you for pushing me in the
> right direction and for the sample code.
Thanks again Vijay! After doing a bit of research, I slightly modified
your code (I needed an easy way to check nested attributes)
Hi Vijay!
Thank you so much for the reply/help, I really appreciate it. :)
On Sat, Jan 17, 2015 at 7:01 AM, Vijay Khemlani wrote:
> I don't think there is a way in Python to do that directly
> you could have a utility method that catches the exception, for example
Great, that's what I wanted to
I've spent the past few weeks trying to set up a custom (but not
unreasonable) user registration and authentication flow using allauth for
my site.
- email instead of username
- a (not necessarily unique) display name
- email verification required
(more details and a skeleton project here
Is CRFS protection enabled ?
15 січ. 2015 18:51, користувач "Henry Versemann"
написав:
> First let me say that I haven't done a lot of stuff with either Python or
> Django, but I think I understand most of the basics.
> I am trying to get an access token back from the OAuth2 Web Application
> Flo
We have a django app accessed via SSL (i.e. with https). When we went
to the admin site and it was redirected to admin/login/?next=/admin/
because we were not logged in, the https was not carried over and the
request failed. I added
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
t
I don't think there is a way in Python to do that directly
you could have a utility method that catches the exception, for example
def get_fk_field(obj, fk_field):
try:
return getattr(obj, fk_field)
except AttributeError:
return None
so that your call would be
return _(u
Maybe it's triggering the CSRF validation? What error message are you
getting exactly from the server?
On Sat, Jan 17, 2015 at 10:37 AM, Erwin Sprengers
wrote:
> Hello,
>
> POST works fine for me, I use the following django code :
>
> at the end of the view :
>
> return HttpResponse(simplejson.
What problem are you having exactly?
Also I'm not sure what do you mean by "hierarchy" of the project folders,
do you mean the order the apps appear in the INSTALLED_APPS setting?
On Sat, Jan 17, 2015 at 6:38 AM, Sugita Shinsuke wrote:
> Hi there.
>
> I use Django 1.6 version.
>
> The database
Hello,
In my model I have:
def __str__(self):
return _(u'#{0}, {1}, {2}').format(
self.pk,
self.lead and self.lead.customer_name or None,
self.lead and self.lead.customer_phone or None
)
Where self.lead is an optional FK:
lead = models.ForeignKey('Lead', bla
Hi,
Did you also switch to Python 3?
It doesn't seem to be using your __unicode__ method at all.
If you query one of these Projects in manage.py shell, do they show the
project name?
Are you sure that the __unicode__ method is actually attached to your model?
Also, FYI, to_field="prj_name" means
Hello,
POST works fine for me, I use the following django code :
at the end of the view :
return HttpResponse(simplejson.dumps(response_dict),
mimetype='application/javascript')
and following ajax code :
$.ajax({
url: '/ajax/is_key_mm/',
type: 'POST',
asy
Hi,
Use urllib/urllib2 or requests to POST to other websites. Python can do it
natively.
try: # Python 3
from urllib import request as urllib_request
except ImportError: # Python 2
import urllib2 as urllib_request
from django.utils.http import urlencode
def my_view(request):
respo
Hi,
It should be possible to re-write you select statement using the Django
ORM, but there's not an automatic way to convert it. There's also raw()
which might take the statement as is.
https://docs.djangoproject.com/en/dev/topics/db/sql/
Collin
On Wednesday, January 14, 2015 at 11:05:08 AM UT
Hi,
Did you figure it out? It looks like you need to configure your urls.py so
it's connected with django-cms.
Collin
On Tuesday, January 13, 2015 at 9:19:09 PM UTC-5, zsandrusha wrote:
>
> hello i need urgent help to configure django,
> i had site on django cms then i loose my old domaind now
Kakar Nyori writes:
> When doing so, only the last pform is gets saved. And the other two
> pforms are ignored. How do I get to save all the three forms of photo
> (pforms) accordingly?
>
> Or is there any other way around? Your help will be much appreciated!
> Thank you.
James is right that a f
Hi there.
I use Django 1.6 version.
The database of Django store the information of application.
So, I know that if I change the hierarchy of the Django project folders,
some trouble occurs.
That is why, I'd like to check the name of my application.
I think some of Django commands like manage
I'm guessing that if you look at the generated source code in the browser,
all of the names for the fields in the pform form's are the same, which
likely collide on the Django side (if the browser actually posts all the
copies with the same field names, not sure what the typical browser
behavior is
A user will have photos which will be related with their specific album.
So this was the model for that:
class Album(models.Model):
> user = models.ForeignKey(User)
> title = models.CharField(max_length=200)
> pub_date = models.DateTimeField(auto_now_add=True, auto_now
30 matches
Mail list logo