Re: (ModelForm) confusion

2014-07-30 Thread Satinderpal Singh
On Wed, Jul 30, 2014 at 12:25 PM, Kamal Kaur <kamal.kaur...@gmail.com> wrote:
> Greetings!
>
> What I have done:
> There are four tables, from which I have generated ModelForms. Getting
> the WorkerDetails from one side, adding the salary and attendance
> things from the other side as the view says. If there is at least one
> row added in WorkerDetail table, then it directly asks to add the
> salary and attendance things. Everything is being added perfectly but
> I have to add that "ForeignKey" thing in every form.

The thing i understand is, you wish is that the system should ask to
add the other details like monthly attendance and advance on the same
page when a new worker is added, if it don't have that values.
Am i right?

>
> Aim:
> To design a page like this:
> http://tinypic.com/r/feor5h/8
>
You require the validators in the template / form.py file, to validate
the data at the run time.

> Query:
> What I need to do to display forms like this and get the foreign key
> attribute directly from the displayed list? Is what I have done right?
> Is there some better approach to get this desired layout?
>
> Required code:
> models.py: http://pastie.org/9430952
> forms.py: http://pastie.org/9430955

Page doesn't exist :(

> views.py: http://pastie.org/9430962


-- 
Satinderpal Singh
http://satindergoraya91.blogspot.in/

-- 
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/CA%2BiK19JDoU5znYnz13AVwm0Swoc6y4R-t64QAaE0eiMBEC%3D5SA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django OneToOne field problem

2014-06-12 Thread Satinderpal Singh
Suppose there are two tables defined in Django models:

class Link(models.Model):
links = models.CharField(max_length=50 ,blank=True)

and

class Content(models.Model):
link = models.OneToOneField(Link, primary_key=True)
title = models.CharField(max_length=50, blank=True)
content = models.CharField(max_length=1000, blank=True)
footer = models.CharField(max_length=150, blank=True)

In the above table "Content" the OneToOne field contains the Link.id
attribute of the
table"Link", but how could i get it as, Link.links.

-- 
Satinderpal Singh
http://satindergoraya91.blogspot.in/

-- 
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/CA%2BiK19JdAFVEeidBmOLFz7Pjn6c9sgBbMb33%2BC%2BNkNpiQ%3DRnGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding models from one app to another app

2014-05-28 Thread Satinderpal Singh
On Wed, May 28, 2014 at 11:01 PM, Inderpreet Singh <indrp...@gmail.com> wrote:
> This is directory structure of my django site
>  LibreHatti
>|- src
>   |- useraccounts
>   |- librehatti
>  |--- catalog
>  |--- reports
>
> Now what we need is to reference a model from useraccounts in
> librehatti.catalog as a foreign key and I am unable to do that.

You may do it like this models  of librehatti.
from useraccount import model.modelname

If you want all useraccounts model in librehatti, then do like,
from useraccounts.models import *

> I tried by adding 'appname.modelname' in foreign key field but it actually
> refrences librehatti.useraccounts.address, which is not what I want.
>
> Any help would be appreciated.



-- 
Satinderpal Singh
http://satindergoraya91.blogspot.in/

-- 
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/CA%2BiK19L9QLuj44cjUnjWoQ_guHWHAkg1VWt2sfr8EZw-RTDnOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


ImportError: No module named django.core.wsgi

2014-05-23 Thread Satinderpal Singh
ImportError: No module named django.core.wsgi

I am facing the above error while deploying Django with Apache.

Here is my Apacahe conf file contents:


ServerAdmin webmaster@localhost


WSGIPythonPath
/home/user/site:/home/user/.virtualenvs/test/lib/python2.7/site-packages


Options Indexes
Order deny,allow
Allow from all


WSGIPythonHome /home/user/.virtualenvs/test
WSGIScriptAlias /site /home/user/site/site/wsgi.py


Order deny,allow
Allow from all



Alias /static/ /home/user/site/static/

Options -Indexes




and wsgi.py file

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "site.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()


Please help me to resolve the error.

-- 
Satinderpal Singh

-- 
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/CA%2BiK19KQ8YARfqb2sby2ZR71bTj9ryC_Opm5Zu8N3Br8KL%2B_fg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Foreign key attribute in django

2014-03-22 Thread Satinderpal Singh
On Mar 22, 2014 8:27 PM, "Harjot Mann" <harjotmann1...@gmail.com> wrote:
>
> On Sat, Mar 22, 2014 at 8:19 PM, Satinderpal Singh
> <satinder.goray...@gmail.com> wrote:
> > And the same problem is still there:)
> > Please show me the code.
>
> Sorry didn't get you.
> Are you facing the same problem or do you want to say something else?
>
I wonder you didn't remember the problem related to automation software.:)

--
Satinderpal Singh

-- 
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/CA%2BiK19KNiovRCy9zSUyjFB8zTPSG8WwQjQCJbnFBf1XT-ma7PA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: submit buttons in django

2014-03-22 Thread Satinderpal Singh
On Mar 20, 2014 9:19 AM, "Harjot Mann" <harjotmann1...@gmail.com> wrote:
>
> I have a form in my app and after entering data into that form I
> submit that form
but I want an another submit button like "Submit and
> Add Event", so that after clicking on it it can redirect to an another
> form. Please help me that how can I do this?
>
What you exactly wish to do, as you submit the first form, it saves the
data to database, you simply need another button, which can redirect to the
same form, or to any another form.

But if you need not to submit the data from first form and wishes to
redirect the other form then you have to follow another approach.

--
Satinderpal Singh

-- 
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/CA%2BiK19KvBfb5bwpoAr30i1Ww%3DRKmiJGKFzmR2ESOQLyEcXAfpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Foreign key attribute in django

2014-03-22 Thread Satinderpal Singh
On Mar 20, 2014 9:28 AM, "Harjot Mann" <harjotmann1...@gmail.com> wrote:
>
> I have a field in my form that is related with foreign key to another
> form and when I am filling a form that is required field but sometimes
> I need to leave it blaink, how can I do this?
>
And the same problem is still there:)
Please show me the code.

--
Satinderpal Singh

-- 
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/CA%2BiK19KwefHF6PCHNkHKZSt5-XotsKvhmM6xoHEb9jmGb1dL-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: no value in database

2013-09-30 Thread Satinderpal Singh
On Mon, Sep 30, 2013 at 10:07 PM, Harjot Mann <harjotmann1...@gmail.com> wrote:
> Here is the code to my view,
> http://tny.cz/57446220
> After filing form when I click on submit button , I am getting this
> error "SsupenceEditJob matching query does not exist" and not getting

I think it must be SuspenceEditJob.

-- 
Satinderpal Singh

-- 
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/CA%2BiK19%2BP8TCort0RKRJDLuAO6e0s0szT4VsLkTKeJz2XQZvSmw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ValueError at / Empty module name

2013-09-04 Thread Satinderpal Singh
On Wed, Sep 4, 2013 at 11:28 PM, Mantas Zilinskis
<mantaszilins...@gmail.com> wrote:
> your problem is in TEMPLATE_CONTEXT_PROCESSORS = (
> 'django.contrib.messages.context_processors.messages'
> 'django.contrib.auth.context_processors.auth'
> )
> it's a tuple, you have to have a comma after messages proccesor

Thanks a lot Mantas.

>
> On Wed, Sep 4, 2013 at 12:53 PM, Mantas Zilinskis
> <mantaszilins...@gmail.com> wrote:
>>
>> and also all your traceback
>>
>>
>> On Wed, Sep 4, 2013 at 12:45 PM, Satinderpal Singh
>> <satinder.goray...@gmail.com> wrote:
>>>
>>> On Wed, Sep 4, 2013 at 11:11 PM, Mantas Zilinskis
>>> <mantaszilins...@gmail.com> wrote:
>>> > can you post your settings.py
>>>
>>> Here it is:
>>>
>>> # Django settings for nanaksar project.
>>>
>>> DEBUG = True
>>> TEMPLATE_DEBUG = DEBUG
>>>
>>> ADMINS = (
>>> # ('Your Name', 'your_em...@example.com'),
>>> )
>>>
>>> MANAGERS = ADMINS
>>>
>>> DATABASES = {
>>> 'default': {
>>> 'ENGINE': 'django.db.backends.mysql', # Add
>>> 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
>>> 'NAME': 'babaji',  # Or path to database
>>> file if using sqlite3.
>>> 'USER': '***',  # Not used with sqlite3.
>>> 'PASSWORD': '***',  # Not used with sqlite3.
>>> 'HOST': '',  # Set to empty string for
>>> localhost. Not used with sqlite3.
>>> 'PORT': '',  # Set to empty string for
>>> default. Not used with sqlite3.
>>> }
>>> }
>>>
>>> # Local time zone for this installation. Choices can be found here:
>>> # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
>>> # although not all choices may be available on all operating systems.
>>> # On Unix systems, a value of None will cause Django to use the same
>>> # timezone as the operating system.
>>> # If running in a Windows environment this must be set to the same as
>>> your
>>> # system time zone.
>>> TIME_ZONE = 'America/Chicago'
>>>
>>> # Language code for this installation. All choices can be found here:
>>> # http://www.i18nguy.com/unicode/language-identifiers.html
>>> LANGUAGE_CODE = 'en-us'
>>>
>>> SITE_ID = 1
>>>
>>> # If you set this to False, Django will make some optimizations so as not
>>> # to load the internationalization machinery.
>>> USE_I18N = True
>>>
>>> # If you set this to False, Django will not format dates, numbers and
>>> # calendars according to the current locale.
>>> USE_L10N = True
>>>
>>> # If you set this to False, Django will not use timezone-aware datetimes.
>>> USE_TZ = True
>>>
>>> # Absolute filesystem path to the directory that will hold user-uploaded
>>> files.
>>> # Example: "/home/media/media.lawrence.com/media/"
>>> MEDIA_ROOT =
>>> '/usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/'
>>>
>>> # URL that handles the media served from MEDIA_ROOT. Make sure to use a
>>> # trailing slash.
>>> # Examples: "http://media.lawrence.com/media/;,
>>> "http://example.com/media/;
>>> MEDIA_URL = '/media/'
>>>
>>> LOCAL_URL = 'http://localhost/'
>>>
>>> # Absolute path to the directory static files should be collected to.
>>> # Don't put anything in this directory yourself; store your static files
>>> # in apps' "static/" subdirectories and in STATICFILES_DIRS.
>>> # Example: "/home/media/media.lawrence.com/static/"
>>> STATIC_ROOT = ''
>>>
>>> # URL prefix for static files.
>>> # Example: "http://media.lawrence.com/static/;
>>> STATIC_URL = '/static/'
>>>
>>> # Additional locations of static files
>>> STATICFILES_DIRS = ('/home/goraya/nanaksar/templates',
>>> # Put strings here, like "/home/html/static" or
>>> "C:/www/django/static".
>>> # Always use forward slashes, even on Windows.
>>> # Don't forget to use absolute paths, not relative paths.
>>> )
>>>
>>> # List of finder classes that know how to find static files in
>>> # various locations.
>>> STATICFILES_FINDERS = (
>>

Re: ValueError at / Empty module name

2013-09-04 Thread Satinderpal Singh
On Wed, Sep 4, 2013 at 11:23 PM, Mantas Zilinskis
<mantaszilins...@gmail.com> wrote:
> and also all your traceback

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
in get_response
  140. response = response.render()
File "/usr/local/lib/python2.7/dist-packages/django/template/response.py"
in render
  105. self.content = self.rendered_content
File "/usr/local/lib/python2.7/dist-packages/django/template/response.py"
in rendered_content
  81. context = self.resolve_context(self.context_data)
File "/usr/local/lib/python2.7/dist-packages/django/template/response.py"
in resolve_context
  159. return RequestContext(self._request, context,
current_app=self._current_app)
File "/usr/local/lib/python2.7/dist-packages/django/template/context.py"
in __init__
  178. for processor in get_standard_processors() + processors:
File "/usr/local/lib/python2.7/dist-packages/django/template/context.py"
in get_standard_processors
  152. mod = import_module(module)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py"
in import_module
  35. __import__(name)

Exception Type: ValueError at /
Exception Value: Empty module name

-- 
Satinderpal Singh

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ValueError at / Empty module name

2013-09-04 Thread Satinderpal Singh
in documentation:
'django.contrib.admindocs',
'sehra',
)

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
    'level': 'ERROR',
'propagate': True,
},
}
}




-- 
Satinderpal Singh

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


ValueError at / Empty module name

2013-09-04 Thread Satinderpal Singh
I face this error after configuring admin.py file in my project:

ValueError at /

Empty module name

Request Method:GET
Request URL:http://localhost/nanaksar/
Django Version:1.5.2
Exception Type:ValueError
Exception Value:

Empty module name

Exception 
Location:/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py
in import_module, line 35
Python Executable:/usr/bin/python
Python Version:2.7.3

How could i solve this?

-- 
Satinderpal Singh

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: upgrading to 1.5.1

2013-08-18 Thread Satinderpal Singh
On Sun, Aug 18, 2013 at 12:21 PM, Harjot Mann <harjotmann1...@gmail.com> wrote:
> Hello Everyone
> Currently I am using django version 1.4.5 and I want to upgrade it to
> 1.5.1, I have an app in django. I want to know that what problems will
> I face while upgrading to that version. I have no idea about the
> features of new version. Any major points which I need to take into
> consideration?
>
In the 1.5 django version, url requires a non-empty first argument, so
you have to change it accordingly, and there should be other change in
the urls and views, but the advantage of this version is that ,In
Django 1.5, you can now swap out theUser model for one that you write
yourself. This could be a simple extension to the existing User model
– for example, you could add a Twitter or Facebook ID field – or you
could completely replace the User with one totally customized for your
site.

-- 
Satinderpal Singh

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Fwd: Django url error

2013-08-15 Thread Satinderpal Singh
I started new app on django, and configure http.conf file as :

WSGIScriptAlias /lret /home/goraya/lret/lret/apache/django.wsgi

Order allow,deny
Allow from all


and django.wsgi as:

import os
import sys

os.environ['DJANGO_SETTINGS_MODULE'] = 'lret.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
sys.path.append('/home/goraya/')

But got the error:
The requested URL /lret was not found on this server.

 please check where i am going wrong?

-- 
Satinderpal Singh

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Iterating over fields in Formset

2013-08-10 Thread Satinderpal Singh
On Aug 10, 2013 5:48 PM, "Sandeep kaur" <mkaurkha...@gmail.com> wrote:
>
> On Fri, Aug 9, 2013 at 2:50 PM, Sandeep kaur <mkaurkha...@gmail.com>
wrote:
> >  I have my code for formset here :
> >
> >  {% csrf_token %}
> >
> Your help would be really appreciated.
> Waiting.
>
> --
> Sandeep Kaur
> E-Mail: mkaurkha...@gmail.com
> Blog: sandymadaan.wordpress.com
I think in the your views you are trying to save it under the formsets, try
to save the formsets under the form to save all the required rows.

--
Satinderpal Singh

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: new field in models

2013-07-22 Thread Satinderpal Singh
On Jul 22, 2013 1:23 PM, "Harjot Mann" <harjotmann1...@gmail.com> wrote:
>
> In django when we add a new field in existing class, we need to drop
> the table and then run the syncdb again. Is there any alternative for
> it so that we can add the field without dropping the table
South is an alternative, it creates table fields without syncdb.

--
Satinderpal Singh

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Search from database

2013-07-20 Thread Satinderpal Singh
On Sat, Jul 20, 2013 at 8:48 AM, Kamal Kaur <kamal.kaur...@gmail.com> wrote:
> Can we have a search module in django that can suggest resembling
> spellings from mysql database?
>
I am not getting you, please expalin.


--
Satinderpal Singh

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django polls application problem

2013-06-20 Thread Satinderpal Singh
On Thu, Jun 20, 2013 at 7:56 PM, Kamal Kaur <kamal.kaur...@gmail.com> wrote:
> I am new to Django. Creating my first application, Polls. Some field was
> missing in database when I tried to enter multiple
> choices in a poll from terminal. Even it was not done when admin.py
> file was changed to show a bunch of choices. Now previous database is
> dropped and a new one is created. Now python server is not running :(
>
> $ python manage.py runsrver
> ImportError: Could not import settings 'myapp.settings' (Is it on
> sys.path?): No module named myapp.settings

I think you are calling your project, call something sensible, like
your application which is present in the installed application.

> Thanks in advance
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Satinderpal Singh

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: (1242, 'Subquery returns more than 1 row')

2013-04-01 Thread Satinderpal Singh
On Mon, Apr 1, 2013 at 12:48 PM, Siddharth Ghumre
<siddharth.ghumr...@gmail.com> wrote:
> Hi
>
> As per my view your client query is returning more than one rows from your
> database.
> Suppose your job = 1 which you are getting from your Report table and the
> query ( Job.objects.all().filter(
> client=job)..)fetches two or more than two records from your 'job'
> table.
>
> Now there can be two scenarios:-
> 1.You are looking for a single record to be displayed after executing
> (Job.objects.all().filter(client=job)..)
> In this case you need to use filter query like
> Job.objects.all().filter(Q(client=job)(something=something)(something=something)...)
> which will give you a unique row as per your filter criteria.
>
> 2.You are looking for multiple records to be displayed:-
> In this case you need to add a for after your query.
> Like
>  table1=[]
>  client = Job.objects.all().filter(client=job)
>  for i in client:
> client__client__first_name = i.first_name
> client__client__middle_name = i.middle_name
> ...
> ...
> ...
>
> table1.append({"client__client__first_name":client__client__first_name,"
> client__client__middle_name": client__client__middle_name,.})
>
>
>  temp = {'client':table1, 'cubee':cubee, 'Head':Head,
> 'organisation':organisation,'department':department,}
>
>
> I hope this might solve your problem.


Thanks Siddharth, for the explanation.
>
>
>
>
>
> On Mon, Apr 1, 2013 at 2:51 AM, Satinderpal Singh
> <satinder.goray...@gmail.com> wrote:
>>
>> I have the following error in my project
>>
>> (1242, 'Subquery returns more than 1 row')
>>
>> my views are as given below
>>
>> def result_cube(request):
>> Id = Cube.objects.aggregate(Max('Report_id'))
>> ID = Id['Report_id__max']
>> cubee = Cube.objects.filter(Report_id = ID)
>> Id = Report.objects.aggregate(Max('id'))
>> ID = Id['id__max']
>> Head = Report.objects.filter(id = ID)
>> organisation = Organisation.objects.all().filter(id = 1)
>> department = Department.objects.all().filter(id = 1)
>>
>> Id = Report.objects.aggregate(Max('job'))
>> ID = Id['job__max']
>> job = Report.objects.filter(job = ID)
>>
>> client =
>> Job.objects.all().filter(client=job).values('client__client__first_name',
>> 'client__client__middle_name', 'client__client__last_name',
>> 'client__client__address', 'client__client__city', 'date',
>> 'letter_no', 'letter_date')
>>
>> temp = {'client':client, 'cubee':cubee, 'Head':Head,
>> 'organisation':organisation,'department':department,}
>> return render_to_response('report/cube.html',
>> dict(temp.items() + tmp.items()),
>> context_instance=RequestContext(request))
>>
>>
>> Error during template rendering
>>
>> In template /home/satinder/Automation/templates/report/header.html,
>> error at line 12
>>
>> 2 {% load i18n %}
>> 3 
>> 4 {% block content %}
>> 5 
>> 6 {% for Heads in Head %}
>> 7 
>> 8 No.GNDEC/TCC/R/{{Heads.job_id}}> align="right">Dated{{Heads.dispatch_report_date}}
>> 9 
>> 10  To,
>> 12 {% for add in client %}
>> 13  {{ add.client__client__first_name}} {{
>> add.client__client__middle_name}}
>> {{add.client__client__last_name}}
>> 14  {{add.client__client__address}}
>> 15 {{ add.client__client__city}}
>> 16 {% endfor %}
>> 17
>>
>> Can anybody help me to solve this error.
>>
>>
>> --
>> Satinderpal Singh
>> http://devplace.in/~satinder/wordpress/
>> http://satindergoraya.blogspot.in/
>> http://satindergoraya91.blogspot.in/
>>
>> --
>> 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?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> 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@google

(1242, 'Subquery returns more than 1 row')

2013-03-31 Thread Satinderpal Singh
I have the following error in my project

(1242, 'Subquery returns more than 1 row')

my views are as given below

def result_cube(request):
Id = Cube.objects.aggregate(Max('Report_id'))
ID = Id['Report_id__max']
cubee = Cube.objects.filter(Report_id = ID)
Id = Report.objects.aggregate(Max('id'))
ID = Id['id__max']
Head = Report.objects.filter(id = ID)
organisation = Organisation.objects.all().filter(id = 1)
department = Department.objects.all().filter(id = 1)

Id = Report.objects.aggregate(Max('job'))
ID = Id['job__max']
job = Report.objects.filter(job = ID)

client =
Job.objects.all().filter(client=job).values('client__client__first_name',
'client__client__middle_name', 'client__client__last_name',
'client__client__address', 'client__client__city', 'date',
'letter_no', 'letter_date')

temp = {'client':client, 'cubee':cubee, 'Head':Head,
'organisation':organisation,'department':department,}
return render_to_response('report/cube.html',
dict(temp.items() + tmp.items()),
context_instance=RequestContext(request))


Error during template rendering

In template /home/satinder/Automation/templates/report/header.html,
error at line 12

2 {% load i18n %}
3 
4 {% block content %}
5 
6 {% for Heads in Head %}
7 
8 No.GNDEC/TCC/R/{{Heads.job_id}}Dated{{Heads.dispatch_report_date}}
9 
10  To,
12 {% for add in client %}
13  {{ add.client__client__first_name}} {{
add.client__client__middle_name}}
{{add.client__client__last_name}}
14  {{add.client__client__address}}
15 {{ add.client__client__city}}
16 {% endfor %}
17

Can anybody help me to solve this error.


--
Satinderpal Singh
http://devplace.in/~satinder/wordpress/
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Goodbye, Malcolm

2013-03-19 Thread Satinderpal Singh
On Tue, Mar 19, 2013 at 10:31 PM, Jacob Kaplan-Moss <ja...@jacobian.org> wrote:
> Hello fellow Djangonauts,
>
> We have difficult news: Malcolm Tredinnick has passed away.
>
> Malcolm was a long-time contributor to Django, a model community member,
> a brilliant mind, and a friend. His contributions to Django — and to
> many other open source projects — are nearly impossible to enumerate.
> Many on the core Django team had their first patches reviewed by him;
> his mentorship enriched us. His consideration, patience, and dedication
> will always be an inspiration to us.
>
> To say we'll miss him is an understatement.
>
> Our thoughts are with Malcolm's friends, colleagues, and family at this
> difficult time.
>
> This came as quite a shock, and we're still sorting out details. We'll
> update our blog,
> https://www.djangoproject.com/weblog/2013/mar/19/goodbye-malcolm/,
> once we know the details of how you can express your condolences to
> Malcolm's friends and family.

Rest in Peace

> — The Django Core Team
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-develop...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Satinderpal Singh
http://devplace.in/~satinder/wordpress/
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




error at /accounts/register/ [Errno 101] Network is unreachable

2013-03-17 Thread Satinderpal Singh
I am using smtp for sending the mail from my system, i used the
following settings for the mail, but got an error while anybody trying
to register.
DEFAULT_FROM_EMAIL = 'my_m...@gmail.com'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'my_m...@gmail.com'
EMAIL_HOST_PASSWORD = '*'
EMAIL_USE_TLS = True
EMAIL_PORT = 587

-- 
Satinderpal Singh
http://devplace.in/~satinder/wordpress/
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Saving browser output as pdf

2013-02-24 Thread Satinderpal Singh
On Mon, Feb 25, 2013 at 1:37 AM, Nick Apostolakis <nicka...@oncrete.gr> wrote:
> On Mon, Feb 25, 2013 at 12:18 AM, Mark Furbee <markfur...@gmail.com> wrote:
>>>
>>> Django docs (pretty turse):
>>> https://docs.djangoproject.com/en/dev/howto/outputting-pdf/
>>>
>>>  From ReportLab site:
>>> http://www.reportlab.com/software/documentation/
>>>
>>> Here's a decent quick tutorial:
>>>
>>> http://www.blog.pythonlibrary.org/2010/03/08/a-simple-step-by-step-reportlab-tutorial/
>>>
>>> Note that what you are proposing is to create an HTML version of the
>>> report
>>> and a separate PDF version using ReportLab. Otherwise, if you want to
>>> make
>>> what would be an HTML report download as a PDF document, use @Mike's
>>> solution.
>>>
>>> Good Luck,
>>>
>>
>>
> Indeed Mark's solution is more elegant than mine if you want to use the same
> view as both html or pdf depending on a switch.

In that way the pdf is dependent on the browser, but i want browser
independent output.

> My solution creates two independend views with the same arguments, one of
> them produces always html, and the other pdf. I wanted it that way since
> these two views are aesthetically different.

I also followed this procedure of two independent views of same
argument, that's why i am looking for some easy way out.

> Depending on your design, choose the one most comfortable.
>
>
> --
>  --
>Nick Apostolakis
>   e-mail: nicka...@oncrete.gr
>  Web Site: http://nick.oncrete.gr
>  --
>
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Saving browser output as pdf

2013-02-24 Thread Satinderpal Singh
On Mon, Feb 25, 2013 at 12:18 AM, Mark Furbee <markfur...@gmail.com> wrote:
> Django docs (pretty turse):
> https://docs.djangoproject.com/en/dev/howto/outputting-pdf/
>
> From ReportLab site:
> http://www.reportlab.com/software/documentation/
>
> Here's a decent quick tutorial:
> http://www.blog.pythonlibrary.org/2010/03/08/a-simple-step-by-step-reportlab-tutorial/
>
> Note that what you are proposing is to create an HTML version of the report
> and a separate PDF version using ReportLab. Otherwise, if you want to make
> what would be an HTML report download as a PDF document, use @Mike's
> solution.
>
> Good Luck,
Thanks.
>
> Mark
>
>
> On Sun, Feb 24, 2013 at 8:04 AM, Satinderpal Singh
> <satinder.goray...@gmail.com> wrote:
>>
>> On Sun, Feb 24, 2013 at 8:00 PM, Nick Apostolakis <nicka...@oncrete.gr>
>> wrote:
>> > On 24/02/2013 03:15 μμ, Satinderpal Singh wrote:
>> >>
>> >> Thanks a lot to all. I noted your suggestions, and will try to
>> >> implement one which would be best suit to my requirement.
>> >>
>> >> By the way, i am trying to take pdf output from the models and for
>> >> that i required these libraries. Currently, i am using pisa for saving
>> >> the output of the report as pdf file.
>> >>
>> >> Basically i need both outputs, html and pdf, for my clients. I need to
>> >>   produce more than 40 different reports as html and pdf so that my
>> >> client can take whatever he needed. And if i tried to produce both
>> >> html and pdf from views, then it requires functions double to the
>> >> reports, two for each html and pdf. So, i need solution which can
>> >> convert my html output to the pdf from browser.
>> >>
>> >>
>> >>
>> >
>> > Hi there, I use the report lab library in my application to produce pdf
>> > reports.
>> >
>> > The user sees the report in html of course and has an option to download
>> > it
>> > as csv or as pdf.
>> > The pdf part is accomplished with reportlab library.
>> >
>> That exactly i want, please tell me how will i do this.
>>
>>
>> > Cheers
>> >
>> > --
>> >  --
>> >Nick Apostolakis
>> >   e-mail: nicka...@oncrete.gr
>> >  Web Site: http://nick.oncrete.gr
>> >  --
>> >
>> >
>> >
>> > --
>> > 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?hl=en.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>>
>>
>>
>> --
>> Satinderpal Singh
>> http://satindergoraya.blogspot.in/
>> http://satindergoraya91.blogspot.in/
>>
>> --
>> 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?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Saving browser output as pdf

2013-02-24 Thread Satinderpal Singh
On Sun, Feb 24, 2013 at 8:00 PM, Nick Apostolakis <nicka...@oncrete.gr> wrote:
> On 24/02/2013 03:15 μμ, Satinderpal Singh wrote:
>>
>> Thanks a lot to all. I noted your suggestions, and will try to
>> implement one which would be best suit to my requirement.
>>
>> By the way, i am trying to take pdf output from the models and for
>> that i required these libraries. Currently, i am using pisa for saving
>> the output of the report as pdf file.
>>
>> Basically i need both outputs, html and pdf, for my clients. I need to
>>   produce more than 40 different reports as html and pdf so that my
>> client can take whatever he needed. And if i tried to produce both
>> html and pdf from views, then it requires functions double to the
>> reports, two for each html and pdf. So, i need solution which can
>> convert my html output to the pdf from browser.
>>
>>
>>
>
> Hi there, I use the report lab library in my application to produce pdf
> reports.
>
> The user sees the report in html of course and has an option to download it
> as csv or as pdf.
> The pdf part is accomplished with reportlab library.
>
That exactly i want, please tell me how will i do this.


> Cheers
>
> --
>  --
>Nick Apostolakis
>   e-mail: nicka...@oncrete.gr
>  Web Site: http://nick.oncrete.gr
>  --
>
>
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: saving get objects to models

2013-01-22 Thread Satinderpal Singh
>> material = Material.objects.get(name=request.GET['material'])
>>
> I think this will help you :
> p = table(material =material, ...[other fields of table to be saved])
> p.save()

Thanks, this works for me.

> Here table is your table where you want object value to be saved.
> Hope this helps you.

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: saving get objects to models

2013-01-22 Thread Satinderpal Singh
Thanks, for this help

On Tue, Jan 22, 2013 at 9:34 PM, Bill Freeman <ke1g...@gmail.com> wrote:
> Forgive me if I am not being direct, but I'm not sure I understand your
> question.
You understand the problem very well.

> For the python statement that you include in your question to work, the
> following must be true:
>
> 1. There must be a query parameter on the url named "material".  e.g.;
> http://localhost:8000/myview/?material=admantium
> (Usually this would be provided using a form html tag, plus an input or
> select tag with name='material'.)
I have query parameter "material" in the url.

> 2. There must not be multiple material query parameters named "material" (or
> only the last will be used).


> 3. There must already be a row in the database's table for the Material
> model whose name field matches the value of the query ("admantium" in the
> case of the url in point #1), and only one row with that name.  (The row
> will be fetched from the database, and the values of its fields will be used
> to initialize attributes of the python class instance called 'material' in
> your sample.)
Yes, there is a row present in the database whose name field matches
to the value of query.

> None of this is what is known as "save"ing in the context of Django.  "save"
> is the transfer of data from the python class instance back to the database.
> If this is truly what you wish to do, modifying your existing row, you
> would, after the  statement you provided, assign new values to one or more
> of instance's attributes (e.g.; material.color = 'pink'), and then call
> material.save().
This is the thing i am asking for, i am unable to save the context of
Django. I used the logic given by you but it did not worked. How will
i save the value of material in the database name field.

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: new user

2012-12-21 Thread Satinderpal Singh
On Fri, Dec 21, 2012 at 5:57 PM, senthil mariyappan
<senthilbs...@gmail.com> wrote:
> hi friends, i new one to django..

Welcome to the Django family.

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: IntegrityError

2012-12-18 Thread Satinderpal Singh
On Tue, Dec 18, 2012 at 12:25 PM, Sandeep kaur <mkaurkha...@gmail.com> wrote:
> On Tue, Dec 18, 2012 at 2:48 AM, Satinderpal Singh
> <satinder.goray...@gmail.com> wrote:
>> I created a search box for searching the information about the client
>> so that this information uses to create the report.
>
> add these lines :
>
>> def search(request):
> 
>>   {% endfor %}
>>
>> i want to get job id to be saved through header view:
>> def header(request):
>job =Job.objects.get(id=request.GET['q'])
>> if request.method=='POST':
>> form = headForm(request.POST)
>> if form.is_valid():
>> cd = form.cleaned_data
>profile = form.save(commit=False)
>profile.job = job
>profile.save()
>form.save()
>> HttpResponseRedirect(reverse('Automation.report.views.result'))
>>
>> But get the following error:
>> IntegrityError at /report/header/
>> (1048, "Column 'job_id' cannot be null")
>>
>> Please anybody tell me where i am wrong?
>>
> Hope this helps you.
Yeah it works! Thanks.

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: IntegrityError

2012-12-18 Thread Satinderpal Singh
On Tue, Dec 18, 2012 at 11:21 AM, Chris Cogdon <ch...@cogdon.org> wrote:
> Can you post the code for the model, and the complete exception trace?

class head(models.Model):
job = models.ForeignKey(Job, null=True)
Header_column_1 = models.CharField(max_length=255,blank=True)
Header_column_2 = models.CharField(max_length=255,blank=True)
Footer_column_3 = models.CharField(max_length=255,blank=True)

def __str__(self):
return self.refrence_no

>
> On Monday, December 17, 2012 1:18:54 PM UTC-8, Satinderpal Singh wrote:
>>
>> I created a search box for searching the information about the client
>> so that this information uses to create the report.
>> def search(request):
>> query = request.GET.get('q', '')
>> if query:
>> results = Job.objects.filter(id =
>>
>> query).values('client__client__name','client__client__address_1','clientjob__material__name','suspencejob__field__name','id','job_no','date','site','report_type',)
>> else:
>> results = []
>> return render_to_response("report/search.html", {"results":
>> results,"query": query})
>>
>> I want to save the value of job in the report table to create a report
>> like:
>>   {% for job in results %}
>> Job Id : {{ job.id }}
>> Name:{{job.client__client__name}}
>> Job No. : {{job.job_no}}
>> Site : {{job.site}}
>> Reference Letter No : {{job.Reference_Letter_no}}
>> Letter Date : {{job.Letter_date}}
>> Address : {{job.client__client__address_1}}
>> Material : {{job.clientjob__material__name}}
>> Report
>>   {% endfor %}
>>
>> i want to get job id to be saved through header view:
>> def header(request):
>> if request.method=='POST':
>> form = headForm(request.POST)
>> if form.is_valid():
>> cd = form.cleaned_data
>> form.save()
>>     return
>> HttpResponseRedirect(reverse('Automation.report.views.result'))
>>
>> But get the following error:
>> IntegrityError at /report/header/
>> (1048, "Column 'job_id' cannot be null")
>>
>> Please anybody tell me where i am wrong?
>>
>>
>>
>>
>> --
>> Satinderpal Singh
>> http://satindergoraya.blogspot.in/
>> http://satindergoraya91.blogspot.in/
>
> --
> 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/-/8St7erk3yrAJ.
> 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.



--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: Can't undestrand Url pagination and template

2012-12-02 Thread Satinderpal Singh
On Sun, Dec 2, 2012 at 5:16 PM, joy <agnese.camell...@gmail.com> wrote:
> Hello, i'm new to Django and i'm still learning how to use it. I got a book
> but somethings doesn't work, i cannot work with templates, and every advice
> given from the book look not precise and obsolete (the book speaks about a
> previous version of django.
> Anyone has a good tutorial on templates.
> I'm trying with the website of django hoping on something better. Let me
> know
This book may help you to understand urls and templates in better way:
http://www.djangobook.com/en/2.0/chapter01.html

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: calling the view function in the other view function

2012-11-30 Thread Satinderpal Singh
On Sat, Dec 1, 2012 at 4:45 AM, Chris Cogdon <ch...@cogdon.org> wrote:
> It's generally very messy for one "view" function to call another.
Then what is the fun of making the function, if it is not reusable.
>
> Better solution is to factorise out the common parts into a third function,
> then make sure each of your two "view" functions have the required
> render_to_response.

What will i do if i have a large number of views having the common part.

> Also, I highly recommend using the "render" shortcut, which would turn your
> more complex calls into this:
Thanks, for the kind advise.
> return render ( request, 'report/report_base.html', {'Head':Head,} )
>
>

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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.



Fwd: Ignoring _ character an showing % character in the Django

2012-11-27 Thread Satinderpal Singh
How do i write the column names in the django models so that it
ignores _ character and show % in the output label of templates.

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/


--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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.



TypeError:

2012-11-15 Thread Satinderpal Singh
I am using a custom field "SeparatedValuesField" for saving array
values in my models. When i tried to save the values in it, in the
python shell, it gives the following error:
 TypeError: get_db_prep_value() got an unexpected keyword argument 'connection'
Is anybody know, what error is this, and how will save the array
values to my models.
--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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.



Adding rows to the form

2012-11-15 Thread Satinderpal Singh
Hi friends,
I want to create a form so that the tables related to the form accepts
the multiple values by adding rows in the form, just like in gmail
attachments, which uses add new button for a new attachment. I tried
many methods but does not got the fruitful result. Like by using
javascript for adding the row can add the row to the form but saves
only the first entry of the first row but not saved the entries of the
rows that can be added by the add button.
Can anybody tell me how would i solve this problem. Any help would be
highly appreciated.

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: login using an external database

2012-11-09 Thread Satinderpal Singh
On Fri, Nov 9, 2012 at 7:21 PM, Lucas Nunes ''Ruivinhoshow''
<ruivinhos...@hotmail.com> wrote:
> i mean  db = database
>
>>
>> uhmm... but the second app isn't in django.  it was built in php I
>> think... or it doesn't matter?
>
>
> the important is:  I have access to a database that is part of another
> application and want to use the login fields from there to log into my
> system .. a database for two apps
I don't know exactly, but this may help you:
Describe the two databases in the settings file like:

DATABASES = {
'default': {
'NAME': 'app_data',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'postgres_user',
'PASSWORD': 's3krit'
},
'users': {
'NAME': 'user_data',
'ENGINE': 'django.db.backends.mysql',
'USER': 'mysql_user',
'PASSWORD': 'priv4te'
}
}


--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: login using an external database

2012-11-09 Thread Satinderpal Singh
On Fri, Nov 9, 2012 at 6:02 PM, Lucas Nunes ''Ruivinhoshow''
<ruivinhos...@hotmail.com> wrote:
> hi, i'm brazilian (sorry for dude engl.. xD ). I want to login an user using
> the tables that exists in other db...
What do you mean by other db,
> i'll need the tables named  'matricula' and 'password',  and so i log on
> this user in my app...
If you want to join the two application databases, use the following query.
from django.appName import TableName

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: 'FormSet' object has no attribute 'save'

2012-10-17 Thread Satinderpal Singh
On Wed, Oct 17, 2012 at 4:49 PM, Tom Evans <tevans...@googlemail.com> wrote:
> On Wed, Oct 17, 2012 at 7:06 AM, Satinderpal Singh
> <satinder.goray...@gmail.com> wrote:
>> I used formsets for different forms in my project, it displays the
>> forms to user but on submitting the form it gives the following error:
>>  'chem_analysisFormFormSet' object has no attribute 'save'. I don't
>> know how to save the formset in the views. Here is the code of my
>> views file of my project:
>>
>> def chemical_analysis(request):
>> ChemicalFormSet = formset_factory(chem_analysisForm)
>> if request.method=='POST':
>> formset = ChemicalFormSet(request.POST, 
>> request.FILES)
>> if formset.is_valid():
>> cd = formset.cleaned_data
>> formset.save()
>> return 
>> HttpResponseRedirect(reverse('Automation.report.views.result_chem'))
>> #return 
>> render_to_response('report/chemical_analysis.html',
>> {'chem': chem,},context_instance=RequestContext(request))
>> else:
>> return HttpResponse("There was an error with 
>> your
>> submission. Please try again.")
>>
>> else:
>> formset = ChemicalFormSet()
>> return 
>> render_to_response('report/report_add_row.html', {'formset':
>> formset}, context_instance=RequestContext(request))
>>
>
> Why would it have a save() method? Only model forms and model formsets
> have save() methods. Model formsets are defined using the
> modelformset_factory factory, not formset_factory.
>
> https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/#model-formsets
Thanks, now i clearly understand my mistake and with your help i am
able to run the program successfully.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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.



'FormSet' object has no attribute 'save'

2012-10-17 Thread Satinderpal Singh
I used formsets for different forms in my project, it displays the
forms to user but on submitting the form it gives the following error:
 'chem_analysisFormFormSet' object has no attribute 'save'. I don't
know how to save the formset in the views. Here is the code of my
views file of my project:

def chemical_analysis(request):
ChemicalFormSet = formset_factory(chem_analysisForm)
if request.method=='POST':
formset = ChemicalFormSet(request.POST, request.FILES)
if formset.is_valid():
cd = formset.cleaned_data
formset.save()
return 
HttpResponseRedirect(reverse('Automation.report.views.result_chem'))
#return 
render_to_response('report/chemical_analysis.html',
{'chem': chem,},context_instance=RequestContext(request))
else:
return HttpResponse("There was an error with 
your
submission. Please try again.")

else:
formset = ChemicalFormSet()
return render_to_response('report/report_add_row.html', 
{'formset':
formset}, context_instance=RequestContext(request))

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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.



Adding a new row to the database in user form

2012-10-15 Thread Satinderpal Singh
Hello,
I want to add a new row in the existing database table by using add
button in the html form from the user as user can create as much rows
in the table as he needed, how will i add this?
Thanks, in advance.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: The view didn't return an HttpResponse object.

2012-10-01 Thread Satinderpal Singh
On Mon, Oct 1, 2012 at 4:58 PM, Babatunde Akinyanmi
<tundeba...@gmail.com> wrote:
> Oooops. I see the question has already been answered. My phone didn't
> get the update on time.
No worries, Thanks anyways

> On 10/1/12, Babatunde Akinyanmi <tundeba...@gmail.com> wrote:
>> Its possible that when you refresh the form and the POST request gets
>> submitted, the form doesn't pass the form.is_valid() if conditional.
>> In your code, you didn't make any provision for when the form fails
>> the is_valid() test and from your code, execution stops once
>> is_valid() returns False so I **guess** that's where the problem lies.
>>
>> Try re-rendering the submitted form if is_valid is False or doing a
>> redirect.
>>
>> On 10/1/12, Satinderpal Singh <satinder.goray...@gmail.com> wrote:
>>> I made a model form and a view which accepts input as a form and
>>> display it in the html format. As when i refresh the html page or try
>>> to fill another entry in the form, it gives the following error:
>>>
>>> The view Automation.report.views.chemical_analysis didn't return an
>>> HttpResponse object.
>>>
>>> Here is the views that creates this problem:
>>> def chemical_analysis(request):
>>>  if request.method=='POST':
>>>  form = chem_analysisForm(request.POST)
>>>  if form.is_valid():
>>>  cd = form.cleaned_data
>>>  form.save()
>>>  chem = chem_analysis.objects.all()
>>>  #return HttpResponseRedirect(chem)
>>>  return 
>>> render_to_response('report/chemical_analysis.html',
>>> {'chem': chem,},context_instance=RequestContext(request))
>>>
>>>  else:
>>>  form = chem_analysisForm()
>>>  return render_to_response('report/report.html', 
>>> {"form":form},
>>> context_instance=RequestContext(request))
>>>
>>> Any help regarding this will be highly appreciated.
>>>
>>> --
>>> Satinderpal Singh
>>> http://satindergoraya.blogspot.in/
>>> http://satindergoraya91.blogspot.in/
>>>
>>> --
>>> 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.
>>>
>>>
>>
>> --
>> Sent from my mobile device
>>
>
> --
> Sent from my mobile device
>
> --
> 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.
>



-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: The view didn't return an HttpResponse object.

2012-10-01 Thread Satinderpal Singh
On Mon, Oct 1, 2012 at 4:27 PM, Tom Evans <tevans...@googlemail.com> wrote:
> On Mon, Oct 1, 2012 at 11:36 AM, Satinderpal Singh
> <satinder.goray...@gmail.com> wrote:
I add the following to my code,
>> I made a model form and a view which accepts input as a form and
>> display it in the html format. As when i refresh the html page or try
>> to fill another entry in the form, it gives the following error:
>>
>> The view Automation.report.views.chemical_analysis didn't return an
>> HttpResponse object.
>>
>> Here is the views that creates this problem:
>> def chemical_analysis(request):
>> if request.method=='POST':
>> form = chem_analysisForm(request.POST)
>> if form.is_valid():
>> cd = form.cleaned_data
>> form.save()
>> chem = chem_analysis.objects.all()
>> #return HttpResponseRedirect(chem)
>> return 
>> render_to_response('report/chemical_analysis.html',
>> {'chem': chem,},context_instance=RequestContext(request))
else:
return HttpResponse("There was an error with 
your
submission. Please try again.")
>>
>> else:
>> form = chem_analysisForm()
>> return render_to_response('report/report.html', 
>> {"form":form},
>> context_instance=RequestContext(request))
>>
>> Any help regarding this will be highly appreciated.
>>
>
> If the request method is POST, but the form is not valid, then no
> response is returned. You must return a response from every code path.
Thanks, it works and now gives the error message, can you please tell
me that why the input values are not saved in the database and it
gives only the error message. Point me where i am wrong.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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.



The view didn't return an HttpResponse object.

2012-10-01 Thread Satinderpal Singh
I made a model form and a view which accepts input as a form and
display it in the html format. As when i refresh the html page or try
to fill another entry in the form, it gives the following error:

The view Automation.report.views.chemical_analysis didn't return an
HttpResponse object.

Here is the views that creates this problem:
def chemical_analysis(request):
if request.method=='POST':
form = chem_analysisForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
form.save()
chem = chem_analysis.objects.all()
#return HttpResponseRedirect(chem)
return 
render_to_response('report/chemical_analysis.html',
{'chem': chem,},context_instance=RequestContext(request))

else:
form = chem_analysisForm()
return render_to_response('report/report.html', 
{"form":form},
context_instance=RequestContext(request))

Any help regarding this will be highly appreciated.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: Extending templates

2012-09-18 Thread Satinderpal Singh
On Tue, Sep 18, 2012 at 3:45 PM, Tom Evans <tevans...@googlemail.com> wrote:
> On Mon, Sep 17, 2012 at 8:14 AM, Satinderpal Singh
> <satinder.goray...@gmail.com> wrote:
>> I want to extend a template file into the other file. I get fine
>> results when done simply but whenever I use the template containing
>> 'for' tag into the other, it does not show any results.
>> My code for template which is to be extended is here :
>>
>> #template file to be extended into the other
>> 
>> 
>> {% block header %}
>>
>> {% for organisations in organisation %}
>
> Is this just a logic fail?
No, it is not the logic failure as the output is listed when file is
not extended for other file.

> Is 'organization' a list of organizations?
> Or should this be 'for organization in organizations'?
>
No.
The 'organization' is an object which calls the values from the database.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: Extending templates

2012-09-18 Thread Satinderpal Singh
> With template 'inheritance', when you extend another template, what
> happens is that the named blocks in the parent template are replaced
> with the equivalently named blocks in the derived template.
>
> This means that in the derived template, everything outside of a named
> block is ignored. You have lots of content outside the named blocks,
> so this is probably causing you some grief.
>
But I have used different block names for both the files. So I don't
think there is any chance of overriding  of data.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: Extending templates

2012-09-17 Thread Satinderpal Singh
On Tue, Sep 18, 2012 at 9:45 AM, jondykeman <jondyke...@gmail.com> wrote:
> So the header for loop is the one that is not working?
Yes, you are right.

> Is organisation being fed to the view properly?
Yes, it fed properly, as i checked it by making a template for the
organisation view, it correctly fetch values from the database, the
problem is only in extending the for loop to the other file.

> If you put in {{ organisation }} in the section that is rendering properly
> is it showing up as you expect?
Yes, it shows proper results as expected.
>
> JD
>
> On Monday, September 17, 2012 10:59:16 AM UTC-6, Satinder Goraya wrote:
>>
>> On Mon, Sep 17, 2012 at 7:31 PM, jondykeman <jondy...@gmail.com> wrote:
>> > Can you put the code of the template you are extending this one with?
>> Here is the file that is extending:
>>
>> {% extends "report/report_header.html" %}
>> {% load i18n %}
>> 
>> 
>> {% block content %}
>> 
>> 
>> 
>> Date of testing :> align="left">{{Date_of_testing}}
>> 
>> 
>> Type of Structure:> align="left">{{Type_of_str}}
>> 
>> 
>> Site location:> align="left">Latitude: {{Latitude_N}}Longitude: {{Longitude_E}}
>> 
>> 
>>  
>> Tested in Presence of:> align="left">{{Presence_1}}, {{Presence_2}}
>> 
>> 
>> Report Submitted to > align="left">{{Submitted_1}}, {{Submitted_2}},
>> {{Submitted_3}}
>> 
>>
>> 
>> 
>> 
>> 
>> {% endblock %}
>>
>> You can see full file at:
>> http://202.164.53.122/~satinderpal/report_ok.html
>>
>> > What I would guess from what you said is that you might be using {%
>> > block
>> > head %} {% endblock %} in the other template that extends this one.
>> No, i used {% block content %} {% end block %} for that
>>
>> > In that case you would override that for loop. If you want to add to the
>> > head and also retain that for loop you will need to move the for outside
>> > of
>> > the block in the base template, but will be able to tell better once
>> > seeing
>> Here is the base file :
>> http://202.164.53.122/~satinderpal/report_header.html
>> > the other template's code.
>> http://202.164.53.122/~satinderpal/report_ok.html
>> >
>> > JD
>> >
>> > On Monday, September 17, 2012 1:15:25 AM UTC-6, Satinder Goraya wrote:
>> >>
>> >> I want to extend a template file into the other file. I get fine
>> >> results when done simply but whenever I use the template containing
>> >> 'for' tag into the other, it does not show any results.
>> >> My code for template which is to be extended is here :
>> >>
>> >> #template file to be extended into the other
>> >> 
>> >> 
>> >> {% block header %}
>> >>
>> >> {% for organisations in organisation %}
>> >> > >> >{{organisations.name}}
>> >> {{organisations.address}}
>> >> {% endfor %}
>> >>
>> >>
>> >> {% endblock %}
>> >> 
>> >> {% block content %}{% endblock %}
>> >>
>> >> Please see where I am going wrong.
>> >>
>> >> --
>> >> Satinderpal Singh
>> >> http://satindergoraya.blogspot.in/
>> >> http://satindergoraya91.blogspot.in/
>> >
>> > --
>> > 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/-/wTGigHz33vYJ.
>> > To post to this group, send email to django...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>>
>>
>>
>> --
>> Satinderpal Singh
>> http://satindergoraya.blogspot.in/
>> http://satindergoraya91.blogspot.in/
>
> --
> 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/-/gF9AcKpbRWsJ.
>
> 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.



-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: Extending templates

2012-09-17 Thread Satinderpal Singh
On Mon, Sep 17, 2012 at 7:31 PM, jondykeman <jondyke...@gmail.com> wrote:
> Can you put the code of the template you are extending this one with?
Here is the file that is extending:

{% extends "report/report_header.html" %}
{% load i18n %}


{% block content %}



Date of testing :{{Date_of_testing}}


Type of Structure:{{Type_of_str}}


Site location:Latitude: {{Latitude_N}}Longitude: {{Longitude_E}}



Tested in Presence of:{{Presence_1}}, {{Presence_2}}


Report Submitted to {{Submitted_1}}, {{Submitted_2}},
{{Submitted_3}}
   





{% endblock %}

You can see full file at: http://202.164.53.122/~satinderpal/report_ok.html

> What I would guess from what you said is that you might be using {% block
> head %} {% endblock %} in the other template that extends this one.
No, i used {% block content %} {% end block %} for that

> In that case you would override that for loop. If you want to add to the
> head and also retain that for loop you will need to move the for outside of
> the block in the base template, but will be able to tell better once seeing
Here is the base file :
http://202.164.53.122/~satinderpal/report_header.html
> the other template's code.
http://202.164.53.122/~satinderpal/report_ok.html
>
> JD
>
> On Monday, September 17, 2012 1:15:25 AM UTC-6, Satinder Goraya wrote:
>>
>> I want to extend a template file into the other file. I get fine
>> results when done simply but whenever I use the template containing
>> 'for' tag into the other, it does not show any results.
>> My code for template which is to be extended is here :
>>
>> #template file to be extended into the other
>> 
>> 
>> {% block header %}
>>
>> {% for organisations in organisation %}
>> > >{{organisations.name}}
>> {{organisations.address}}
>> {% endfor %}
>>
>>
>> {% endblock %}
>> 
>> {% block content %}{% endblock %}
>>
>> Please see where I am going wrong.
>>
>> --
>> Satinderpal Singh
>> http://satindergoraya.blogspot.in/
>> http://satindergoraya91.blogspot.in/
>
> --
> 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/-/wTGigHz33vYJ.
> 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.



-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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.



Extending templates

2012-09-17 Thread Satinderpal Singh
I want to extend a template file into the other file. I get fine
results when done simply but whenever I use the template containing
'for' tag into the other, it does not show any results.
My code for template which is to be extended is here :

#template file to be extended into the other


{% block header %}

{% for organisations in organisation %}
{{organisations.name}}
{{organisations.address}}
{% endfor %}


{% endblock %}
  
{% block content %}{% endblock %}

Please see where I am going wrong.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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.



Using array for making form

2012-09-05 Thread Satinderpal Singh
Hi,
I want to make a form in such a way that the contents of the form
should be declared in the array, and also the user details field
corresponding to that contents of the form, which a user fills, should
also be in array in the the models of the project.
I currently use to do this like:

class soil_oshr(models.Model):
date_of_testing = models.CharField(max_length=255)
type_of_str = models.CharField(max_length=255)
latitude_N = models.CharField(max_length=255,blank=True)
longitude_E = models.CharField(max_length=255,blank=True)
presence_1 = models.CharField(max_length=255)
presence_2 = models.CharField(max_length=255,blank=True)
submitted_1 = models.CharField(max_length=255)
submitted_2 = models.CharField(max_length=255,blank=True)
submitted_3 = models.CharField(max_length=255,blank=True)
site_name = models.CharField(max_length=255)
water_table = models.CharField(max_length=255)
depth_D = models.CharField(max_length=255)
water_table = models.CharField(max_length=255)
def __str__(self):
return self.date_of_testing

class soil_oshrForm(ModelForm):
class Meta :
model = soil_oshr
The thing i need that in case of above class "soil_ohsr" the choices
like "date_of_testing", "type_of_str", "latitude_N", and their values
which are in charfields, should be declared as array to avoid the
lengthy code.
If anybody tell me how i'll do it. Thanks in advance.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

-- 
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: GeometryField in OSMGeoAdmin

2012-08-23 Thread Satinderpal Singh
Hi,
I also start working on the the OSM in Geodjango and i am not much
familiar with it. I installed libraries like geos and starts a project
by following the instructions in the geodjango gide. But it only
tells, how to install libraries, my question is that how will i make
map in my project? Is there any documentation available for that?
Please tell me any possible way to deploy OSM to my project. Thanks in
advance.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/

-- 
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: ImproperlyConfigured at /

2012-08-20 Thread Satinderpal Singh
On Mon, Aug 20, 2012 at 5:24 PM, Amyth Arora <aroras.offic...@gmail.com> wrote:
> Hey,
Thanks for the kind help.
>
> seems you are using django 1.4. FYI ->
Yes, you are right.
> django.template.loaders.app_directories.load_template_source has been
> deprecated so you should rather use
> django.template.loaders.app_directories.Loader
I had already added this to my file, but i made a mistake that i did
not remove the load_template_source.
Thanks again, it works for me.
> Just change :
>
> django.template.loaders.app_directories.load_template_source
> TO
> django.template.loaders.app_directories.Loader

> in the TEMPLATE_LOADERS dictionary in your settings.py file and it
> should have it fixed.
>
>
> On Mon, Aug 20, 2012 at 4:30 PM, Satinderpal Singh
> <satinder.goray...@gmail.com> wrote:
>> I have to deploy osmeditor on my system, and download code from the
>> link: http://wiki.openstreetmap.org/wiki/Editors/Django
>> The database used in this was postgis, but i have mysql on my system,
>> as the tables was successfully made by changing in the settings.py
>> file, but on running it in the browser, it gives the following error:
>>
>> Error importing template source loader
>> django.template.loaders.filesystem.load_template_source: "'module'
>> object has no attribute 'load_template_source'"
>>
>> If anybody helps me to solve the problem. Thanks in advance.
>>
>> --
>> Satinderpal Singh
>> http://satindergoraya.blogspot.in/
>>
>> --
>> 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.
>>
>
>
>
> --
> Thanks & Regards
> 
>
> Amyth [Admin - Techstricks]
> Email - aroras.offic...@gmail.com, ad...@techstricks.com
> Twitter - @a_myth_
> http://techstricks.com/
>
> --
> 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.
>



-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/

-- 
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.



ImproperlyConfigured at /

2012-08-20 Thread Satinderpal Singh
I have to deploy osmeditor on my system, and download code from the
link: http://wiki.openstreetmap.org/wiki/Editors/Django
The database used in this was postgis, but i have mysql on my system,
as the tables was successfully made by changing in the settings.py
file, but on running it in the browser, it gives the following error:

Error importing template source loader
django.template.loaders.filesystem.load_template_source: "'module'
object has no attribute 'load_template_source'"

If anybody helps me to solve the problem. Thanks in advance.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/

-- 
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_DEFAULT_SETTINGS

2012-08-14 Thread Satinderpal Singh
On Tue, Aug 14, 2012 at 9:42 PM, Carlos Andre <eucan...@gmail.com> wrote:
> hi developers i'm with a ptoblem in this date. How work?
> thanks!
Please clear your question, if you are looking for date and time at
your page please follow the following tutorial:
http://www.djangobook.com/en/2.0/chapter03/

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/

-- 
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: AttributeError

2012-08-13 Thread Satinderpal Singh
On Mon, Aug 13, 2012 at 6:06 PM, Melvyn Sopacua <m.r.sopa...@gmail.com> wrote:
> On 13-8-2012 14:23, Melvyn Sopacua wrote:
>> On 13-8-2012 13:47, Satinderpal Singh wrote:
>>
>>> I got the following error while making the tables in database using
>>> syncdb command:
>>>
>>> AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'
>>>
>>> I recently install GEOS library and import it to my model.py file. Any
>>> help will be appreciated, thanks in advance.
>>
>> Instead of:
>> from django.db import models
>> use:
>> from django.contrib.gis.db import models
>
> Strike that, your actual problem is that your settings.py does not
> contain the correct gis enabled backend.
> Still, getting the tutorial to work is key. ;)

Thanks, Melvyn for your kind help. Yes, you are right, my settings.py
file does not contain the correct gis enabled backend. As i am working
on mysql database, so i include following line to the DATABASE engine,

'ENGINE': 'django.contrib.gis.db.backends.mysql',

And then the syncdb command successfully worked.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/

-- 
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.



AttributeError

2012-08-13 Thread Satinderpal Singh
Hi,
I got the following error while making the tables in database using
syncdb command:

AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'

I recently install GEOS library and import it to my model.py file. Any
help will be appreciated, thanks in advance.

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/

-- 
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: Login/ Logout user details

2012-08-09 Thread Satinderpal Singh
On Thu, Aug 9, 2012 at 4:49 PM, Pervez Mulla <mullaper...@gmail.com> wrote:
> Hi,
>
> Please tell me how can I know ,the details about user login and logout
> details , and how can I store that data in DB in Django.
There are many registration modules already made in django, you just
download it and install to your system by following the instruction in
readme file present with that package. Follow the links like
http://docs.b-list.org/django-registration/0.8/quickstart.html
http://forum.webfaction.com/viewtopic.php?id=2230

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/

-- 
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.