Re: page index.html

2022-08-24 Thread Asif Ahmed Khan
What type of errors are you facing?
Can you send some screenshots?
or error details?

On Wed, 24 Aug 2022 at 15:14, REMY TOUITOU  wrote:

> hello  , i have a question , i can't make the server running , when i do
> the command  py manage;py runserver , it gives a lot of error in differents
> files , before the server was running well;
> i use visual studio code and conda ;
> thanks you
> remy
>
> Le jeu. 18 août 2022 à 23:06, hajar Benjat  a
> écrit :
>
>> did you make it right (what about the urls.py and views.py )
>>
>> [image: width=]
>> 
>>  Sans
>> virus.www.avast.com
>> 
>> <#m_2558853448420336607_m_-5726608972012506882_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMcj6WdYMRVgsEgaPAf%3DAzxqBWyKph_biCSgNZ5r1QtR4g2%3D2Q%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAD9WEx365okwa4ziZXt1pVj3sQ9bDCZmyjkhx6nosqfn4iwmHg%40mail.gmail.com
> 
> .
>


-- 
K. Asif Ahmed
*System Manager*

*Maharashtra State Seeds Co. Ltd, Akolahttp://www.mahabeej.com/
*

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEMxhgS3tUSqdhJaEy2W9_duipbwcZYn3j4x36OZh48gUL7N_w%40mail.gmail.com.


Re: About page

2022-08-15 Thread Asif Ahmed Khan
Dear
Please show what you did on that page, so people help you accordingly.

On Mon, 15 Aug 2022 at 00:29, Regan De Guzman 
wrote:

> My about page is still throwing an error, i've tried what I know, i can't
> seem to get it up and running. It shows that the template does not exist.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/456bd705-82fa-4e2f-b8ee-af5456c6acaen%40googlegroups.com
> 
> .
>


-- 
K. Asif Ahmed
*System Manager*

*Maharashtra State Seeds Co. Ltd, Akolahttp://www.mahabeej.com/
*

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEMxhgQt9ZHb3O_QyncL99vSGzZay-3Zez3YDaEN6NY7Hr3YZA%40mail.gmail.com.


Re: Django throws ImproperlyConfigured error when loading URLconf on startup

2014-01-02 Thread Ahmed Khan
Any progress on this? Does anyone know the causes?

On Sunday, June 23, 2013 2:55:16 PM UTC+5, Pratik Mandrekar wrote:
>
> Has anyone been able to resolve this?
>
> I am facing the same issue.
>
> On Sunday, March 24, 2013 8:46:26 PM UTC+5:30, Dan Gentry wrote:
>>
>> Andrei, I once received this error when the problem was actually in 
>> another python module being imported - in my case views.py.  Hope this 
>> helps, Dan
>
>

-- 
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/6df3be6b-e0a6-41d0-b41a-40bae2e52d8c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: User attribute access from within profile model

2009-05-19 Thread Ayaz Ahmed Khan


On 20-May-09, at 12:12 AM, neridaj wrote:
> On May 19, 1:15 am, Ayaz Ahmed Khan  wrote:
>> On 19-May-09, at 5:12 AM, neri...@gmail.com wrote:
>>
>>> class Employee(models.Model):
>>>   user= models.ForeignKey(User, unique=True)
>>>   phone = PhoneNumberField()
>>>   ssn = models.CharField(max_length=11)
>>>   address = models.CharField(max_length=50)
>>>   city = models.CharField(max_length=30)
>>>   state = USStateField(default='WA')
>>>   zip_code = models.CharField(max_length=10)
>>
>>>   def __unicode__(self):
>>>   return self.user.full_name
>>
>> Is there an attribute or property that goes by the name `full_name`
>> defined on the Usermodel? As far as I can tell, no. You can,
>> however, get to the full name associated with a User instance by
>> calling the User.get_full_name() method.
>
> There are attributes for first_name and last_name, why wouldn't
> user.first_name work?
>


But not for User.full_name, which is what are trying to access (and
subsequently failing while doing) in the __unicode__() method for the
Employee class (if the code you pasted is anything to go by with).


