Re: How can I auto-fill a field in the model without showing a form field to the user?

2017-07-26 Thread Alexander Joseph
Good to know. Thanks again! On Monday, July 24, 2017 at 10:23:44 PM UTC-6, Alexander Joseph wrote: > > I'm new to django, but coming from php I think its the greatest thing ever. > > I have a model for Invoices ... > > {{{ > from django.conf import settings > from django.db import models > from

Re: How can I auto-fill a field in the model without showing a form field to the user?

2017-07-26 Thread Mike Dewhirst
On 27/07/2017 9:18 AM, Alexander Joseph wrote: Thanks I'll pick up that book. Would another acceptable approach be to do this in the view by overriding the form_valid() method? Can you tell me if there is any benefit/disadvantage to doing it one way or another? Thanks again If you can do it

Re: TypeError: __init__() takes 2 positional arguments but 3 were given (django-material)

2017-07-26 Thread Elias Coutinho
Traceback (most recent call last): File "/home/eliaspai/danibraz/.danibraz/lib/python3.5/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(*args, **kwargs) File

Re: How can I auto-fill a field in the model without showing a form field to the user?

2017-07-26 Thread Alexander Joseph
Thanks I'll pick up that book. Would another acceptable approach be to do this in the view by overriding the form_valid() method? Can you tell me if there is any benefit/disadvantage to doing it one way or another? Thanks again On Tuesday, July 25, 2017 at 4:48:22 PM UTC-6, Mike Dewhirst

Re: ValueError: invalid literal for int() with base 10:

2017-07-26 Thread Alexander Joseph
The problem was I had records in the database from before I changed the 'their_company' field to a ForeignKey. Before it was a CharField so some of the records had actual company names in them. I deleted those records since there wasnt any real data in there anyways, just dummy data. Everything

Re: Is there a way to use input text placeholder when using {{ form.as_p }}

2017-07-26 Thread Alexander Joseph
Perfect, thanks! On Wednesday, July 26, 2017 at 2:41:52 PM UTC-6, Lee Hinde wrote: > > in the init method of your form do something like this: > > self.fields['verification_date'].widget.attrs["placeholder"] = 'date' > > > On Jul 26, 2017, at 1:31 PM, Alexander Joseph

Re: Is there a way to use input text placeholder when using {{ form.as_p }}

2017-07-26 Thread Lee Hinde
in the init method of your form do something like this: self.fields['verification_date'].widget.attrs["placeholder"] = 'date' > On Jul 26, 2017, at 1:31 PM, Alexander Joseph > wrote: > > I'm using {{ form.as_p }} in my template and would like to be able to use >

Is there a way to use input text placeholder when using {{ form.as_p }}

2017-07-26 Thread Alexander Joseph
I'm using {{ form.as_p }} in my template and would like to be able to use placeholders in the individual input fields. Is there a way to do this? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: ValueError: invalid literal for int() with base 10:

2017-07-26 Thread Alexander Joseph
Hi, thanks for the reply, however when I take out the 'their_company' field altogether everything works fine. Also in the error it references the their_company field. The entire error is *"invalid literal for int() with base 10: 'NewCor'"* NewCor is a company in the contacts table. Thanks

Re: ValueError: invalid literal for int() with base 10:

2017-07-26 Thread Tim Chase
On 2017-07-26 11:52, Alexander Joseph wrote: > "*ValueError: invalid literal for int() with base 10:*" after I > made a field in my models.py a ForeignKey. Below is my models.py The problem lies in this line: > new_invoice_num = int(last_invoice_num) + 1 For some reason

Re: Django Group Models

2017-07-26 Thread threesixright
Very roughly. Something along the lines of this I would create a Player (players) and a Match (matches) tables. The match table contains 4 keys (player1, player2, player3, player4) and some extra fields (created, status, etc.) For each player you store some type of a skill (number) and a status

ValueError: invalid literal for int() with base 10:

2017-07-26 Thread Alexander Joseph
Hello, I came across this error: "*ValueError: invalid literal for int() with base 10:*" after I made a field in my models.py a ForeignKey. Below is my models.py from django.conf import settings from django.db import models from django.core.urlresolvers import reverse from django.utils import

Django Group Models

2017-07-26 Thread yingi keme
What will be the best approach to designing a database schema that groups users in a collection of 4? How will you create a model for lets say in an online game setting such that you want only 4 players in a single group based on thesame criteria amongst players? Creating this model is

Crispy forms not showing bootstrap and save/submit button

2017-07-26 Thread Gabriel - Iulian Dumbrava
Maybe it's because you have instructed crispy to not generate the form tag and you have not added it yourself in the HTML code. -- 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,

Creating Forms from frontend like Google Survey Forms

2017-07-26 Thread Shazia Nusrat
Hi, I need to develop a view that can help end-users create forms from the frontend like SurveyMonkey or Google Survey Forms. Basically I need to get admin forms at frontend and let the user's create forms on given set of fields. Can anyone point me to right direction please? Thanks. Shazia --

Re: How to create reusable components in django

2017-07-26 Thread Derek
You can include a template snippet into the body of the main template that is rendering your current view. That snippet in turn can either be passed data (such as a user count) from the view that calls the main template - see

Re: Dynamic Model ID cannot be called

2017-07-26 Thread Shazia Nusrat
Thank you it worked. Much appreciated. Regards, Shazia On Wed, Jul 26, 2017 at 5:47 AM, M Hashmi wrote: > Nothing wrong with your function based view. Just try to fill data in DB > field. It will work. Because you don't have any record in DB. Try to use >

Re: Dynamic Model ID cannot be called

2017-07-26 Thread M Hashmi
Nothing wrong with your function based view. Just try to fill data in DB field. It will work. Because you don't have any record in DB. Try to use 'get_or_create' function. M On Wed, Jul 26, 2017 at 4:50 AM, Shazia Nusrat wrote: > Hi, > > I have a simple model like

forms.Form.to_div ? and how override forms.Boundfield.label_tag?

2017-07-26 Thread threesixright
Hi All, Just started a few weeks ago with (v1.11) *Django* (coming from Rails) and I *love* it! Kudos to all the dev's! I'm fiddling with creating forms. What would be the best approach to add a *to_div* method to the *forms.Form* class ? many frameworks (bootstrap, semantic-ui, etc.) are

How to create reusable components in django

2017-07-26 Thread Vivek
Hello Guys I am new to django. i am working on a web app and one of the requirements in the application is a dropdown list in the header that displays the number of users registered to a company that logins( The list is limited to just 10 users). so this list needs to be there for all the pages

Dynamic Model ID cannot be called

2017-07-26 Thread Shazia Nusrat
Hi, I have a simple model like below: class Artists(models.Model): name = models.CharField(max_length=200) description = models.TextField() def __unicode__(self): return self.name I am trying to call it in my view like below: def artistdetail(request, id):

Re: Django Forms HorizontalRadioSelect Renderer not working.

2017-07-26 Thread Shazia Nusrat
Thank you so much for help. Regards, Shazia On Tue, Jul 25, 2017 at 12:27 PM, Tim Graham wrote: > Replace renderer=HorizontalRadioRenderer with attrs={'class': 'inline'} > and then style radio elements using CSS. contrib.admin uses this > approach. Here's the CSS: > >

Django-cms KeyError at /en/cms_wizard/create/

2017-07-26 Thread IaMtheMcee
Hi, I'm getting this error when i try to create a new page. here's the traceback.. any ideas on how to fix this? Environment: Request Method: GET Request URL: http://127.0.0.1:8000/en/cms_wizard/create/?language=en Django Version: 1.11.3 Python Version: 3.6.0 Installed Applications: