Re: Q about wizard.form.forms

2013-02-24 Thread Rob Slotboom
Babatunde wrote:

It is satisfied when the step contains a formset



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




how to evaluate "cities/countries of the world" static table for an application.

2013-02-24 Thread Fatih Tiryakioglu
Hello all,

Is there any shortcut for evaluating such a database table, or should I 
collect myself all this information. Please help. If you prefer a package 
which one do you prefer, or all of them is workable.

Thanks.


--

-- 
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  wrote:
> On Mon, Feb 25, 2013 at 12:18 AM, Mark Furbee  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: Manually added foreign key not working.

2013-02-24 Thread Mike Dewhirst

On 25/02/2013 2:59pm, laxmikant ratnaparkhi wrote:

Does anybody can answer this?


Try changing your model from FK_Formats = models.ForeignKey(Formats) to ...

FK_Format = models.ForeignKey(Formats)Â Â

... and see what happens to the error.

Mike



Let me know if anything extra is required?

Thanks in advance...


Laxmikant

On Wed, Feb 20, 2013 at 6:23 PM, laxmikant ratnaparkhi
> wrote:

Hello all,

I just run a command to Add foreign key to the existing table. and
the command was like this:

*ALTER TABLE acfs_subscriptionmaster ADD CONSTRAINT FK_Formats
FOREIGN KEY (id) REFERENCES acfs_formats (id) MATCH FULL;*

It has got executed. but giving error on the interface

column acfs_subscriptionmaster.FK_Formats_id does not exist
LINE 1: ...ccountmaster"."id") INNER JOIN "acfs_formats" ON
("acfs_subs...

*What could be the reason, What Should I do to solve this. I can't
DROP Table. ?*

*my models.py looks like this :*

class SubscriptionMaster(models.Model):
    """
    """
    uid = models.TextField(blank=True, null=True)
    FK_SubsType = models.ForeignKey(SubscriptionType)
    FK_Product = models.ForeignKey(ProductMaster)
*Â Â Â  FK_Formats = models.ForeignKey(Formats)Â Â
<<--Â Â Â Â Â Â Â Â Â Â Â  Added
this field in models.py
*Â Â Â  ccs_minimum_price = models.TextField(blank=True, null=True)
    ccs_maximum_price = models.TextField(blank=True, null=True)
    ccs_Increment_type = models.TextField(blank=True, null=True)
    ccs_minimum_increment = models.TextField(blank=True, null=True)
    ccs_maximum_increment = models.TextField(blank=True, null=True)
    ccs_default_offer = models.TextField(blank=True, null=True)

Checked SQL Got created by *python manage.py sqlall* acfs

This is my table :

CREATE TABLE "acfs_subscriptionmaster" (
    "id" serial NOT NULL PRIMARY KEY,
    "uid" text,
    "FK_SubsType_id" integer NOT NULL REFERENCES
"acfs_subscriptiontype" ("id") DEFERRABLE INITIALLY DEFERRED,
    "FK_Product_id" integer NOT NULL REFERENCES
"acfs_productmaster" ("id") DEFERRABLE INITIALLY DEFERRED,
*Â Â Â  "FK_Formats_id" integer NOT NULL REFERENCES "acfs_formats"
("id") DEFERRABLE INITIALLY DEFERRED, <--This field has
got created here *
    "ccs_minimum_price" text,
    "ccs_maximum_price" text,
    "ccs_Increment_type" text,
    "ccs_minimum_increment" text,
    "ccs_maximum_increment" text,
    "ccs_default_offer" text,
);

Also its howing indexes like this :

CREATE INDEX "acfs_subscriptionformats_FK_Format_id" ON
"acfs_subscriptionformats" ("FK_Format_id");
CREATE INDEX "acfs_subscriptionmaster_FK_SubsType_id" ON
"acfs_subscriptionmaster" ("FK_SubsType_id");
CREATE INDEX "acfs_subscriptionmaster_FK_Product_id" ON
"acfs_subscriptionmaster" ("FK_Product_id");
CREATE INDEX "acfs_subscriptionmaster_FK_Formats_id" ON
"acfs_subscriptionmaster" ("FK_Formats_id");

Looks like error is field has not got created in actual database :
*python manage.py dbshell*
*acfsdb1=# SELECT * FROM acfs_subscriptionmaster;*
 id | uid | FK_SubsType_id | FK_Product_id | ccs_minimum_price |
ccs_maximum_price | ccs_Increment_type | ccs_minimum_increment |
ccs_maximum_increment | ccs_default_of
fer | fix_startdatetime | fix_expiydatetime | fix_price | dur_period
| wd_field_01 | wd_field_02 | wd_field_03 | wd_field_04 |
wd_field_05 | flag_field_01 | created_dat
e_time | modified_date_time

+-++---+---+---++---+---+---

+---+---+---++-+-+-+-+-+---+
---+
(0 rows)

This is my DJANGO - Python versions

Django Version: 1.2.7
Exception Type: DatabaseError
Exception Value:

column acfs_subscriptionmaster.FK_Format_id does not exist
LINE 1: ...ccountmaster"."id") INNER JOIN "acfs_formats" ON ("acfs_subs...
  ^

Exception Location:

/usr/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py
in execute, line 44
Python Executable:  /usr/bin/python
Python Version: 2.6.6

*postgres 9.1*


Traceback Variables (see at the bottom for the error)
â–¼ Local vars

args
()
e   
ProgrammingError('column acfs_subscriptionmaster.FK_Format_id does
not exist\nLINE 1: 

Re: Manually added foreign key not working.

2013-02-24 Thread laxmikant ratnaparkhi
Does anybody can answer this?

Let me know if anything extra is required?

Thanks in advance...


Laxmikant

On Wed, Feb 20, 2013 at 6:23 PM, laxmikant ratnaparkhi
wrote:

> Hello all,
>
> I just run a command to Add foreign key to the existing table. and the
> command was like this:
>
> *ALTER TABLE acfs_subscriptionmaster ADD CONSTRAINT FK_Formats FOREIGN
> KEY (id) REFERENCES acfs_formats (id) MATCH FULL;*
>
> It has got executed. but giving error on the interface
>
> column acfs_subscriptionmaster.FK_Formats_id does not exist
> LINE 1: ...ccountmaster"."id") INNER JOIN "acfs_formats" ON ("acfs_subs...
>
> *What could be the reason, What Should I do to solve this. I can't DROP
> Table. ?*
>
> *my models.py looks like this :*
>
> class SubscriptionMaster(models.Model):
> """
> """
> uid = models.TextField(blank=True, null=True)
> FK_SubsType = models.ForeignKey(SubscriptionType)
> FK_Product = models.ForeignKey(ProductMaster)
> *FK_Formats = models.ForeignKey(Formats)
> <<--Added this field in
> models.py
> *ccs_minimum_price = models.TextField(blank=True, null=True)
> ccs_maximum_price = models.TextField(blank=True, null=True)
> ccs_Increment_type = models.TextField(blank=True, null=True)
> ccs_minimum_increment = models.TextField(blank=True, null=True)
> ccs_maximum_increment = models.TextField(blank=True, null=True)
> ccs_default_offer = models.TextField(blank=True, null=True)
>
> Checked SQL Got created by *python manage.py sqlall* acfs
>
> This is my table :
>
> CREATE TABLE "acfs_subscriptionmaster" (
> "id" serial NOT NULL PRIMARY KEY,
> "uid" text,
> "FK_SubsType_id" integer NOT NULL REFERENCES "acfs_subscriptiontype"
> ("id") DEFERRABLE INITIALLY DEFERRED,
> "FK_Product_id" integer NOT NULL REFERENCES "acfs_productmaster"
> ("id") DEFERRABLE INITIALLY DEFERRED,
> *"FK_Formats_id" integer NOT NULL REFERENCES "acfs_formats" ("id")
> DEFERRABLE INITIALLY DEFERRED, <--This field has got created
> here *
> "ccs_minimum_price" text,
> "ccs_maximum_price" text,
> "ccs_Increment_type" text,
> "ccs_minimum_increment" text,
> "ccs_maximum_increment" text,
> "ccs_default_offer" text,
> );
>
> Also its howing indexes like this :
>
> CREATE INDEX "acfs_subscriptionformats_FK_Format_id" ON
> "acfs_subscriptionformats" ("FK_Format_id");
> CREATE INDEX "acfs_subscriptionmaster_FK_SubsType_id" ON
> "acfs_subscriptionmaster" ("FK_SubsType_id");
> CREATE INDEX "acfs_subscriptionmaster_FK_Product_id" ON
> "acfs_subscriptionmaster" ("FK_Product_id");
> CREATE INDEX "acfs_subscriptionmaster_FK_Formats_id" ON
> "acfs_subscriptionmaster" ("FK_Formats_id");
>
> Looks like error is field has not got created in actual database :
> *python manage.py dbshell*
> *acfsdb1=# SELECT * FROM acfs_subscriptionmaster;*
>  id | uid | FK_SubsType_id | FK_Product_id | ccs_minimum_price |
> ccs_maximum_price | ccs_Increment_type | ccs_minimum_increment |
> ccs_maximum_increment | ccs_default_of
> fer | fix_startdatetime | fix_expiydatetime | fix_price | dur_period |
> wd_field_01 | wd_field_02 | wd_field_03 | wd_field_04 | wd_field_05 |
> flag_field_01 | created_dat
> e_time | modified_date_time
>
> +-++---+---+---++---+---+---
>
> +---+---+---++-+-+-+-+-+---+
> ---+
> (0 rows)
>
> This is my DJANGO - Python versions
>
> Django Version: 1.2.7  Exception Type: DatabaseError  Exception Value:
>
> column acfs_subscriptionmaster.FK_Format_id does not exist
> LINE 1: ...ccountmaster"."id") INNER JOIN "acfs_formats" ON ("acfs_subs...
>  ^
>
>  Exception Location: 
> /usr/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py
> in execute, line 44  Python Executable: /usr/bin/python  Python Version:
> 2.6.6*postgres 9.1*
>
>
> Traceback Variables (see at the bottom for the error)
> ▼ Local vars 
>   args
> ()
>  e
> ProgrammingError('column acfs_subscriptionmaster.FK_Format_id does not
> exist\nLINE 1: ...ccountmaster"."id") INNER JOIN "acfs_formats" ON
> ("acfs_subs...\n ^\n',)
>  query
> 'SELECT "acfs_subscriptionmaster"."id", "acfs_subscriptionmaster"."uid",
> "acfs_subscriptionmaster"."FK_SubsType_id",
> "acfs_subscriptionmaster"."FK_Product_id",
> "acfs_subscriptionmaster"."FK_Format_id",
> "acfs_subscriptionmaster"."ccs_minimum_price",
> "acfs_subscriptionmaster"."ccs_maximum_price",
> "acfs_subscriptionmaster"."ccs_Increment_type",
> "acfs_subscriptionmaster"."ccs_minimum_increment",
> 

Select Multiple in List_filter

2013-02-24 Thread Jesús Lucas Flores
Hi I am trying to do a select multiple list filter for django admin but I 
can't .

anybody knows how to make it or have a snippet ? 

Thank you!

-- 
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: m2m relation just working in one direction

2013-02-24 Thread Roberto López López

Mike,

Cool, you are right! Changing the related_name to something different
than groups seems to solve the problem. Thank you very much :-)

Roberto



On 02/24/2013 11:30 PM, Mike Dewhirst wrote:
> Roberto
>
> I'm not entirely sure but it is possible that your group is getting
> mixed up with the contrib.auth group. I would try changing the name of
> my group temporarily to something else just to eliminate that.
>
> Mike
>
> On 25/02/2013 8:58am, Roberto López López wrote:
>> Hi,
>>
>> I have a problem involving a relation between two entities, Person and
>> Group.
>>
>>  from django.contrib.auth.models import User
>>  from django.db import models
>>
>>  class Group(models.Model):
>>  employees = models.ManyToManyField('staff.Person',
>> related_name='groups')
>>  leader = models.OneToOneField('staff.Person',
>> related_name='led_group')
>>
>>  class Person(User):
>>  pass
>>
>>
>> $ python manage.py shell
>>
>>  In [1]: from group.models import Group
>>
>>  In [2]: from staff.models import Person
>>
>>  In [3]: p = Person.objects.create(username='person1',
>> first_name='person 1')
>>
>>  In [5]: g = Group.objects.create(group_name='group 1', leader=p)
>>
>>  In [9]: g.employees.all()
>>  Out[9]: []
>>
>>  In [10]: g.employees.add(p)
>>
>>  In [11]: g.employees.all()
>>  Out[11]: []
>>
>>  In [16]: p.groups.all()
>>  Out[16]: []
>>
>>
>> As you can see, when I add a person through the group, it's not added to
>> group.employees but to person.groups. Can you see any mistake in my
>> code? Thanks in advance for your suggestions :-)
>>
>

-- 
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: m2m relation just working in one direction

2013-02-24 Thread Mike Dewhirst

Roberto

I'm not entirely sure but it is possible that your group is getting 
mixed up with the contrib.auth group. I would try changing the name of 
my group temporarily to something else just to eliminate that.


Mike

On 25/02/2013 8:58am, Roberto López López wrote:

Hi,

I have a problem involving a relation between two entities, Person and
Group.

 from django.contrib.auth.models import User
 from django.db import models

 class Group(models.Model):
 employees = models.ManyToManyField('staff.Person',
related_name='groups')
 leader = models.OneToOneField('staff.Person',
related_name='led_group')

 class Person(User):
 pass


$ python manage.py shell

 In [1]: from group.models import Group

 In [2]: from staff.models import Person

 In [3]: p = Person.objects.create(username='person1',
first_name='person 1')

 In [5]: g = Group.objects.create(group_name='group 1', leader=p)

 In [9]: g.employees.all()
 Out[9]: []

 In [10]: g.employees.add(p)

 In [11]: g.employees.all()
 Out[11]: []

 In [16]: p.groups.all()
 Out[16]: []


As you can see, when I add a person through the group, it's not added to
group.employees but to person.groups. Can you see any mistake in my
code? Thanks in advance for your suggestions :-)



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




m2m relation just working in one direction

2013-02-24 Thread Roberto López López
Hi,

I have a problem involving a relation between two entities, Person and
Group.

from django.contrib.auth.models import User
from django.db import models

class Group(models.Model):
employees = models.ManyToManyField('staff.Person',
related_name='groups')
leader = models.OneToOneField('staff.Person',
related_name='led_group')

class Person(User):
pass


$ python manage.py shell

In [1]: from group.models import Group

In [2]: from staff.models import Person

In [3]: p = Person.objects.create(username='person1',
first_name='person 1')

In [5]: g = Group.objects.create(group_name='group 1', leader=p)

In [9]: g.employees.all()
Out[9]: []

In [10]: g.employees.add(p)

In [11]: g.employees.all()
Out[11]: []

In [16]: p.groups.all()
Out[16]: []


As you can see, when I add a person through the group, it's not added to
group.employees but to person.groups. Can you see any mistake in my
code? Thanks in advance for your suggestions :-)