-- 
Ayaz Ahmed Khan

The problem with any unwritten law is that you don't know where to go
to erase it.
 -- Glaser and Way


--~--~-~--~~~---~--~~
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: User attribute access from within profile model

2009-05-19 Thread Ayaz Ahmed Khan


On 19-May-09, at 5:12 AM, neri...@gmail.com wrote:

> class Employee(models.Model):
>   user = models.ForeignKey(User, unique=True)
>   phone = PhoneNumberField()
>   ssn = models.CharField(max_length=11)
>   address = models.CharField(max_length=50)
>   city = models.CharField(max_length=30)
>   state = USStateField(default='WA')
>   zip_code = models.CharField(max_length=10)
>
>   def __unicode__(self):
>   return self.user.full_name


Is there an attribute or property that goes by the name `full_name`
defined on the User model? As far as I can tell, no. You can, however,
get to the full name associated with a User instance by calling the
User.get_full_name() method.

-- 
Ayaz Ahmed Khan

If I'd known computer science was going to be like this, I'd never
have given up being a rock 'n' roll star.
 -- G. Hirst


--~--~-~--~~~---~--~~
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: dev server hangs on admin pages over remote port

2009-05-08 Thread Ayaz Ahmed Khan


On 08-May-09, at 8:17 AM, jfenton wrote:

> Has anyone seen this behavior before and fixed it? It seems weird
> that there aren't any errors. I recall that when I moved servers a
> few months ago that dev admin pages took a really unreasonable time
> to load, but I couldn't say when this actually started happening--
> probably because I was too lazy to do anything about it.
>
> I thought maybe it was some sort of port/cookie weirdness--but I
> don't see why that would make the dev server become unresponsive.
> Any hints much appreciated.

I am sorry I cannot provide any help, but I want to chime in to second
that I have faced this issue as well. Admin and non-admin pages load
fine on the local system, but when deployed on a remote server over
the Django development server, only non-admin pages load. If an
attempt is made to load admin pages, the browser eventually times out,
crashing the Django development server.

-- 
Ayaz Ahmed Khan

"Were there no women, men might live like gods."
 -- Thomas Dekker


--~--~-~--~~~---~--~~
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: Finding Reason for Form.is_valid()

2009-04-29 Thread Ayaz Ahmed Khan


On 28-Apr-09, at 8:35 PM, Margie wrote:

> I often put a break point using pdb
>
> import pdb
> pdb.set_trace()
>
> This  causes the server (assuming you are using the django
> development server) to drop to the pdb prompt when it hits the
> set_trace().
>
> Then I just print the form and look at the output.


Oh, that's lovely, indeed. The thought of using the debugger never
crossed my mind. The OP may or may not have had a slightly different
requirement than mine, but for me the task of debugging a problem when
writing unit tests and subsequently the views being tested, may become
daunting. I could always drop to an interactive shell, instantiate
objects and inspect their contents and stuff, but the alternative to
use pdb the way you have suggested is much, much better and more
convenient.


-- 
Ayaz Ahmed Khan

You might have mail.


--~--~-~--~~~---~--~~
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: dynamic form wizards

2009-04-23 Thread Ayaz Ahmed Khan


On 23-Apr-09, at 6:31 PM, Dennis Schmidt wrote:

> Hi there,
>
> I need to dynamically create complex forms in my application. Since
> version 1.0 django has these form wizards, which can manage complex
> forms quite well.  Now my only problem is, that they apparently have
> to be statically mapped by the urls.py. But what I need is a
> different set of forms for the wizard, depending of an ID specified
> in the URL.
>
> ie /order/1/accept/ shall use OrderAcceptionWizard([OrderPartOneForm,
> OrderPartTwoForm]) but
> /order/2/accept/ shall use OrderAcceptionWizard([OrderPartOneForm,
> OrderPartThreeForm]).

You could always tap into process_step() (a method of the
FormWizard[0] class) and alter self.form_list dynamically based on some
criterion. self.form_list is a list of Form classes that are used to
create forms at different steps of the wizard.

[0] 
<http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/#django.contrib.formtools.wizard.FormWizard.process_step
 
 >

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.

--~--~-~--~~~---~--~~
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: how to redirect to previous page

2009-04-21 Thread Ayaz Ahmed Khan


On 22-Apr-09, at 3:06 AM, Margie wrote:

> Then in my html on the button that does the unlock I have something
> like this:
>
> 
> I just thought maybe there was django magic that wouldn't require me
> to pass in the "next" url.
>
> Thanks for your insights!


If you want to avoid passing in a value through the template, you
could use boilerplate code such as the following in your view function
to inspect the HTTP_REFERER value in the HttpRequest object and
redirect or act accordingly:

 from urlparse import urlsplit
 referer = request.META.get('HTTP_REFERER', None)
 if referer is None:
 pass
 # do something here
 try:
 redirect_to = urlsplit(referer, 'http', False)[2]
 except IndexError:
 pass
 # do another thing here
 return HttpResponseRedirect(redirect_to)

I have used something along the lines of that in view functions from
which I wanted users to be taken back to the page they were on when
they called the view.


-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~-~--~~~---~--~~
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: Running two django version from same python.

2009-04-16 Thread Ayaz Ahmed Khan

On 16-Apr-09, at 3:27 PM, Harish wrote:
> Hi Folks,
>
> Is it possble to install two seperate django versions (0.97  and
> 1.0.x) in one python site-package file.  If yes how  and if no
> why?
>

Describing how I have done it for my scenario, I wrote about it a
while back.

<http://ayaz.wordpress.com/2009/04/05/a-guide-to-configuring-two-different-django-versions-for-development/
 
 >

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~-~--~~~---~--~~
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: Leopard deploy directory?

2009-04-15 Thread Ayaz Ahmed Khan


On 14-Apr-09, at 4:12 AM, Shannon wrote:

>
> Hi -- I am working on a django-powered site on Leopard server.  Where
> is the recommended/conventional deployment directory?  Every example I
> see uses a particular user's home directory, but that does not seem
> appropriate for a production-level site.  I'm fairly new to the
> Leopard environment and am curious what people typically use for their
> production deployment directory.
>

The default document root directory for Apache on 10.5.x is:
 /Library/WebServer/Documents

So, I should imagine that /Library/WebServer/, among other
alternatives, may be a suitable place to deploy production-level
sites.

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~-~--~~~---~--~~
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: Validate with PIL

2009-04-06 Thread Ayaz Ahmed Khan


On 06-Apr-09, at 3:37 AM, CrabbyPete wrote:

>
> I installed the PIL Imaging library and when I validate my model I
> get the error that I need the imaging library. I'm using Python 2.6.

What's the exact error? Does it complain of a certain decoder not
being available? Does it work when you load GIF images? If so, you
will have to compile PIL from source, paying close attention to
support for different image formats.

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~-~--~~~---~--~~
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: fail_message 'changed' when updating form

2009-04-03 Thread Ayaz Ahmed Khan


On 03-Apr-09, at 7:43 PM, simong wrote:

>   if request.method == 'POST':
>   productform = ProductForm(request.POST, instance=product)
>   productform.user = user
>   if productform.is_valid:


`is_valid` is a method bound to the BaseForm class. The expression in
the snippet above _will_ evaluate to True because it will return a
reference to the bound method, as opposed to return nothing, but will
not, of course, execute the referenced method.


-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~-~--~~~---~--~~
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: upgrading django

2009-04-02 Thread Ayaz Ahmed Khan


On 02-Apr-09, at 8:57 PM, Miguel wrote:

> I have seem new django versions improve the performance of web
> applications.  I have a huge web aplication and I m thinking about
> changing it. How hard would be to upgrade django 0.96 to the newest
> one? Has it backward compatibility?


The porting guide[0] is where you may want to start. I have a
medium-sized Django application on 0.97-svn that I want to migrate to
1.x. The need to migrate to 1.x in my case is not a pressing one, and
will likely be determined by the amount of labour required to port
against to what extent features in 1.x will facilitate development of
future change requests if any whatsoever---the application has seen
over five months in production now, after all.

