Re: New to Django

2021-10-14 Thread Adrian Valenzuela
Nice! Thanks for this! I'm new too and this already looks like a great resource. On Sunday, October 3, 2021 at 5:01:41 AM UTC-7 bnmng wrote: > I think you'll get a few opinions on this. My opinion is no. I feel the > docs are very good but difficult to understand as a beginner. I like >

Re: reg: NoReverseMatch at "login"

2020-04-28 Thread 'Adrian Havenga-Bennett' via Django users
Hello Redirect should call the view rather than the html page. Whichever view is handling the rendering of the chittr.html page is what should be the argument for redirect. Sent from my iPhone > On 28 Apr 2020, at 16:28, 'Amitesh Sahay' via Django users > wrote: > >  > Hi, > > Its a

Change in pip install?

2019-02-21 Thread Adrian Klaver
Just upgraded from 1.11.18 --> 1.11.20 and package installed as: # Editable install with no version control (Django==1.11.20) -e /home/aklaver/py_virt/cc_dj111_py3/lib/python3.4/site-packages even though I did: pip install --upgrade Django==1.11.20 Uninstalling Django and doing: pip install

Re: New to Django: Please Help!! Django User Model not saving first_name, last_name and email - Authentication App

2018-10-30 Thread Adrian Chipukuma
I have sorted it out using a different approach 'AbstractUser'. Thanks On Tue, Oct 30, 2018, 12:19 PM Adrian Chipukuma wrote: > Thanks for the help. Though if I remove the declarations of the > first_name, last_name and email. Then I will not be able to see these in > the

Re: New to Django: Please Help!! Django User Model not saving first_name, last_name and email - Authentication App

2018-10-30 Thread Adrian Chipukuma
# Your next steps > > > I think you might need to declare password1 & password2 fields in your > Form. Do Check. > > > > On Monday, October 29, 2018 at 10:04:39 PM UTC+5:30, Adrian Chipukuma > wrote: >> >> Hello, >> >> I am new to Django a

New to Django: Please Help!! Django User Model not saving first_name, last_name and email - Authentication App

2018-10-29 Thread Adrian Chipukuma
register.html {% extends 'authenticate/base.html'%} {% block content%} This is the Registration Page {% csrf_token %} {% if form.errors %} Your form has errors {{ error }} {% endif %} {{ form.as_p }} {% endblock %} Chao! Adrian -- You received this message because you are subscribed to the G

Use of sphinx roles with django.contrib.admindocs

2016-06-07 Thread Adrian Lloyd Flanagan
First, apologies if this is documented elsewhere. I don't use Google Groups a lot, and I'm rather appalled at the search interface. At any rate, I've added "django.contrib.admindocs" to my INSTALLED_APPS and done all the other things to get /admin/docs to be automatically generated. Mostly,

Re: wsgi.py apache segmentation fault

2015-12-30 Thread Baris Adrian
hi Eugenio, Did you get a solution to this problem. If so what? because i am stuck and i could appreciate the help. Kindest REgards On Thursday, October 8, 2015 at 5:45:40 PM UTC+3, Eugenio Trumpy wrote: > > Hello everybody, > > I'm very not so expert on django, I'm at the first experience. >

Re: Admin options are just ignored

2014-08-10 Thread Adrian Marshall
Think I found the problem. You're not registering the new Admin model classes you have made. change: admin.site.register(Resguard) to this: admin.site.register(Resguard,ResguardAdmin) do the same with the rest of your admin.site.register() functions That should work! Hope that

Re: Django - Login from Android

2014-08-06 Thread Adrian Marshall
Russ, Thanks a lot! I agree. Think I'm going to setup the API side of things with TastyPie and use Android/Java Api's to interact with the HTTP request/responses. On Tuesday, August 5, 2014 8:59:38 PM UTC-4, Russell Keith-Magee wrote: > > Hi Adrian, > > Developing on a mobi

Re: deploying django