-- 
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 Nick Apostolakis

On Mon, Feb 25, 2013 at 12:18 AM, Mark Furbee  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.
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.

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.




Re: Saving browser output as pdf

2013-02-24 Thread Satinderpal Singh
On Mon, Feb 25, 2013 at 12:18 AM, Mark Furbee  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
>  wrote:
>>
>> On Sun, Feb 24, 2013 at 8:00 PM, Nick Apostolakis 
>> 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 Mark Furbee
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,

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




Re: How do I join two existing tables?

2013-02-24 Thread frocco
>> managed=False <<

Thanks for pointing that out.

On Sunday, February 24, 2013 11:10:07 AM UTC-5, Johan wrote:
>
> You're welcome.
>
> You probably also want to make sure that in the class Meta options, you've 
> set managed=False
> Otherwise you could accidentally change the database definitions.
>
> All the information is here:
> https://docs.djangoproject.com/en/dev/howto/legacy-databases/
>
> On Feb 24, 2013, at 5:05 PM, frocco  
> wrote:
>
> Thank you
>
> On Sunday, February 24, 2013 10:00:58 AM UTC-5, frocco wrote:
>>
>> Hi,
>>
>> I have to interface with an existing php app and the key field is 
>> character.
>>
>> paginator = 
>> Paginator(Shopinventory.objects.exclude(list_price=0).filter(sizenum__contains=search),
>>  
>> 20)
>> I want to add to the above and pull the related category.
>>
>> Shopcategories has a character prime key called category_id
>> Shopinventory has a character field called category_id
>> It is a one to one relation, but inspected did not create any foreign 
>> keys.
>>
>> Thanks
>> 
>>
>
> -- 
> 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...@googlegroups.com .
> To post to this group, send email to django...@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.




