Re: How to check if user is already in user database?

2015-01-16 Thread Mark Furbee
Also, you can do a try/catch, but I don't really like this method, personally: try: User.objects.get(username=username) except User.DoesNotExist: # user didn't exist in database. On Fri, Jan 16, 2015 at 9:16 AM, Mark Furbee <markfur...@gmail.com> wrote: > Yes,

Re: How to check if user is already in user database?

2015-01-16 Thread Mark Furbee
Yes, that link will cover the basics... Here's a couple ways to find out if a query returns any records: User.objects.filter(username=username).exists() # .exists() returns boolean if records are found. User.objects.filter(username=username).count() != 0 # .count() returns number of

Re: ANN: Django website redesign launched

2014-12-16 Thread Mark Furbee
Looks slick to me! Clearly with mobile and responsive design in mind, but that's what we have to keep in mind these days. Great job to all contributors involved in this redesign! On Tue, Dec 16, 2014 at 4:01 PM, Cal Leeming wrote: > > Personally I really like it. > > The footer

Re: (1364, "Field 'id' doesn't have a default value") - mysql issue?

2014-04-09 Thread Mark Furbee
You say you imported the database. Did you use syncdb to set up the tables? It sounds like your comment_id field in MySQL is not set as an auto-incrementing primary key field. Do you have access to that MySQL database to check, and or update that field definition? On Wed, Apr 9, 2014 at 2:42 PM,

Re: I really about to give up Django

2013-08-23 Thread Mark Furbee
I see. I don't understand how this works: {{ itens.instance.idproduto.codigobarra }} when this doesn't: {{ itens.instance.idproduto.idmercadoria.referencia }} Can you post your template code? On Fri, Aug 23, 2013 at 10:13 AM, Fellipe Henrique wrote: > form.instance is

Re: I really about to give up Django

2013-08-23 Thread Mark Furbee
Are you sure the idmercadoria is not None on that idproduto record? {{ form.instance.idproduto.**idmercadoria }} Does this display anything? How about {{ form.instance.idproduto }}? If these don't display, verify the records in your database. In Django templates, if something is None or does not

Re: I really about to give up Django

2013-08-22 Thread Mark Furbee
Are your "nome" and "idade" fields displaying? If so, {{ form.instance.brinq.descricao }} should display the descricao field of the brinq object associated with that Filhos instance bound to the form in the formset. On Thu, Aug 22, 2013 at 9:24 AM, Fellipe Henrique wrote: >

Re: I really about to give up Django

2013-08-22 Thread Mark Furbee
Try dropping the .value from referencia. Like {{ form.instance.idproduto.idmercadoria.referencia }}. Does this work? On Thu, Aug 22, 2013 at 9:35 AM, Fellipe Henrique wrote: > I tried again.. and work if I have just 1 FK, if I have more then one, > doesn't work, like this: >

Re: 'url' template tag throws and error after upgrading to 1.4

2013-04-04 Thread Mark Furbee
Can you run manage.py shell and connect to 'views?' On Thu, Apr 4, 2013 at 4:13 PM, Mark Furbee <markfur...@gmail.com> wrote: > It would appear to me that your missing the path to django in your > environment. When you upgraded did you also upgrade to another version of >

Re: 'url' template tag throws and error after upgrading to 1.4

2013-04-04 Thread Mark Furbee
It would appear to me that your missing the path to django in your environment. When you upgraded did you also upgrade to another version of Python, perhaps? Is the dist-packages/site-packages django folder in the same place it was? On Thu, Apr 4, 2013 at 3:58 PM, Bastian

Re: ANNOUNCE: Django 1.5 released

2013-02-26 Thread Mark Furbee
Woo-hoo! Awesome news. We really appreciate all the hard work you guys have been doing getting this version out. Thanks a million! Mark On Tue, Feb 26, 2013 at 11:44 AM, James Bennett wrote: > Yup, it's finally here! > > * Announcement blog post here: >

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

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

Re: can someone rewrite this line please

2013-02-21 Thread Mark Furbee
No worries, Mike. Any time! On Thu, Feb 21, 2013 at 3:17 AM, MikeKJ wrote: > Thank you Mark spot on! > > Really appreciate it > > > > > > On Wednesday, February 20, 2013 3:58:28 PM UTC, Mark wrote: > >> Not sure if you need the json.large to be compiled or if that

Re: can someone rewrite this line please

2013-02-20 Thread Mark Furbee
Not sure if you need the json.large to be compiled or if that should be part of the string. The biggest issue was you had a single-quote before onmouseover. After that, you have to escape the single-quote before \',LEFT, true, OFFSETY, -250, OFFSETX, 0, WIDTH, 800)\" target=\"_blank\">'; FYI: if

Re: Speficy a Database for Testing

2012-02-08 Thread Mark Furbee
wrote: > Yes, but django makes a new testDatabase and that's my problem, I want > django to use a database I've previously done. > > > On 8 February 2012 16:34, Mark Furbee <markfur...@gmail.com> wrote: > >> Denis Darii already answered this on February 1st: >> >

Re: Speficy a Database for Testing

2012-02-08 Thread Mark Furbee
Denis Darii already answered this on February 1st: "You can redefine your database connection by adding somewhere at the end of your settings.py something like: import sys if 'test' in sys.argv: DATABASES = ... hope this helps." Did you try this? On Wed, Feb 8, 2012 at 7:19 AM, xina

Re: Having Headache With LoginForm

2012-01-19 Thread Mark Furbee
plate login.htm: > > > > . > > . > > . > > > method="post" name="login"> > > {% csrf_token %} > > > > > > Login > > > > > > > > {% if error %} > > > > > > {% FatalImage

Re: Having Headache With LoginForm

2012-01-18 Thread Mark Furbee
arning %} {% WarnImage %} {{ warning }} {% endif %} {% if notice %} {% NoticeImage %} {{ notice }} {% endif %} Email address: Password: On Wed, Jan 18, 2012 at 8:09 AM, Mark Furbee <markfur...@gmail.com> wrote: > Is that template mainpage.html? &g

Re: Having Headache With LoginForm

2012-01-18 Thread Mark Furbee
, but its not working! Any help? > > On Jan 17, 10:37 pm, Mark Furbee <markfur...@gmail.com> wrote: > > It means, don't use the "decorator" @login_required above your login > view. > > Your login view cannot require a login, because you'd never get to log > in.

Re: Having Headache With LoginForm

2012-01-17 Thread Mark Furbee
It means, don't use the "decorator" @login_required above your login view. Your login view cannot require a login, because you'd never get to log in. Chicken and egg. On Tue, Jan 17, 2012 at 2:34 PM, coded kid wrote: > > > Thorsten Sanders wrote: > > With using > > > >

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Mark Furbee
Good Morning Tabitha. Actually, do you have a model for StaffForm? That is the object being instantiated and then causing the error. If there is no nics group reference field in the StaffForm object, it may raise this error. Also, do you have this running in a view/template? Do you have a real

Re: Set of choices of which several can be chosen without using a ManyToManyField

2011-11-02 Thread Mark Furbee
As alluded to previously, the most "straightforward way to use a set of choices of which several can be chosen" IS to use a ManyToManyField. The syntax is slightly different, but ManyToManyFields are really easy to use with Django. Do not reinvent the wheel in this case. Thanks, M