2014-08-04 Thread Adrian Marshall
I've went through a few different ways. If your set on using apache, Configure Apache with Mod-WSGI on a server. Here's a Good Tutorial: http://thecodeship.com/deployment/deploy-django-apache-virtualenv-and-mod_wsgi/ If you're having trouble with that and your app isn't too demanding you can

Django - Login from Android

2014-08-04 Thread Adrian Marshall
I have a Django app up and running and It's more mobile based than a web app. I'm new to development with both Django and Android. I've setup an API using Django-Tasty pie and I can get JSON data from my models,including the user model that comes with Django. I've implemented logging in

Re: How to install psycopg2 using Pip?

2014-06-03 Thread Adrian Miguel
Where can I find the setup.cfg file on a mac? On Monday, July 23, 2012 3:18:02 PM UTC-4, Mehrdad Majzoobi wrote: > > Ok, I realized what the issue was. In the setup.cfg file, the pg_config > path had to include the pg_config executable name as well: > > pg_config = /usr/pgsql-9.1/bin/pg_config >

Re: Traversing nested models is a mess. (or i don't get it right)

2014-05-22 Thread Adrian Scheffler
Okay, got it (at least i hope so :-) ): def article_child_gen(article): while True: try: article = Article.objects.get(parent_article=article) yield article except Article.DoesNotExist: return -- You received this message because you are

Traversing nested models is a mess. (or i don't get it right)

2014-05-22 Thread Adrian Scheffler
Hi there. supposed you've got a nested model like this: class Article(models.Model): parent_article = models.OneToOneField("self", blank=True, null=True, default=None, related_name="child_article") How would you traverse the related model chain ( aka linked list ) to one end? Maybe with a

Re: ImproperlyConfigured at /admin/polls/poll/add/ 'model' is a required attribute of 'PollAdmin.inlines[0]'.

2013-10-23 Thread Adrian Paul Ciobanita
Thx Magnum. That made the difference. On Wednesday, October 23, 2013 4:22:15 PM UTC+3, Lucas Magnum wrote: > > Rename the attribute "mode" to *model* in the ChoiceInline. > > []'s > > Lucas Magnum. > > > 2013/10/23 Adrian Paul Ciobanita <adrian.c...@g

ImproperlyConfigured at /admin/polls/poll/add/ 'model' is a required attribute of 'PollAdmin.inlines[0]'.

2013-10-23 Thread Adrian Paul Ciobanita
Hello, i've been playing with Django 1.5.4 for some TDD tutorials, examples, and tried to also do the tutorial : https://docs.djangoproject.com/en/1.4/intro/tutorial02/#adding-related-objects BUT i keep receiving this error, as suggested in the Subject: > ImproperlyConfigured at

Re: define form in yaml file

2013-01-25 Thread Adrian Andreias
> I'm new to Django and here. > > yaml file is commonly used in Rails framework. > Django uses simple python file (settings.py). > > What security risk? Have you got any example ? > > > 2013/1/24 Adrian Andreias <adi.an...@gmail.com > > >> Hello, >> >

Re: define form in yaml file

2013-01-25 Thread Adrian Andreias
it to something that jsonpickle can deliver into type(). > > Can talk more if this sounds at all interesting. > > Cheers > > Chris. > > On Thursday, January 24, 2013 8:02:53 PM UTC, Adrian Andreias wrote: >> >> Hello, >> >> I need a way to define a

Re: define form in yaml file

2013-01-25 Thread Adrian Andreias
this sounds at all interesting. > > Cheers > > Chris. > > On Thursday, January 24, 2013 8:02:53 PM UTC, Adrian Andreias wrote: >> >> Hello, >> >> I need a way to define a django form through a yaml file (or another text >> format). >> Is there some code

define form in yaml file

2013-01-24 Thread Adrian Andreias
Hello, I need a way to define a django form through a yaml file (or another text format). Is there some code that already does this? I'm trying to not reinvent the wheel. I can't use simple python classes, since this would user input and would be a security risk and I need a simpler and

Re: Generating random alphanumeric codes

2012-06-26 Thread Adrian Bool
On 26 Jun 2012, at 15:53, Sithembewena Lloyd Dube wrote: > Would anyone have tips on how to generate random 4-digit alphanumeric codes > in python? Also, how does one calculate the number of possible combinations? For upper case, lower case and digits we have, 26 + 26 + 10 = 62

Re: ForeignKey problem

2012-06-25 Thread Adrian Bool
On 25 Jun 2012, at 17:53, Soviet wrote: > Thank you kind sir for your fast response, that worked brilliantly. > Can I be cheeky and ask why does it work? :) Magic! ;-) Although seriously, Django obviously has some code in there to handle just the situation you have come across. Sorry, I