Re: how to use static in development with PyCharm?

2013-02-24 Thread frocco
My current settings are:
STATIC_ROOT = '/Applications/djangostack-1.4.4-0/apache2/htdocs/static/'
STATIC_URL = 'http://localhost:8080/static/'

I am developing now in /Applications/djangostack-1.4.4-0/apps

originally I was developing in the PyCharm Projects Directory
I guess I wanted to know what is a good setup for PyCharm when static and 
media files are not in the same directory as the project is.
Eventually I will be deploying to webfaction

It seems to be working now.

On Sunday, February 24, 2013 10:43:24 AM UTC-5, Nicholas Duffy wrote:
>
> You mean that in PyCharm, you get the "Unresolved static reference" 
> warning?
>
> Do you have the static files in the static subdirectories of your 
> installed apps or in STATICFILES_DIRS in settings? STATIC_ROOT is meant to 
> be the directory that is used when you run collectstatic in production. 
> With that said, PyCharm seems to find static files there as well on my 
> installation.
>
> On Friday, February 22, 2013 9:53:05 AM UTC-7, frocco wrote:
>>
>> Hello,
>>
>> I have my static data mapped to:
>> STATIC_ROOT = '/wamp/www/static/'
>>
>> If I hit the app at localhost/app
>> Everything is ok.
>>
>> However when I debug in PyCharm, the static data does not map.
>>
>> My templates use {{ STATIC_URL }}img/
>>
>> Thank you
>>
>>