[0] http://docs.djangoproject.com/en/dev/releases/1.0-porting-guide/

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~-~--~~~---~--~~
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: Django wont display images on my CSS file

2009-03-28 Thread Ayaz Ahmed Khan


On 28-Mar-09, at 3:14 AM, Dougal Matthews wrote:
>
> 2009/3/27 Brian Neal :
>>
>> I seem to recall that when you put references to files in your
>> CSS, they are relative to that CSS file, not to the document
>> root. So if that graphic file is in the same directory as your
>> CSS file, change your url to:
>>
>> background: url(header_background.gif) no-repeat top left;
>>
> Isn't it just because you don't have quotes around the image address?
>
> background: url('/site_media/header_background.gif') no-repeat top  
> left;

The CSS specification[0] dictates that the surrounding quotes--be they
single or double--within the url() notation for describing URLs are
optional. Furthermore, it stipulates that if the given URL path is
relative, the absolute path is derived at by combining that relative
path with a base URL which, for CSS style sheets, is the base URL for
the style sheet. However, your guess is as good as mine about which
popular browsers adhere to that latter specification, in particular,
and which don't. Having said that, I should mention that I have in
web projects that I have worked on before, where style sheets were
kept within /static/css/ and the accompanying images in /static/images,
specified URLs for images within the CSS style sheets via URLs of the
form `/static/images/file.ext`, and found them to seamlessly work across
a diverse set of browsers.

[0] http://www.w3.org/TR/CSS2/syndata.html#uri

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~-~--~~~---~--~~
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: Controlling html display of Charfield length on forms...(newforms?)

2009-03-26 Thread Ayaz Ahmed Khan


On 26-Mar-09, at 2:26 PM, NoviceSortOf wrote:

> It would seem natural that there would be a length or size parameter
> on something in forms and/or models Charfield to control the html
> display of the field length.


How a field in a form in Django is rendered is determined by the
corresponding widget used for that field. To that end, Django offers a
great deal of flexibility when it comes to customising both the look
and functionality of form fields. Having said that, I should point out
without sounding condescending that one can specify and configure
different supported attributes of an HTML form element through the use
of the `attrs` attribute supported by Django widgets.

For example, to restrict the size of and specify a class for an input
field, the following can be used:

 text = forms.CharField(label="text", max_length=10,
  widget=forms.TextInput(
 attrs={'size':'10', 'class':'inputText'}))

One can toss in all manners of *supported* HTML attributes in there.

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~-~--~~~---~--~~
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: submit logins over SSL

2009-03-26 Thread Ayaz Ahmed Khan


On 26-Mar-09, at 11:54 AM, Ryan Kelly wrote:

> I'm trying to set things up so that my login form uses SSL to
> protect the user's password in transit.  Basically, the behaviour
> I'm after is as follows:
>
>  1) Unauthenticated user requests http://site/private/
>  2) They're redirected to http://site/login/
>  3) They submit their details securely to https://site/login/
>  4) This establishes the login and redirects to http://site/private/

I have used, in a project before, a *third-party* SSL Middleware[0] to
effectively achieve what you are after. I won't comment further, apart
from saying that it has worked a treat for my requirements. You may
peruse the source and the brief yet to the point documentation
describing how to use it.

[0] http://www.djangosnippets.org/snippets/85/

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~-~--~~~---~--~~
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: Admin Model Search issue.

2009-03-25 Thread Ayaz Ahmed Khan


On 26-Mar-09, at 2:07 AM, Bobby Roberts wrote:

> #this keeps track of active bidders and their profile settings
> class Bidder (models.Model):
>AccountNum = models.ForeignKey(User, unique=True, blank=False) #  
> User.Id (per auth user table
> [...]
>class Admin:
>search_fields =
> ['AccountNum 
> ','Organization','FirstName','LastName','BZipCode','Phone']

As I suspected and pointed out before: You will have to specify which
field of `AccountNum' (since it is a ForeignKey) you want Django to
search against. You may probably want to use 'AccountNum__username' or
'AccountNum__email'.

It is documented here:
http://www.djangoproject.com/documentation/0.96/model-api/#search-fields

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~-~--~~~---~--~~
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: ImageField on ModelForm not working - v1.0.2

2009-03-25 Thread Ayaz Ahmed Khan


On 25-Mar-09, at 5:45 PM, Oli Warner wrote:
>if request.method == 'POST':
>f = AdminEditForm(request.POST.copy(), instance = company)
>if f.is_valid():

Contents of file input fields/objects are stored within request.FILES
dict in Django. You need to add request.FILES as an additional
positional argument to the form constructor.

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~-~--~~~---~--~~
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: Admin Model Search issue.

2009-03-24 Thread Ayaz Ahmed Khan


On 24-Mar-09, at 9:28 PM, Bobby Roberts wrote:

> When I try to search on anything at all, the screen just blinks and
> returns all of the records.  This same syntax works perfectly on
> another model.  There's no error but the search function in the
> /admin is not working.  Any ideas what it could be?

Do you mind sharing the class definition for this model? Is any of the
fields in the search_fields by any chance a ForeignKey or such?
Despite the fact that Django stipulates that search fields be some
form of text fields, I was able to reproduce what you described by
including a ForeignKey in search_fields without using the lookup API
follow notation---I tested on 0.97-pre-SVN-unknown.

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~-~--~~~---~--~~
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: Using an email as the user login

2008-07-17 Thread Ayaz Ahmed Khan

On Jul 17, 9:04 pm, rootbit <[EMAIL PROTECTED]> wrote:
>
> Hey everyone.
> i would like to change the authentication system, so that usernames
> will be email
> like on facebook.
>
> how should i go about doing that?
>

For the current project I am working on, I had to do the same.  I
ended up modifying the User model.  Therefore, I am using a custom
Django of sorts.  The project is approaching its final stages; I have
not had any issues with anything from having hacked the User model.  I
couldn't think of any other workaround.

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Customising admin change_list_results.html template

2008-07-17 Thread Ayaz Ahmed Khan

On Jul 17, 5:17 pm, Ayaz Ahmed Khan <[EMAIL PROTECTED]> wrote:
>
> Is it possible to have a customised `change_list_results.html` in
> one's TEMPLATE_DIR/admin/app_label/model/ directory?  I've it along
> with change_list.html, and while changes made to change_list are
> picked up, those made to change_list_results aren't appearing.  I may
> be doing it wrong, I am not sure.
>
> I am using django build from svn trunk.  Thank you.
>

It appears that if I move `change_list_results.html` to TEMPLATE_DIR/
admin/ instead, django picks it up.

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Customising admin change_list_results.html template

2008-07-17 Thread Ayaz Ahmed Khan

Is it possible to have a customised `change_list_results.html` in
one's TEMPLATE_DIR/admin/app_label/model/ directory?  I've it along
with change_list.html, and while changes made to change_list are
picked up, those made to change_list_results aren't appearing.  I may
be doing it wrong, I am not sure.

I am using django build from svn trunk.  Thank you.

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using validators against model fields

2008-07-08 Thread Ayaz Ahmed Khan

On Jul 8, 9:50 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
>
> Django does not do any model field validation by default at the moment.
> Admin does it using an old system (essentially, oldforms and Add- and
> ChangeManipulators) that is being removed. We are adding more coherent
> model field validation prior to 1.0. This is ticket #6845 and it's
> actively work in progress (I reviewed it in detail over the weekend and
> Honza is going to be working on the patch at the EuroPython sprint this
> coming weekend).
>
> For now, just do the validation manually in your model's save() method.
> It's not ideal, but that's the way things are for the time being.

Many thanks, Malcolm.

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Using validators against model fields

2008-07-07 Thread Ayaz Ahmed Khan

I have a model with a CharField against which I have defined a
validator, thus:

class Info(models.Model):
text = models.CharField(validator_list=[validators.isOnlyDigits])

When using a ModelForm of that Model in a view, Django fails to apply
the validators.isOnlyDigits validation check.  If model is edited from
admin, however, the specified extra validator is applied, and works.
I don't know what I am doing wrong or missing out on.  Any clues would
be really appreciated.

I am using the trunk build from svn of Django.  Thanks.

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Regex

2008-06-30 Thread Ayaz Ahmed Khan

On Jun 30, 10:27 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
> Negation of Q objects is a recent addition 
> (seehttp://code.djangoproject.com/ticket/4858).  You must be using a
> post-queryset-refactor SVN checkout while the original poster is probably
> using a 0.96 release (or an SVN checkout more than a few months old).
>

Thanks.  You are spot on.  I am working with a very recent SVN build
of Django.  I did not know the negation feature in Q objects is
something that was only recently added.

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Inheriting from auth.models.User

2008-06-30 Thread Ayaz Ahmed Khan

bhunter wrote:
> This should be a simple question.  I'd like an Employee model.  First
> name, last name, username, password--basically all the same stuff
> that's already in django.contrib.auth.models.User.  Maybe I want some
> other things like salary, too.  So, it makes sense that I should just
> inherit from this class.
> [...]

You don't need to derive a class from the User model.  This is a
common use-case.  You should be looking at Django Profiles:
http://www.djangoproject.com/documentation/authentication/#storing-additional-information-about-users

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Regex

2008-06-30 Thread Ayaz Ahmed Khan

On Jun 30, 9:08 pm, mike171562 <[EMAIL PROTECTED]> wrote:
> Thanks that works well, but when I try to use the ~ as you suggested I
> get the error
> ""bad operand type for unary ~: 'Q'""
> so i removed the ~ and changed 'filter' to 'exclude'
>

That is weird.  The negation operator works fine here with the Q
syntax:

In [15]: Bringer.objects.filter(~Q(buyer__user__id=2) &
~Q(buyer__user__id=3))
Out[15]: []

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Trying to get ifequal to evaluate to True

2008-06-30 Thread Ayaz Ahmed Khan

On Jun 30, 9:00 pm, "Paolo Ambrosio" <[EMAIL PROTECTED]>
wrote:
> I just built a test application and it works for me, if I understood
> what is your problem.
> [...]
> P.S.
> I am using the trunk
>

Many thanks for taking out the time to build a test application.  I
really appreciate that.  Thanks.

Trying to follow in with your example, I realised what was going
wrong.  The login template I am working with extends a base template,
and so naturally fills in blocks only from the parent template.  The
{% ifequal %} expression, for some reason that didn't stand out
before, was placed outside of any of the required main blocks.  No
sooner than I moved the expression inside one of the main blocks that
it started to work as expected.

Many thanks, again.  :)

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: custom form with admin look and feel

2008-06-30 Thread Ayaz Ahmed Khan

chefsmart wrote:
> I'm using django svn trunk. I have created several custom forms that
> show up in the admin section of the website. However, these forms look
> nothing like the admin forms. I tried extending change_form.html
> template - unsuccessfully.
>
> Does anyone know what my template should contain to achieve admin look
> and feel.
>
> Thanks...

Here is what I have been doing.  I have been required to modify the
change_form templates in the admin for some of the models.  I open the
"add model item" page, view the source of the page, and copy the HTML
to a note pad.  I then hack it, and use it to make the custom
change_form template.  I only copy and hack the HTML within the
"breadcrumb" and "body content" blocks.  The blocks above those, I
copy from the change_form.html template provided in django/contrib/
admin/templates/admin.  The custom pages I have made look no different
than the Django Admin ones.  ;)

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Trying to get ifequal to evaluate to True

2008-06-30 Thread Ayaz Ahmed Khan

On Jun 30, 8:05 pm, "Paolo Ambrosio" <[EMAIL PROTECTED]>
wrote:
> On Mon, Jun 30, 2008 at 4:52 PM, Ayaz Ahmed Khan
>
> <[EMAIL PROTECTED]> wrote:
> > [...]  The variable "next"
> > does have that particular value (I verified both by printing it out
> > and by making sure {% if next %} evaluates to True).  However, the
> > "ifequal" expression just doesn't work.
>
> Are you passing it through the context while invoking the template?

I, myself, am not passing that particular value.  I am calling the
built-in login view provided by Django -- which is ``from
django.contrib.auth.views import login''.  That view passes the "next"
as part of the context while rendering the login template.

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: possible urls issue

2008-06-30 Thread Ayaz Ahmed Khan

Bobby Roberts wrote:
> i have a situation here.  I'm trying to NOT use .html extensions in
> this project.  In other words i'd really like to just have my urls be
> directories.  The project consists of a series of forms and i'd like
> them to proceed as follows:
> mysite.com/step1/
> mysite.com/step2/
> mysite.com/step3/
> [...]
> from django.conf.urls.defaults import *
>
> urlpatterns = patterns('billpay.views',
> # (r'^modules/', include('modules.foo.urls')),
> (r'step1/$', 'DoPayDetailForm'),
> (r'step2/$', 'DoPayInfoForm'),
> )
>
> urlpatterns += patterns('django.views.generic.simple',
> (r'step1/$', 'direct_to_template', {'template': 'step1.html'}),
> (r'step2/$', 'direct_to_template', {'template': 'step2.html'}),
> )
> when form1 is_valid, the view saves form1 to session variables then
> redirects to step2 as follows:
>
> return render_to_response("step2.html",'form': form},
> context_instance=RequestContext(request))
>
> The main issue i'm having is that i need this to redirect to
> mysite.com/step2/ but it's staying at mysite.com/step1/ which results
> in the view for step2 not being executed.
> ideas?

I am not sure whether you can do what you want like that.  When you
render HTML from within a view, it will be displayed on the same URL
on which that view exists.  You could, instead of rendering the HTML
for step2 in the view for step1, redirect to another view written
specifically to deal with step2 functions.  For example:

def step1_view(request):
   if request.method == 'POST':
   form = Form(request.POST)
   if form.is_valid():
 # save data, etc
 return HttpResponseRedirect('/step2/')

Something like that.  Also, the form wizard in the development version
of Django is looking like a very handy feature:

http://www.djangoproject.com/documentation/form_wizard/

--
Ayaz Ahmed Khan

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Trying to get ifequal to evaluate to True

2008-06-30 Thread Ayaz Ahmed Khan

If a view is decorated with the `login_required decorator', an
anonymous user accessing that view is directed to the login page with
the URL the view exists on preserved in the "next" variable which is
passed to the login view and template.  In the login template, I am
trying to match the value of the "next" variable with a hard-coded
string.  However, no matter what I do, I cannot seem to be able to get
{% ifequal next "value" %} to evaluate to True.  The variable "next"
does have that particular value (I verified both by printing it out
and by making sure {% if next %} evaluates to True).  However, the
"ifequal" expression just doesn't work.

I have no idea why not.  Any clues will be much appreciated.  Thanks

--
Ayaz Ahmed Khan

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Regex

2008-06-30 Thread Ayaz Ahmed Khan

On Jun 30, 7:13 pm, mike171562 <[EMAIL PROTECTED]> wrote:
> Hello,
>    I am working on a django that querys long distance numbers from a
> mysql database. I am currently using the django API, that goes
> something like this.
>
> long_distance =
> Call.objects.filter(dest_num__startswith='1').filter(dest_num__gt=6).exclude(dest_num__startswith='18').exclude(dest_num__startswith='1281').exclude(dest_num__startswith='1832').exclude(dest_num__startswith='1713')
>
> I was hoping to consolidate all of my .filter excludes into one regex.
> is this possible and would it be more efficient? Basically any number
> that doesnt start with 281,713,832 or 1281,1713,or 1832 is long
> distance any help would be appreciated.

Using regex mostly complicates things.  If I have understood your
requirement properly, the following may be a better and cleaner
alternative:

from django.models import Q

long_distance = Call.objects.filter(

~Q(dest_num__startswith='281') &

~Q(dest_num__startswith='713') &

~Q(dest_num__startswith='832') &

~Q(dest_num__startswith='1281') &

~Q(dest_num__startswith='1713') &

~Q(dest_num__startswith='1832 ')
  )

That is merely an example.  You can make up different conditionals
with the use of the Q feature.
http://www.djangoproject.com/documentation/db-api/#complex-lookups-with-q-objects

--
Ayaz Ahmed Khan

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---