Re: ForeignKey problem

2012-06-25 Thread Adrian Bool
On 25 Jun 2012, at 17:41, Soviet wrote: > I'm new to this Django thing and I run into first problem :). > > Let's say I have two models and in each I have field with ForeignKey > relating to field in other model (hope it's clear). Now that I want to > run migrate with South, I'm getting

Re: Import error

2012-06-22 Thread Adrian Bool
Hi Emily, On 22 Jun 2012, at 15:46, Emily wrote: > This is the class I created... > > import string > import random > > class Helpers: > > def random_password(): Take random_password outside of the Helpers class and you should be OK. On the import statement you need to refer to a 'top

Re: Model overriding predefined model methods.

2011-10-08 Thread Adrian Merrall
r save method as defined in the URL above. HTH Adrian Auckland, NZ > -- > 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/-/XcPk-o

Postgres on OSX Lion

2011-09-26 Thread adrian
Postgres comes pre-installed in OSX Lion for the first time (and mysql is no longer present). Yeah! I installed psycopg2 using pip. Then I kept getting the error message: psycopg2.OperationalError: could not connect to server: Permission denied Is the server running locally and

Virtualenv and Django in Production

2011-09-20 Thread adrian s
space (I feel naive typing this out, so I must be wrong (: ) as is (isn't there more overhead with virtualenv anyhow?) I hope I made sense. If anyone has any relevant docs that clarify this (maybe my searches stink) I'd love to read over what there is so I may make an appropriate call. Adrian

Re: OperationalError: no connection to the server using Django and gunicorn

2011-07-08 Thread Adrian Ribao
it appears really randomly ;) > > On Jul 1, 10:16 am, Adrián Ribao Martínez <ari...@gmail.com> wrote: > > I think that the error comes only when starting the server. > > > > Reload the page about 10 times and check if you still get the error. > > > > Regards

Custom form on formset does not use Meta 'widgets', bug?

2011-06-23 Thread adrian
Django dev, Python 2.6.6 Just wondering if I should file a bug report or am I just doing something wrong. I have an inline: class ProductImageInline(admin.StackedInline): model = ProductImage formset = ProductImageFormset ...the form declaration and formset factory call: class

Number of Django powered sites?

2011-02-25 Thread Adrian Andreias
Hello, I'm looking for some global statistics like: - number of django powered web sites - number of python powered sites - web framework popularity index - number of django developers I know it's the most popular py web framework, I'm just looking for numbers, absolute or relative. I'm already

Re: DRY and static attribute for multiple classes.

2011-02-01 Thread Adrian Bool
On 1 Feb 2011, at 21:05, Marc Aymerich wrote: > Hi all, > I want to provide an encapsulated static attribute called _registry > for several classes. > > I try to use inheritance in order to make it DRY: all classes inherit > from a BaseClass that implements the _registry encapsulation. But with

Re: working django with existing database

2011-01-31 Thread Adrian Bool
-users?hl=en. > > > > -- > 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-use

Re: XML parsing

2011-01-31 Thread Adrian Bool
> "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-

Re: pyodbc: Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnectW)')

2011-01-30 Thread Adrian Bool
On 30 Jan 2011, at 09:31, Orgil wrote: > My code is below: > --- > import pyodbc > conn = pyodbc.connect('DRIVER={SQL Server};SERVER=testserver > \mssql2008;DATABASE=eoffice;UID=erp;PWD=123') > --- I'd try replacing 'testserver\mssql2008' with a domain

Re: Customising the Admin Save Models in DJango 1.1

2011-01-27 Thread Adrian Bool
On 27 Jan 2011, at 13:28, Matthew Macdonald-Wallace wrote: >def save(self,*args,**kwargs): >if not self.id: >self.created = datetime.date.today() >if self.Status.ClosesChangeRequest == True: >self.completed =

Re: problem with compressed egg in mysqldb module

2011-01-26 Thread Adrian Bool
On 26 Jan 2011, at 23:24, Cindy wrote: > > On Jan 26, 2:13 pm, Cindy wrote: >> Hi, all. I'm getting this error, when trying to export my django site >> to a new place: Do you mean to a new server? >> >> TemplateSyntaxError: Caught ImproperlyConfigured while rendering: >>

Re: Django: Object Oriented or Relational Database?

2011-01-26 Thread Adrian Bool
Hi Bruno, On 26 Jan 2011, at 12:55, bruno desthuilliers wrote: > Some will talk about "OO/relational impedance mismatch" (ok, I cheated > - Daniel just did;)), but I don't see it that way as far as I'm > concerned - I'm using a relational model wrapped into an OO > representation, and that's

Re: forbid clones

2011-01-26 Thread Adrian Bool
Please ignore this dumn-ass p On 26 Jan 2011, at 12:34, Adrian Bool wrote: > > On 26 Jan 2011, at 12:26, Jaroslav Dobrek wrote: > >>> >>> http://docs.djangoproject.com/en/1.2/ref/models/fields/#unique >> Example: >> >> This should be allowed: &

Re: forbid clones

2011-01-26 Thread Adrian Bool
On 26 Jan 2011, at 12:26, Jaroslav Dobrek wrote: >> >> http://docs.djangoproject.com/en/1.2/ref/models/fields/#unique > Example: > > This should be allowed: > > car1: manufacturer = "foo", name = "bar" > car2: manufacturer = "foo", name = "baz" > > This should not be allowed: > > car1:

Re: Customising the Admin Save Models in DJango 1.1

2011-01-26 Thread Adrian Bool
model = Charge extra = 0 Regards, aid Adrian Bool a...@logic.org.uk -- 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, se

Re: Django: Object Oriented or Relational Database?

2011-01-26 Thread Adrian Bool
On 26 Jan 2011, at 11:55, Daniel Roseman wrote: > > This is what's known as the object-relational impedance mismatch [1]. > Unfortunately, as you've noticed, OO concepts don't map completely cleanly > onto the relational model, and this is an issue with all systems that attempt > to do it.

Django: Object Oriented or Relational Database?

2011-01-26 Thread Adrian Bool
Hi, I'm creating a DB using Django for managing our companies data - customers, services, orders, billing etc. I'm using the Django admin interface to manage the data. I seem to be consistently at odds with myself and would be good to hear the community's point of view on this. I'm

encrypted model field

2010-09-23 Thread adrian
I want this field to be saved encrypted in the db, but appear unencrypted everywhere else.My question is which combination of field methods should I use? I have gotten parts of this working with various combinations of the methods below, but can't get it all to work. Using one method makes

encrypted model field

2010-09-23 Thread adrian
I want this field to be saved encrypted in the db, but appear unencrypted everywhere else: class EncryptedCharField(models.CharField): __metaclass__ = models.SubfieldBase def save_form_data(self, instance, data): setattr(instance, self.name, encrypt(data)) #def

dev server smtplib error

2010-06-10 Thread adrian
I have seen this error now on 3 projects and two OS (Mac & Linux), but only with the dev server. The view will begin the response and then hang for a long time (30+ seconds), then this error is generated and it continues normally. Usually it occurs on a page that either parses or uploads files.

Re: setting DEBUG=False disables flatpages

2010-06-08 Thread adrian
tracked the problem more down... the problem appeared when using own handler404/handler500 views and returning the invalid HttpResponse instead of HttpResponseNotFound/ HttpResponseServerError. This is not documented and needs doc improvement ... -- You received this message because you are

Re: Need subset on Admin interface