-- 
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: How do I join two existing tables?

2013-02-24 Thread Johan ter Beest
You're welcome.

You probably also want to make sure that in the class Meta options, you've set 
managed=False
Otherwise you could accidentally change the database definitions.

All the information is here:
https://docs.djangoproject.com/en/dev/howto/legacy-databases/

On Feb 24, 2013, at 5:05 PM, frocco  wrote:

> Thank you
> 
> On Sunday, February 24, 2013 10:00:58 AM UTC-5, frocco wrote:
> Hi,
> 
> I have to interface with an existing php app and the key field is character.
> 
> paginator = 
> Paginator(Shopinventory.objects.exclude(list_price=0).filter(sizenum__contains=search),
>  20)
> I want to add to the above and pull the related category.
> 
> Shopcategories has a character prime key called category_id
> Shopinventory has a character field called category_id
> It is a one to one relation, but inspected did not create any foreign keys.
> 
> Thanks
> 
> 
> -- 
> 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.




Re: Saving browser output as pdf

2013-02-24 Thread Satinderpal Singh
On Sun, Feb 24, 2013 at 8:00 PM, Nick Apostolakis  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: How do I join two existing tables?

2013-02-24 Thread frocco
Thank you

On Sunday, February 24, 2013 10:00:58 AM UTC-5, frocco wrote:
>
> Hi,
>
> I have to interface with an existing php app and the key field is 
> character.
>
> paginator = 
> Paginator(Shopinventory.objects.exclude(list_price=0).filter(sizenum__contains=search),
>  
> 20)
> I want to add to the above and pull the related category.
>
> Shopcategories has a character prime key called category_id
> Shopinventory has a character field called category_id
> It is a one to one relation, but inspected did not create any foreign keys.
>
> Thanks
> 
>

-- 
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 Mark Furbee
Mike DeWitt's answer is most appropriate. In you view define an argument
'pdf=False' and when returning the response from uou view, if pdf is False,
return regular HttpResponse. If pdf is True, follw @Mike's reply to set
response Content type to PDF. It is really easy to return what would be an
html response as a pdf download. You could even show report as html, with
link to download as PDF. The PDF link would go to the same view method with
'pdf=True'.
On Feb 24, 2013 6:30 AM, "Nick Apostolakis"  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.
>
> 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+unsubscribe@**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.




