RE: Can I only have one "get_queryset" per Viewpage?

2013-07-22 Thread Babatunde Akinyanmi
Override your get method but it's easier to override the get_context_data method like # From my head def get_context_data(**kwargs): context = super(IndexView, self).get_context_data(**kwargs) #filter1 is already present as latest_poll_list in the context filter2 = Word.blah() filte

Foreign Key problems with legacy database

2013-07-22 Thread Brian Millham
I have the following models: class Requestlist(models.Model): >id = models.IntegerField(primary_key=True) >songid = models.Integerfield() >song = ForeignKey('Song', db_column='songid') > class Song(models.Model): > id = models.IntegerField(primary_key=True) > title = models.CharFie

Foreign key problems with legacy database

2013-07-22 Thread Brian Millham
I have these 2 models: class Requestlist(model.Model): -- 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

python manage.py runserver error

2013-07-22 Thread Jay Lozier
I get the following error when run python manage.py runserver: OS openSUSE 12.3 django 1.7 boopers@linux-nss6:~/myfirstsite> python manage.py runserver Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/home/boopers/django-trunk/django/co

Re:

2013-07-22 Thread Harjot Mann
On Tue, Jul 23, 2013 at 3:55 AM, Nikolas Stevenson-Molnar wrote: > Ok. So if I understand correctly, your request should be to /myview/ not to > /report/myview/ No, the problem was not with urls. It was having a link with the css file, which does not exist. Now it is resolved. THanks everyone fo

Re: python manage.py runserver error

2013-07-22 Thread Christian Erhardt
I think you're missing some prerequisites (TypeError: ('Not a package:', 'cgi')) I never use the libraries installed on the system, i always work with virtualenvs. A very good kickstart is written down here: http://www.jeffknupp.com/blog/2012/02/09/starting-a-django-project-the-right-way/ Usu

Saving data from a form.

2013-07-22 Thread Nigel Legg
models.py: class DataTable(models.Model): datFile = models.CharField(max_length = 200) structFile = models.CharField(max_length = 200) bannerVar = models.CharField(max_length = 50) stubVar = models.CharField(max_length = 50) stubNets = models.BooleanField() def __unicode__(

Re:

2013-07-22 Thread Nikolas Stevenson-Molnar
Ok. So if I understand correctly, your request should be to /myview/ /not /to /report/myview/ _Nik On 7/22/2013 12:32 PM, Harjot Mann wrote: > On Mon, Jul 22, 2013 at 10:22 PM, Nikolas Stevenson-Molnar > wrote: >> Is that your only URLs file, or is there another one which includes that >> one? >

URL code not getting resolved in Part 4 of Tutorial

2013-07-22 Thread David Jenkins
After switching to "generic views", the link on my "polls" index page looks like this: What's up? Before I switched to the generic views code, all was working fine. To do the swithc, I simply cut and pasted the code from the Part 4 page to my pages (polls/urls.py and polls/views.py,according

How to set the email to lowercase on User Creation?

2013-07-22 Thread Cody Scott
I have a custom auth app. I am trying to only allow emails to be lower case in the database. I can create a user in the admin with Capitalized letters, even with email.lower() in the create_user method. Another solution would be to specify to the authenticate that the email can be any case. us

Re: Can I only have one "get_queryset" per Viewpage?

2013-07-22 Thread Pepsodent Cola
I'm having difficulty understanding the abstract explanations in that documentation. Could you or somebody else explain this, by showing by example using my code examples? *views.py* class IndexView(generic.ListView): template_name = 'polls/index.html' context_object_name = *'latest_pol

Re: How to Create an Auto Incrementing Integer Field

2013-07-22 Thread Cody Scott
Thank you very much, that was exactly what I was looking for. On Monday, 22 July 2013 09:48:51 UTC-4, Christian Erhardt wrote: > > Have a look at this post: > http://stackoverflow.com/questions/3123796/how-to-make-an-auto-filled-and-auto-incrementing-field-in-django-admin > > They determine the

Re: (Noob) - filtering spanning relationship not working

2013-07-22 Thread Christian Erhardt
Calling count() on a queryset will always aggregate the count of all rows. Please have a look at the annotate function in the documentation https://docs.djangoproject.com/en/dev/topics/db/aggregation/ Annotate will group your results and sum up the results. I think what you'll have to do is:

Re:

2013-07-22 Thread Harjot Mann
On Mon, Jul 22, 2013 at 10:22 PM, Nikolas Stevenson-Molnar wrote: > Is that your only URLs file, or is there another one which includes that > one? Its the url's file which contains the urls of pdf.py file. -- Harjot Kaur Mann Blog: http://harjotmann.wordpress.com/ -- You received this messag

Re: Saving data from a form.

2013-07-22 Thread Nigel Legg
Thanks Christian. I'll get my head around this soon, I hope. Regards, Nigel Legg 07914 740972 http://www.trevanianlegg.co.uk http://twitter.com/nigellegg http://uk.linkedin.com/in/nigellegg On 22 July 2013 14:53, Christian Erhardt wrote: > The error lies in this two rows: > > form.save() > Dat

Re: dear someone,

2013-07-22 Thread Brian Schott
NAME (path to a database file) should include the filename, not just a directory. Try './mysite/mysite.db' for NAME. Brian On Jul 22, 2013, at 1:44 PM, Stian Sjøli wrote: > I am trying to start up with django using the tutorial on the website. I get > the following error "OperationalError: u

OperationalError: unable to open database file

2013-07-22 Thread Stian Sjøli
i get this error while going throught the tutorial from the django website. I am a mac user, and have modified my settings-file to use sqlite3 and the name variable to say "./mysite". Any suggestions why I get this error? -- You received this message because you are subscribed to the Google Gro

dear someone,

2013-07-22 Thread Stian Sjøli
I am trying to start up with django using the tutorial on the website. I get the following error "OperationalError: unable to open database file. I have change the mood for all my files so that everybody (user, group and others have all right to all the files in the folder). My settings.py file

Re: new field in models

2013-07-22 Thread Harjot Mann
On Mon, Jul 22, 2013 at 2:33 PM, Satinderpal Singh wrote: > South is an alternative, it creates table fields without syncdb. Ok, you didn't tell me before. -- Harjot Kaur Mann Blog: http://harjotmann.wordpress.com/ -- You received this message because you are subscribed to the Google Groups

Re: new field in models

2013-07-22 Thread Larry Martell
On Mon, Jul 22, 2013 at 1:53 AM, Harjot Mann 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?? Use alter table: http://dev.mysql.com/

Re:

2013-07-22 Thread Nikolas Stevenson-Molnar
Is that your only URLs file, or is there another one which includes that one? _Nik On 7/22/2013 12:43 AM, Harjot Mann wrote: > On Mon, Jul 22, 2013 at 3:16 AM, Nikolas Stevenson-Molnar > wrote: >> Please also provide your urls.py file(s). That's frequently the culprit >> for 404 errors. > > http

Re: How to Create an Auto Incrementing Integer Field

2013-07-22 Thread Christian Erhardt
Have a look at this post: http://stackoverflow.com/questions/3123796/how-to-make-an-auto-filled-and-auto-incrementing-field-in-django-admin They determine the next value by calling a function called number(). In your case it would look something like this: class Cliente(models.Model): > ""

Re: bug in multi-level multi-table inheritance?

2013-07-22 Thread Dow Street
All, I've added a ticket for this issue: https://code.djangoproject.com/ticket/20776 If anyone has a chance to verify that this is a bug (rather than a programming error on my part) I would greatly appreciate it. Thanks! Dow On Jul 18, 2013, at 11:08 PM, Dow Street wrote: > All, > > I'm s

Re: django-admin.py startproject mysite error

2013-07-22 Thread gilberto dos santos alves
beside gods of olympo say that env var PYTHONPATH handle this, please verify what your PATH and PYTHONPATH (command echo $PATH; echo $PYTHONPATH) (where this is setting depends of what shell (sh, bash, etc) set and use export; when i use a shared host i have this same problems. i solve this exp

Re: Saving data from a form.

2013-07-22 Thread Christian Erhardt
The error lies in this two rows: form.save() DataTable_id = DataTable.id DataTable is the class, not the instance of the saved object! form.save() returns an instance of what has been saved. So your code should look like this: my_new_datatable_instance = form.save() DataTable_id = my_new_datat

Re: How to Create an Auto Incrementing Integer Field

2013-07-22 Thread Rafael E. Ferrero
Maybe extending save() method ? Somethin like... class your_model(models.Model): order = models.IntegerField(default=1) def save(self, *args, **kwargs): if not self.id: #here must to find the last order then sum one and save the result self.order=result

Re: Problem with chaining filters

2013-07-22 Thread Andrew Simpson
Perhaps something like this would give you what you need: Pronunciation.objects.filter(word__translation='') -- 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 djan

Re: How to merge two lists into one form?

2013-07-22 Thread Tymoteusz Jankowski
Ok, I've found sort of solution, relatively quick so, I'm happy CODE: FRUITS = [ 'apples', 'lemons', 'strawberries', ] # hardcoded like here or from db ANSWERS = [ (0, u''), (1, u'selling'), (2, u'making'), (3, u'both'), ] # hardcoded like here or from db class ProblematicForm(forms.Form):

Re: Can I only have one "get_queryset" per Viewpage?

2013-07-22 Thread Mário Neto
Hi, you can separate your querysets in get_context_data method. See: https://docs.djangoproject.com/en/dev/ref/class-based-views/mixins-simple/#django.views.generic.base.ContextMixin.get_context_data 2013/7/22 Pepsodent Cola > Hi, > > Can I only have one "get_queryset" for each Viewpage? > If I

Re: request.user returning AnonymousUser

2013-07-22 Thread l33t
Hello, The problem is fixed. I was not using the get_user method in the custom authentication backend properly. Best Regards, Goose. On Friday, July 19, 2013 1:04:22 PM UTC+2, l33t wrote: > > > Hello, > > I have a custom authentication backend and a custom user model. The > authentication()

(Noob) - filtering spanning relationship not working

2013-07-22 Thread Lukas Kawerau
I want to find the number of articles for which a specific user has created articlehistoryrecords. The models for that look like this: class Article(models.Model): """The basic entity of this app.)""" documentID = models.CharField(blank=True, max_length=1000) cowcode = models.Intege

Re: new field in models

2013-07-22 Thread Harjot Mann
On Mon, Jul 22, 2013 at 2:11 PM, Floor Tile wrote: > Hello Harjot > > I think you should look at South: south.aeracode.org/ > > For the docs you can go to: south.readthedocs.org/ > > Hope it helps Hello Floor, thanks. -- Harjot Kaur Mann Blog: http://harjotmann.wordpress.com/ -- You received

Can I only have one "get_queryset" per Viewpage?

2013-07-22 Thread Pepsodent Cola
Hi, Can I only have one "get_queryset" for each Viewpage? If I wanted to add another database list on the same Viewpage how would that code look like for my Django *views.py* file? Example: https://docs.djangoproject.com/en/1.5/intro/tutorial04/#amend-views from polls.models import Choice, Poll

Re: new field in models

2013-07-22 Thread Floor Tile
Hello Harjot I think you should look at South: south.aeracode.org/ For the docs you can go to: south.readthedocs.org/ Hope it helps On Mon, Jul 22, 2013 at 9:53 AM, Harjot Mann wrote: > In django when we add a new field in existing class, we need to drop > the table and then run the syncdb ag

Re: new field in models

2013-07-22 Thread Satinderpal Singh
On Jul 22, 2013 1:23 PM, "Harjot Mann" 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 fiel

new field in models

2013-07-22 Thread Harjot Mann
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?? -- Harjot Kaur Mann Blog: http://harjotmann.wordpress.com/ -- You received this message because

Re:

2013-07-22 Thread Harjot Mann
On Mon, Jul 22, 2013 at 3:16 AM, Nikolas Stevenson-Molnar wrote: > Please also provide your urls.py file(s). That's frequently the culprit > for 404 errors. http://tny.cz/5e411aa0 -- Harjot Kaur Mann Blog: http://harjotmann.wordpress.com/ -- You received this message because you are subscribe

Re: create random string for username

2013-07-22 Thread Derek
Re URLs Have look at http://itekblog.com/django-url-dispatcher-routing-beginners-tutorial/ ... and bear in mind that the 'r' and the '^' are not directly related and serve two purposes. The very basic "overview" of Django is that urls point to views; views typically make use of models (an