2010-06-08 Thread adrian
> I need when I create User or change User, and choose some Switch to > have Ports only related to that Switch in Option Box. does http://docs.djangoproject.com/en/1.2/ref/models/fields/#django.db.models.ForeignKey.limit_choices_to help? -- You received this message because you are subscribed

Re: User permission confusing

2010-06-08 Thread adrian
> BTW: There are many links in the administration page, that I do not > know where to map. Such as "View on website" (http://127.0.0.1:8000/ > admin/r/3/2/) in an user profile of course including: http://docs.djangoproject.com/en/1.2/ref/models/instances/#get-absolute-url and

Re: User permission confusing

2010-06-08 Thread adrian
> BTW: There are many links in the administration page, that I do not > know where to map. Such as "View on website" (http://127.0.0.1:8000/ > admin/r/3/2/) in an user profile please read: http://docs.djangoproject.com/en/1.2/ref/models/instances/#the-permalink-decorator -- You received this

setting DEBUG=False disables flatpages

2010-06-08 Thread adrian
or is also mentioned - but it is still unreviewed since more than a week. Best Regards, Adrian -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from thi

Re: include(admin.site.urls) mangles with the URL

2010-05-30 Thread adrian
this is what you had: (r'^admin/(.*)', admin.site.root), then you changed it to this (which is incorrect with the regex) (r'^admin/(.*)', include(admin.site.urls)), # WRONG this is correct: (r'^admin/', include(admin.site.urls)), -- You received this message because you are subscribed to the

HttpResponseRedirect waiting for something

2010-02-25 Thread adrian
I have a view that takes a form submission with a file, loads orders from the XML file by parsing it and saving records. After it is all done it redirects to another view, but the redirect hangs for about 30+ seconds then I get this message and it continues normally: Traceback (most recent call

Re: Looking for a wiki or cms created with django

2010-02-24 Thread Adrian Maier
Obviously I have already tried to search this on the internet, but the ' wiki ' keyword is a tricky one to search. Most projects have their own wiki , so the results for searches like 'django wiki' typically point me to "the wiki of the Django project". Cheers, Adrian M. On Tue

Looking for a wiki or cms created with django

2010-02-23 Thread Adrian Maier
users . Does anyone happen to know about a project similar to what i've described above ? Cheers, Adrian M. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubs

Looking for a Django/AJAX dev/contractor

2010-02-17 Thread Adrian Aoun
a very nice referral bonus if we hire someone you recommend! We're fine with remote working, though ideally the person could come to Seattle for a few weeks. Thanks adrian. -- You received this message because you are subscribed to the Google Groups "Django users" grou

Re: Using the form field values in templates

2010-01-29 Thread Adrian Maier
Shawn, Ondrey, Thanks for your answers. I ended up using to ModelForm and ModelFormSet. Cheers, Adrian On Tue, Jan 19, 2010 at 16:12, ondrey <ondrej.b...@gmail.com> wrote: > Hi, > > if the form is bound (i.e. form.is_bound is true) then you can access > its data attribu

Re: multidb - partitioning

2010-01-10 Thread Adrian Maier
On Sat, Jan 9, 2010 at 15:20, tom <toab...@googlemail.com> wrote: > Hi Adrian, > > thanks for your answer! > The problem is, that i don't know how many projects will be created. > Every user > of the application can create and delete new projects. > Maybe it's possi

Re: multidb - partitioning

2010-01-08 Thread Adrian Maier
nvolves creation of a new table , and modifying the insert trigger). After creating the tables you should do some testing to see that using partitioning is indeed giving better performance. Adding some indexes could be an alternative solution, and the only way for knowing what's the best solut

Re: Anonymous Visitors vs. Registered User Preference Juggling

2010-01-02 Thread Adrian Maier
e will store to > database to some kind of preference table with a 1-1 Foreign key to > the user). > > But I figure I'm going to facepalm myself when it turns out Django > already solves this problem (like it does for most other "core" > problems ;) > > Hello, Perhap

Re: mmmmm

2009-12-26 Thread Adrian Maier
y, the django-admin.py is copied to /usr/local/bin which is not in the default PATH. So for conveninience you might want to add /usr/local/bin to your PATH . Good luck, Adrian Maier -- You received this message because you are subscribed to the Google Groups "Django users" grou

HttpResponseRedirect doesn't redirect in this case

2009-11-17 Thread adrian
The LOGIN_REDIRECT_URL setting points to this view, where I want to redirect again according to the group the user is in: @login_required def after_login(request): print "after_login" groups = request.user.groups.all() if groups: # use first one name =

Re: DjangoCon '09 Schedule

2009-08-31 Thread adrian
Tickets are now sold out. I need a ticket. If anyone would like to sell their ticket please contact me at adrian_nye at yahoo. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

sessions and multiple login as same user

2009-07-10 Thread adrian
My app is used in an office with multiple users logged in and using it simultaneously. Sometimes they may log in as the same user. Is there any reason this should cause interaction between their sessions? I have looked through the session code and see nothing that should prevent these from

view causes error in Internet Explorer but not Firefox

2009-07-04 Thread adrian
This view shows a cart and processes a cart submission. You can try it on our staging server at: http://tixsa.giantbyte.com You'll have to find an event with tickets and add it to your cart. The code in question is: http://dpaste.com/hold/63158/ Everything works fine on FF. On IE,

Re: ModelMultipleChoiceField - when is queryset updated?

2009-06-29 Thread adrian
Also this behavior is different from ModelChoiceField - which DOES seem to update immediately if an instance is added to the model. I'm using version 1.0.2 Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

ModelMultipleChoiceField - when is queryset updated?

2009-06-29 Thread adrian
I had this: disciplines = forms.ModelMultipleChoiceField(queryset = Discipline.objects.all()) But if new Disciplines are created during runtime they do not appear on the list when a new form is rendered. There doesn't seem to be a mention of that fact in the documentation. So is it correct

validation against hidden field

2009-06-28 Thread adrian
My question is about how to validate one field based on the value of another field in a modelform, but I don't want to show the second field in the form. I've got a Ticket model with a foreign key field to Event: class Ticket(models.Model): # General Admission or assigned seating section

Re: TimeField and null

2009-06-25 Thread adrian
Thanks for that clear explanation, and your solution works great! Adrian On Jun 24, 9:23 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Wed, Jun 24, 2009 at 3:57 PM, adrian <adrian...@gmail.com> wrote: > > > I need a time field that can be None. > > > I defin

Re: TimeField and null

2009-06-24 Thread adrian
If you look, blank is set to True, and it still returns the validation error. On Jun 24, 3:25 pm, "Gabriel ." <gabriel@gmail.com> wrote: > Hi, > > On Wed, Jun 24, 2009 at 4:57 PM, adrian <adrian...@gmail.com> wrote: > > > I need a time field that

TimeField and null

2009-06-24 Thread adrian
I need a time field that can be None. I define the field so that Null is legal in the DB: time_end = models.TimeField(blank=True, null=True) The form field is: time_end = forms.ChoiceField(required=False, choices=END_TIME_CHOICES) and END_TIME_CHOICES is: END_TIME_CHOICES = ( (None,

Re: Accessing dictionaries in templates in a sorted manner

2009-06-10 Thread Adrian Rogers
for ages and always had to tinker around with my data structures before putting them into the template. Anyone able to confirm if this is an intended use that I can rely on for the future? -- Adrian --~--~-~--~~~---~--~~ You received this message because you are s

multiple modelforms for model

2009-06-04 Thread adrian
I need to show Telephone and Address modelforms in the middle of another big form, so I decided to organize the big form into smaller modelforms and display each in a separate fieldset. This works well until the next time I clear the DB and run syncdb. At that point, syncdb completely ignores

Re: form.initial and ManyToMany

2009-05-27 Thread adrian
Oops, the title of this thread should have been "instance" instead of "initial". --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

form.initial and ManyToMany

2009-05-27 Thread adrian
I'm writing a view to edit a model that has ManyToMany fields. The form appears with all the fields properly filled out based on the existing model instance, except the ManyToMany fields show all the options but none are selected. My question is, what do I have to do to have the form appear

Re: initial data for formset

2009-05-27 Thread adrian
Thanks. I've set extra=0 and added an element to the list, and now the last form on the page is half-initialized - the date is set but the time is not! What could cause that?? On May 26, 9:20 pm, Sam Chuparkoff <s...@sadach.org> wrote: > On Tue, 2009-05-26 at 17:27 -0700, adr

initial data for formset

2009-05-26 Thread adrian
This code creates a formset and populates fields with copies of date and start_time. The problem is, if num_events is X then it creates X forms but it only populates X-1 (it leaves the last one uninitialized). My question is why, and how to fix it? Thanks. DateTimeFormSet =

Re: ManyToMany field and limit_choices_to

2009-05-16 Thread adrian
pilot error, no need to reply On May 16, 10:41 am, adrian <adrian...@gmail.com> wrote: > I am creating a view to edit a model that has a ManyToMany field. > The field is defined as: > > performer = models.ManyToManyField(Entity, limit_choices_to= > {'role__exact':'PER'})

ManyToMany field and limit_choices_to

2009-05-16 Thread adrian
I am creating a view to edit a model that has a ManyToMany field. The field is defined as: performer = models.ManyToManyField(Entity, limit_choices_to= {'role__exact':'PER'}) Entity is a table of persons or organizations. Some of them are performers and some are not (distinguished by

Re: Having trouble authenticating/validating

2009-05-12 Thread adrian
Figured it out by looking at how the admin view using AuthenticationForm: In POST: loginForm = AuthenticationForm(data=request.POST) note the use of data= which I have not seen before in GET: loginForm = AuthenticationForm(request) request.session.set_test_cookie() note the

Re: Having trouble authenticating/validating

2009-05-12 Thread adrian
For the record, I am seeing the same problem. request.POST contains the correct values for username and password, yet is_valid returns false and the form does not include any error messages. I haven't gotten to the bottom of it yet but AuthenticationForm is not calling the clean() method. And I

Re: change query for ModelChoiceField

2009-05-11 Thread adrian
For the record, here's what works: In views.py: if country == 'Canada': delivery_time__lte=time_avail_hours abbrev__contains='SC' formShip = ShippingMethodForm(delivery_time__lte, abbrev__contains) Then in models.py: class ShippingMethodForm(forms.Form): #

Re: change query for ModelChoiceField

2009-05-11 Thread adrian
oops! missing the filter_string arg in __init__. After I added that, I get: ValueError .too many values to unpack On May 11, 4:27 pm, adrian <adrian...@gmail.com> wrote: > I tried in the view: > > filter_string = "delivery_time__lte=time_avail_hours, > abbrev__co

Re: change query for ModelChoiceField

2009-05-11 Thread adrian
, *args, **kwargs): >         super(ShippingMethodForm, self).__init__(*args, **kwargs) >         self.fields["ship_method"].queryset = > ShippingMethod.objects.filter(something) > > when you initiate the form, you do it like this: > form = ShippingMethodForm(something

change query for ModelChoiceField

2009-05-11 Thread adrian
I want to create a form with a select box populated from a query that I pass from the view. For example: if country == 'Canada': methods = ShippingMethod.objects.filter( delivery_time__lte=time_avail_hours, abbrev__contains='SC' )

Re: timeuntil filter

2009-05-09 Thread adrian
net> wrote: > On 5/9/2009 11:28 AM, adrian wrote: > > > > > > > This filter is returning an empty string for a valid date (or datetime > > with 0,0,0 added) in > > Django 1.0.2. > > > The documentation for this says: > > >> Comparing offset-nai

timeuntil filter

2009-05-09 Thread adrian
This filter is returning an empty string for a valid date (or datetime with 0,0,0 added) in Django 1.0.2. The documentation for this says: > Comparing offset-naive and offset-aware datetimes will return an empty string. but it doesn't say which type it uses. Shouldn't this say something

Re: how to display m2m fields in template

2009-04-25 Thread adrian
containing 'P'. Is there a better way either in the template or in the select statement? Thanks On Apr 24, 6:20 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Fri, Apr 24, 2009 at 7:18 PM, adrian <adrian...@gmail.com> wrote: > > > Given these models from the doc:

how to display m2m fields in template

2009-04-24 Thread adrian
Given these models from the doc: class Publication(models.Model): title = models.CharField(max_length=30) class Article(models.Model): headline = models.CharField(max_length=100) publications = models.ManyToManyField(Publication) What do I need in the view and template to print an

inclusion tag optional argument

2009-04-21 Thread adrian
I want to have an inclusion tag that builds a menu system, which has a default config. default_config = [list of dicts here] @register.inclusion_tag('_nav_leftmenu.html') def nav_leftmenu(menu_config=default_config): # build stuff here to display menu system return {'menu_html':

Re: Querysets and ROW_NUMBER

2009-04-08 Thread adrian
Thanks for the advice Tim. I ended up doing something similar, although not as elegant as your solution. I'll give it a go ;) cheers adrian --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users&q

Querysets and ROW_NUMBER

2009-04-07 Thread adrian
Was wondering if anyone can point me in the right direction here, what would be the Django style way to annotate a set with a row number in some way like:- Book.objects.all().order_by('date_added').annotate(row_num=RowNumber ('id')) Unfortunately PostgreSQL does not support ROW_NUMBER yet so I

creating model instance with existing foreign key db entry

2009-03-25 Thread adrian
I have a Sighting model which has a foreign key field "notes" to a model called Notes. Notes has a predefined empty note with id=1. If the user specifies no note then I want the sighting to reference this predefined empty note. So in my view: note = form.cleaned_data['notes'] if note != "":

Re: can't connect with dbshell

2009-03-20 Thread Adrian R.
On 20 Mrz., 17:21, Ramiro Morales wrote: > On Wed, Mar 18, 2009 at 7:23 PM, waltbrad wrote: > > > First time I think I've ever tried this. I'm using postgres and the > > database is configured correctly and I have psql.exe on my path. > > > So at the

Re: can't connect with dbshell

2009-03-20 Thread Adrian R.
Same problem here and no additional information. Could somebody please help us? Thank you! On 18 Mrz., 23:23, waltbrad wrote: > First time I think I've ever tried this. I'm using postgres and the > database is configured correctly and I have psql.exe on my path. > > So at

Re: accessing related fields of model

2009-03-19 Thread adrian
I found a serializer that can follow foreign key fields, which solves my problem. http://code.google.com/p/wadofstuff/wiki/DjangoFullSerializers But I would still like to understand if someone cares to answer! I think this should be in the documentation also. On Mar 19, 3:20 pm, adrian

accessing related fields of model

2009-03-19 Thread adrian
The doc gives this example for querying an Entry model which has a foreign key field to a Blog model. e = Entry.objects.get(id=2) e.blog = some_blog Fine. Now if I do it in a loop like this: e = Entry.objects.all() for entry in e: entry.blog = some_blog #do stuff here with Entry and

Re: Possible Paginator bug - duplicate SQL queries?

2009-03-13 Thread adrian
And no, I'm not using any plugins, except of course have DEBUG=True. On Mar 12, 10:59 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Thu, Mar 12, 2009 at 11:24 PM, adrian <adrian...@gmail.com> wrote: > > > I have a view that does not evaluate a queryset, it just adds

Re: Possible Paginator bug - duplicate SQL queries?

2009-03-13 Thread adrian
 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Thu, Mar 12, 2009 at 11:24 PM, adrian <adrian...@gmail.com> wrote: > > > I have a view that does not evaluate a queryset, it just adds filters > > and order_by and then > > passes it to Paginator (set to 5

Possible Paginator bug - duplicate SQL queries?

2009-03-12 Thread adrian
I have a view that does not evaluate a queryset, it just adds filters and order_by and then passes it to Paginator (set to 50 per page) and the result is passed to the template.The following SQL is generated (with some fields omitted for clarity). I'm using Django 1.0.2 and MySQL 5.1.

  1   2   3   4   5   6   7   8   9   >