Re: how to use static in development with PyCharm?

2013-02-24 Thread Nicholas Duffy
You mean that in PyCharm, you get the "Unresolved static reference" warning?

Do you have the static files in the static subdirectories of your installed 
apps or in STATICFILES_DIRS in settings? STATIC_ROOT is meant to be the 
directory that is used when you run collectstatic in production. With that 
said, PyCharm seems to find static files there as well on my installation.

On Friday, February 22, 2013 9:53:05 AM UTC-7, frocco wrote:
>
> Hello,
>
> I have my static data mapped to:
> STATIC_ROOT = '/wamp/www/static/'
>
> If I hit the app at localhost/app
> Everything is ok.
>
> However when I debug in PyCharm, the static data does not map.
>
> My templates use {{ STATIC_URL }}img/
>
> Thank you
>
>

-- 
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: How do I join two existing tables?

2013-02-24 Thread Johan ter Beest

On Feb 24, 2013, at 4:00 PM, frocco  wrote:

> Hi,
> 
> I have to interface with an existing php app and the key field is character.
> 
> paginator = 
> Paginator(Shopinventory.objects.exclude(list_price=0).filter(sizenum__contains=search),
>  20)
> I want to add to the above and pull the related category.
> 
> Shopcategories has a character prime key called category_id
> Shopinventory has a character field called category_id
> It is a one to one relation, but inspected did not create any foreign keys.

Are you sure it's a One to One relation? Sounds more like a ForeignKey to me.

Anyway, you need to change the CharField into a ForeignKey (or a OneToOneField) 
and tell it the column, something like this:

In ShopInventory:
category_id  = models.ForeignKey(Shopcategories, db_column='category_id')

Hope it helps,
Johan

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




How do I join two existing tables?

2013-02-24 Thread frocco
Hi,

I have to interface with an existing php app and the key field is character.

paginator = 
Paginator(Shopinventory.objects.exclude(list_price=0).filter(sizenum__contains=search),
 
20)
I want to add to the above and pull the related category.

Shopcategories has a character prime key called category_id
Shopinventory has a character field called category_id
It is a one to one relation, but inspected did not create any foreign keys.

Thanks


-- 
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 Nick Apostolakis

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.

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.




Re: Saving browser output as pdf

2013-02-24 Thread Russell Keith-Magee
On Sun, Feb 24, 2013 at 11:12 AM, Evan Brumley wrote:

> Have a look at wkhtmltopdf for easy server side generation of PDFs. It's
> not perfect, but it seems to be the best option out there at the moment.
> I'm also hearing good things about PhantomJS, though I haven't tried it out
> myself. Both options are essentially headless versions of Webkit - they
> produce results that look more or less exactly the same as a web browser,
> though it usually requires a fair bit of tweaking to get the proportions
> and pagebreaks right. Support for javascript and SVG is very good, though
> support for Flash isn't really there. They're not integrated into Django in
> any way - you need to generate local html files in a temporary location and
> run them using popen or similar.
>
> wkhtmltopdf: http://code.google.com/p/wkhtmltopdf/
> PhantomJS: http://phantomjs.org/
>

Two other options that are worth looking into:

 * Weasyprint - An ACID2 compliant engine for converting HTML + CSS to a
PDF. It's got a painful dependency chain to install, and it's got some bugs
(e.g., table layouts can be a bit unpredictable), but for certain cases, it
works well.

 * PrinceXML. Very expensive, commercially supported option.


> Probably best to ignore the Django docs on this subject, incidentally.
> Reportlab is great but massively time consuming, and the other options
> listed in there are either dead projects or don't really do a good enough
> job.


I don't know if that's entirely fair. Native ReportLab (especially when
using the Platypus API) can be very useful for programatically generating
PDFs.

Activity on xhtmltopdf has certainly slowed, but I don't know if I'd reject
it outright. It only supports a limited number of CSS directives (e.g.,
there's on support for `float` box layouts), but inside the scope of what
it supports, it works quite well.

Yours,
Russ Magee %-)

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