Re: Sick of defining urls
I think you've kind of missed my point as there's not a view that can render any object - but rather the name of the view is in the url. This is the url conf for a typical rails app. map.connect '', :controller => "public" # Install the default route as the lowest priority. map.connect ':controller/:action/:id.:format' map.connect ':controller/:action/:id' That is the whole thing. Controllers are analogous to applications in django, actions are like view functions, id is typically the primary key of the object being viewed. format is new and could be .json, .xml, .html. I don't really use it just now. I see no reason ever to specify a more elaborate url. I want the equivalent setup in my urls.py and then I never want to open that file again - relying entirely on naming convention rather than configuration. You've kind of pointed me in the right direction though. After a day of hacking about I ended up with: urlpatterns += patterns('', (r'^(?P[^/]+)/(?P[^/]+)/(?P[^/]+)\.(?P[^/]+)',dispatch_request), (r'^(?P[^/]+)/(?P[^/]+)/(?P[^/]+)',dispatch_request), (r'^(?P[^/]+)/(?P[^/]+)\.(?P[^/]+)',dispatch_request), (r'^(?P[^/]+)/(?P[^/]+)',dispatch_request), (r'^(?P[^/]+)\.(?P[^/]+)',dispatch_request), (r'^(?P[^/]+)',dispatch_request), ) def dispatch_request(request, app, view='index', id=None, format='html'): """ Implements Ruby on Rails 'Convention over Configuration' Policy Along with rules in urls.py, implements urls of type /application/view/id.format which is analogous to Rails's /controller/action/id.format """ view_module = None view_function = None # if debug, let the exceptions fly - otherwise make them 404's # try to import the application module, then lookup the view function in it if settings.DEBUG: view_module = __import__(app+'.views', globals(), locals(), [ view ], -1) view_function = (view_module.__getattribute__(view)) else: try: view_module = __import__(app+'.views', globals(), locals(), [ view ], -1) view_function = (view_module.__getattribute__(view)) except ImportError: raise Http404 # make the GET mutable and stick format and id on it if non-nil if request.GET: request.GET = request.GET.copy() else: request.GET = QueryDict('').copy() request.GET.__setitem__('format',format) if id: request.GET.__setitem__('id',id) # call the view function result = view_function(request) # if the view didn't render anything, lookup the template by convention and render it if result == None: result = render_to_response(app+'/'+view+'.'+format,{'app': app, 'view': view , 'id': id, 'format': format},context_instance=RequestContext(request)) return result and this gives me most of the convention of rails. No more fiddling urls.py. The only improvement would be to make the functions in views.py methods on an object (the "controller") and bind its ivars into the request when rendering the template. On Nov 25, 2009, at 11:36 AM, Tim Valenta wrote: > I usually don't find myself writing too many redundant views, since > the built-in admin site does so much of that automatically. Then I > just build views specific to the site's public UI. I still find it > curious that you would find yourself recreating said urls. I run a > company database through the admin and three urls and three views. > There should only have to be one url pattern defined per model, plus > any extra views for looking at that one model. I don't mean to > belittle what it is you're doing, but I can't say that I can identify > very well. How many of your models have exactly the same set of > views? My tendency is to think that those should be caught through > some keyword captures. > > There are, however, generic views (http://docs.djangoproject.com/en/ > dev/ref/generic-views/) which might help. You might look at it and > not think that it is as easy to use as you might like, but they are > quite good for automatically handling dates in URLs, etc. > > I can't explain too much about generic views, as I haven't had to use > them much. I'm totally not an authority on that end. > > If they don't really work out, you could always write a url which > captures each of those three things as keyword arguments: > >urlpatterns = patterns('', >(r'^(?P[^/]+)/(?P[^/]+)/(?P\d+)/', > 'magic_view_handler'), >) > > "magic_view_handler" would then be a view that gets called, whose > signature looks something like: > >magic_view_handler(request, app, view, id): >view_function = None >try: >view_function = import('%s.%s' % (app, view)) >except ImportError: >raise Http404 >view_function(request, id) > > It'd then be up to your *real* view to check to ensure that the id is > legit. > >
Re: django error page: traceback too shallow?
def home (request): if (request.user.is_authenticated()): artifacts = Artifact.objects.filter (member__exact=request.user.profile.id) ... else: ... In this case, the user is authenticated but the predicate is failing as expected because user.profile is NULL. The traceback is just odd. -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: A Friendship relationship question.
On Wed, Dec 2, 2009 at 6:08 PM, Jeffrey Taggartywrote: > Hi guys, thanks for responding. I didn't want to have to create 2 > entries in the database for a friendship because of the obvious > integrity issues such as friendship deleting and friendship > relationships to files etc seems like a lot of unnecessary > duplication. I didn't see that symmetrical m2m before, thanks a lot > for the link. I am going to refactor my code and schema armed with > this information. > I was thinking that perhaps if you'd like to learn more about approaches to what you're doing, you could look up things that have been written about storing directed acyclical graphs in relational databases. That's essentially what you're doing. You may even conclude that a relational database isn't the right data store... but that's what Django was built for, of course. If you want to scale, really scale, you'll want to use a graph library. There are several for Python, including NetworkX, which I've used, and Boost, which I haven't. Probably more info than you wanted, but there it is. Nick -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Custom User Model, Django Admin, and the password field
Hi, I've created a custom user model in my application by subclassing django.contrib.auth.models.User. This user model is working, but there are a couple of problems I have with it. 1) The change password link in the admin site doesn't work? 2) The default password box on the add/edit page for a user is a little unfriendly. Ideally, what I'd like is the two password fields from the change password form on the add/edit user form in the admin, which will automatically turn convert the entered password into a valid encrypted password in Django. This would make the admin system MUCH friendlier and much more suited to my needs, as a fair number of user accounts will be created and maintained manually in this app, and the person responsible for doing so will likely be scared off at the sight of that admin field, or just type a clear text password and wonder why it doesn't work. Is this possible / How do I do this? -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Why does create_user work without importing User from django.contrib.auth.models
I have been using django.contrib.auth for some time now. I have been creating users and assigning them to groups successfully. I do something like this: - user = User.objects.create_user (username=form.cleaned_data['username'], password=form.cleaned_data['password'], email=form.cleaned_data ['email']) user.is_staff=True user.first_name=form.cleaned_data['first_name'] user.last_name=form.cleaned_data['last_name'] group = Group.objects.get(name='B') user.groups.add(group) user.save() However, I just realized that I have never done from django.contrib.auth.models import User, Group I don't understand why my code works without the proper import statements!? -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: MySQL error 1406 while running syncdb
Exactly. So people need to be aware of the varchar limits of django_ tables and also the contrib.auth tables. On Dec 2, 5:11 pm, Jarek Zgodawrote: > Wiadomo¶æ napisana w dniu 2009-12-02, o godz. 11:30, przez chefsmart: > > > > > Hi, I'm am getting MySQL error 1406 while running syncdb. (See link > >http://pastebin.org/59605) > > > This happens after I create the superuser. > > > The error says _mysql_exceptions.DataError: (1406, "Data too long for > > column 'name' at row 1") > > > I am not doing any pre-population of data. So I checked the tables > > whose names start with "django_" and columns called "name" appear for > > the django_content_type table and the django_site tables. The former > > is varchar(100) and the latter is varchar(50). > > > I am definitely safe as far as the django_site table is concerned. And > > I am also safe with the django_content_type table so I'm not sure why > > this is happening. > > > Where does Django populate the django_content_type.name column from? I > > am guessing it would take the model name or the verbose_name if > > supplied. > > > All my models are named well within the varchar(100) limit. > > > Any idea what is going on? By the way, I'm also using contrib.auth. > > Here's the culprit: > > File "D:\Python25\lib\site-packages\django\contrib\auth\management > \__init__.py", line 28, in create_permissions defaults={'name': name, > 'content_type': ctype}) > > Do you have any custom-defined permissions for your models? > > -- > Artificial intelligence stands no chance against natural stupidity > > Jarek Zgoda, R, Redefine > jarek.zg...@redefine.pl -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Custom Authentication Backend
bfrederi wrote: > I am writing my own custom authentication for AD/ldap and I am trying > to authenticate the user without saving the user in the Django User > table. I also don't want the user to have to log in every time they > want to view something. Is there any way to not save the user in the > Django User table and keep them authenticated? I don't require them to > access admin or anything, I just need them to be authenticated. > > So far I have this as my backend (the ldap backend it falls back on > after the default backend): > http://dpaste.com/hold/128199/ > > But when I use that code, it is still saving the User model instance. > I know, because the next time I log in I get a "Duplicate entry". I > don't want to have to make a user for every person that logs into my > django site via their ldap credentials if I can avoid it. It isn't clear to me that you want to avoid the effort of putting a user in or whether you really want to avoid having them in the Django database. If you just want to avoid the effort and don't mind them being in there I can recommend Peter Herndon's django_ldap_groups ... http://code.google.com/p/django-ldap-groups/ ... which I have recently installed and it works very well. This kit automatically inserts the user from the AD or eDirectory into the Django database complete with whatever info you want to extract and also putting them into Django groups you have related to AD or eD groups. This lets users login with ldap auth and if the ldap server is down they can log into the Django app using Django auth. Regards Mike I would > greatly appreciate it if someone could point me in the right > direction, or tell me what I'm doing wrong. > > -- > > 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 this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-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-us...@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-users?hl=en.
Re: A Friendship relationship question.
Hi guys, thanks for responding. I didn't want to have to create 2 entries in the database for a friendship because of the obvious integrity issues such as friendship deleting and friendship relationships to files etc seems like a lot of unnecessary duplication. I didn't see that symmetrical m2m before, thanks a lot for the link. I am going to refactor my code and schema armed with this information. J On Dec 2, 5:39 pm, aa56280wrote: > Couple things: > > 1) Your query is not working because if user1 added user2, then you > should be looking at from_friend not to_friend. > > 2) You haven't posted the code where you're creating friendships but > I'm assuming you are not creating symmetrical friendships there. That > is, if user1 adds user2, you create a record in the table and you move > on, but you need to create another record to symbolize the friendship > the other way around. Have a look at symmetrical ManyToMany > relationships and see if it's possible to go that route - it actually > uses a friends example > :-)http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.mod... > > Hope that helps. -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Importing users - salted sha1
I have a website with about 90 users that I'm trying to import into Django. Right now, the users have a password with a salt and a hash, so I tried (with a sample user) to format the password how Django likes them. I did sha1$salt$hash and I wasn't able to log into admin with that user (I made that user a superuser, staff, and active). I'm using Django's auth authentication system. Has anyone run into this before? Do I have to do something else to get this to work? Thanks in advance! -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Custom Authentication Backend
I am writing my own custom authentication for AD/ldap and I am trying to authenticate the user without saving the user in the Django User table. I also don't want the user to have to log in every time they want to view something. Is there any way to not save the user in the Django User table and keep them authenticated? I don't require them to access admin or anything, I just need them to be authenticated. So far I have this as my backend (the ldap backend it falls back on after the default backend): http://dpaste.com/hold/128199/ But when I use that code, it is still saving the User model instance. I know, because the next time I log in I get a "Duplicate entry". I don't want to have to make a user for every person that logs into my django site via their ldap credentials if I can avoid it. I would greatly appreciate it if someone could point me in the right direction, or tell me what I'm doing wrong. -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Initial values for formwizard form
Ok, so I'm a little embarrassed as usual. basically I was checking for a step without defining it. I assumed I could just use the step that is passed but that didn't seem to work for the if statement. So I just eliminated the if statement and all is well. Not perfect, but I can at least move on. On Dec 2, 3:53 pm, geraldcorwrote: > So I successfully used this method to add initial values using > parse_params as I was dealing with step 0. However, now the client > wants the form order changed so that what was step 0 is now step 2. I > tried using process_step in the exact same way as parse_params, but > the values are not filled in. I can't figure out how to use > process_step like I was able to use parse_params. > > this is what I tried > > def process_step(self, request, form, step): > profile={} > profile=request.user.get_profile() > if step == 2: > init={ > 'company': profile.defaultcompany, > 'contact': profile.defaultcontact, > 'address1': profile.defaultaddress1, > 'address2': profile.defaultaddress2, > 'address3': profile.defaultaddress3, > 'city': profile.defaultcity, > 'state': profile.defaultstate, > 'zip': profile.defaultzip, > 'country': profile.defaultcountry, > 'faxareacode': profile.defaultfaxareacode, > 'fax': profile.defaultfax, > 'areacode': profile.defaultareacode, > 'phone': profile.defaultphone, > 'email': profile.defaultemail, > 'billingcompany': profile.billingcompany, > 'billingname': profile.billingname, > 'billingaddress1': profile.billingaddress1, > 'billingaddress2': profile.billingaddress2, > 'billingaddress3': profile.billingaddress3, > 'billingcity': profile.billingcity, > 'billingstate': profile.billingstate, > 'billingzip': profile.billingzip, > 'billingcountry': profile.billingcountry, > 'billingfaxareacode': > profile.billingfaxareacode, > 'billingfax': profile.billingfax, > 'billingareacode': profile.billingareacode, > 'billingphone': profile.billingphone, > 'billingemail': profile.billingemail, > } > if profile.sendreportsto: > init['sendreportsto']=profile.sendreportsto > else: > init['sendreportsto']='Please use the > format:\nName n...@email.com, > \nName2 na...@email.com' > self.initial[2]=init > Thanks for any more help. > > On Nov 19, 5:56 pm, geraldcor wrote: > > > This worked perfectly. Thank you. I used parse_params because I needed > > to add default company profile stuff to the first wizard form. Thank > > you again for clearing up my ignorance. > > > Greg > > > On Nov 18, 9:10 pm, "Mark L." wrote: > > > > On Nov 19, 1:28 am, geraldcor wrote: > > > > > Ok, > > > > > Here is how I do it if I am using a regularformwith a regular view: > > > > > profile = request.user.get_profile() > > > >form= MyForm('company': profile.defaultcompany, 'contact': > > > > profile.defaultcontact, etc...}) > > > > return render_to_response('forms/submit.html', {'form':form}, > > > > context_instance=RequestContext(request)) > > > > > pretty simple and basic. > > > > > How do I do this with aformwizard? > > > > > Greg > > > > > On Nov 17, 3:39 pm, geraldcor wrote: > > > > > > Hello all, > > > > > > I began making aformthat used request.user.get_profile to get > > > > > default values for company name, phone, email etc. I have since > > > > > decided to move to a formwizard to split things up. I have no idea how > > > > > to override methods for the formwizard class to be able to include > > > > > thoseinitialvalues in theform. Can someone please help me with this > > > > > problem or point me to the proper help? I have come up short with all > > > > > of my searching. Thanks. > > > > Hello, > > > > The *initial* values for the forms in aformwizardare stored in the > > > self.initial[] list. It means, that to set setinitialvalues for theformin > > > step X you do
Re: A Friendship relationship question.
On Wed, Dec 2, 2009 at 2:04 PM, Jeffrey Taggartywrote: > Hi, > I am having difficulties with listing this type of data. Scenario is > as follows: > > 1) user1 add's a friend called user2 > 2) user2 confirms that user1 is his friend > > what should happen is user2 and user1 see's each others name in their > friends list. What's happening now is I am able to add user2 to user1 > friends list but user1 cannot see user2 in his/her list. My question > is how do I get user1 to show up in user2's list and user2 to show up > in user1's friend list if a user has confirmed friendship? I was > thinking of utilizing the confirmation status in the model and because > that user1 and user2's id is both in the confirmed relationship I > don't see any integrity issues here. Any tips? You haven't done anything to express the reverse relationship, if I understand all this correctly, so of course it doesn't show up. A straightforward way to solve that would be to simply add the reverse entry at the same time you add the initial entry, since you are assuming the friendship is bidirectional. In other words, at some point when you save a form, you're creating a row like this: rel = Friendship.objects.create(to_friend=user1, from_friend=user2) rel.save() But are you doing the reverse? rel = Friendship.objects.create(to_friend=user2, from_friend=user1) rel.save() There are other ways to accomplish it, but I think this is the simplest. Nick -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Initial values for formwizard form
So I successfully used this method to add initial values using parse_params as I was dealing with step 0. However, now the client wants the form order changed so that what was step 0 is now step 2. I tried using process_step in the exact same way as parse_params, but the values are not filled in. I can't figure out how to use process_step like I was able to use parse_params. this is what I tried def process_step(self, request, form, step): profile={} profile=request.user.get_profile() if step == 2: init={ 'company': profile.defaultcompany, 'contact': profile.defaultcontact, 'address1': profile.defaultaddress1, 'address2': profile.defaultaddress2, 'address3': profile.defaultaddress3, 'city': profile.defaultcity, 'state': profile.defaultstate, 'zip': profile.defaultzip, 'country': profile.defaultcountry, 'faxareacode': profile.defaultfaxareacode, 'fax': profile.defaultfax, 'areacode': profile.defaultareacode, 'phone': profile.defaultphone, 'email': profile.defaultemail, 'billingcompany': profile.billingcompany, 'billingname': profile.billingname, 'billingaddress1': profile.billingaddress1, 'billingaddress2': profile.billingaddress2, 'billingaddress3': profile.billingaddress3, 'billingcity': profile.billingcity, 'billingstate': profile.billingstate, 'billingzip': profile.billingzip, 'billingcountry': profile.billingcountry, 'billingfaxareacode': profile.billingfaxareacode, 'billingfax': profile.billingfax, 'billingareacode': profile.billingareacode, 'billingphone': profile.billingphone, 'billingemail': profile.billingemail, } if profile.sendreportsto: init['sendreportsto']=profile.sendreportsto else: init['sendreportsto']='Please use the format:\nName n...@email.com, \nName2 na...@email.com' self.initial[2]=init Thanks for any more help. On Nov 19, 5:56 pm, geraldcorwrote: > This worked perfectly. Thank you. I used parse_params because I needed > to add default company profile stuff to the first wizard form. Thank > you again for clearing up my ignorance. > > Greg > > On Nov 18, 9:10 pm, "Mark L." wrote: > > > On Nov 19, 1:28 am, geraldcor wrote: > > > > Ok, > > > > Here is how I do it if I am using a regularformwith a regular view: > > > > profile = request.user.get_profile() > > >form= MyForm('company': profile.defaultcompany, 'contact': > > > profile.defaultcontact, etc...}) > > > return render_to_response('forms/submit.html', {'form':form}, > > > context_instance=RequestContext(request)) > > > > pretty simple and basic. > > > > How do I do this with aformwizard? > > > > Greg > > > > On Nov 17, 3:39 pm, geraldcor wrote: > > > > > Hello all, > > > > > I began making aformthat used request.user.get_profile to get > > > > default values for company name, phone, email etc. I have since > > > > decided to move to a formwizard to split things up. I have no idea how > > > > to override methods for the formwizard class to be able to include > > > > thoseinitialvalues in theform. Can someone please help me with this > > > > problem or point me to the proper help? I have come up short with all > > > > of my searching. Thanks. > > > Hello, > > > The *initial* values for the forms in aformwizardare stored in the > > self.initial[] list. It means, that to set setinitialvalues for theformin > > step X you do the following: > > > init = { > > 'key1':'val1', > > 'key2':'val2', > > etc.. > > > } > > > self.initial[X] = init > > > The best (and, indeed, about the only place to handle this) is the > > process_step method of thewizardinstance (or parse_params, if you > > need to setinitialvalues for theformin step 0). > > > Hope that helps > > > Mark > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to
Re: A Friendship relationship question.
Couple things: 1) Your query is not working because if user1 added user2, then you should be looking at from_friend not to_friend. 2) You haven't posted the code where you're creating friendships but I'm assuming you are not creating symmetrical friendships there. That is, if user1 adds user2, you create a record in the table and you move on, but you need to create another record to symbolize the friendship the other way around. Have a look at symmetrical ManyToMany relationships and see if it's possible to go that route - it actually uses a friends example :-) http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ManyToManyField.symmetrical Hope that helps. -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: File in admin with TabularInline don't get uploaded
Please disregard this message. It was a dumb mistake on my part and I found it. On Wed, Dec 2, 2009 at 16:08, Marcos Marínwrote: > Hi, > > I have a site where you can create news items that can have attached files. > I'm using TabularInline so the the admin interface shows attached files in > the same view where you create the news items. > > When I create a new news item and attach files it gives no errors, but the > file isn't actually uploaded to the server. > > I have checked: > >- The generated html form in the admin view has enctype=" >multipart/form-data" >- The folder to where it should be uploaded has the necessary >permissions (I'm sure because I have uploaded files for other models to the >same folder and they work). >- The database tuple is created corectly for both the news item and the >attached files > > Everything seems to go fine except the folder where the file should be > uploaded does not have the file. > > I'm running out of ideas of what the problem could be, anyone have any? > -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
File in admin with TabularInline don't get uploaded
Hi, I have a site where you can create news items that can have attached files. I'm using TabularInline so the the admin interface shows attached files in the same view where you create the news items. When I create a new news item and attach files it gives no errors, but the file isn't actually uploaded to the server. I have checked: - The generated html form in the admin view has enctype=" multipart/form-data" - The folder to where it should be uploaded has the necessary permissions (I'm sure because I have uploaded files for other models to the same folder and they work). - The database tuple is created corectly for both the news item and the attached files Everything seems to go fine except the folder where the file should be uploaded does not have the file. I'm running out of ideas of what the problem could be, anyone have any? -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
A Friendship relationship question.
Hi, I am having difficulties with listing this type of data. Scenario is as follows: 1) user1 add's a friend called user2 2) user2 confirms that user1 is his friend what should happen is user2 and user1 see's each others name in their friends list. What's happening now is I am able to add user2 to user1 friends list but user1 cannot see user2 in his/her list. My question is how do I get user1 to show up in user2's list and user2 to show up in user1's friend list if a user has confirmed friendship? I was thinking of utilizing the confirmation status in the model and because that user1 and user2's id is both in the confirmed relationship I don't see any integrity issues here. Any tips? Friendship model: class Friendship(models.Model): NOT_CONFIRMED = 1 PENDING= 2 CONFIRMED = 3 STATUS_CHOICES = ( (NOT_CONFIRMED, 'Not Confirmed'), (PENDING, 'Pending'), (CONFIRMED, 'Confirmed'), ) from_friend = models.ForeignKey(User, related_name='friend_set') to_friend = models.ForeignKey(User, related_name='to_friend_set') confirmed = models.IntegerField(choices=STATUS_CHOICES, default=NOT_CONFIRMED) class Meta: unique_together = (('to_friend', 'from_friend'),) def __unicode__(self): return '%s, %s' % (self.from_friend.username, self.to_friend.username) Views to render the friendships (as you can see, I have been playing with the filtering): @login_required def friends_list(request, username): user = get_object_or_404(User, username=username) #friends = [friendship for friendship in user.friend_set.filter(Q (confirmed=2) | Q(confirmed=3))] friends = Friendship.objects.filter( Q(to_friend=user) | Q(confirmed=3) ) # get friends latest 10 shows friend_shows = Show.objects.filter(user__in=friends).order_by('-id') return render_to_response('habit/friends_list.html', { 'user': request.user, 'friends': friends, 'shows': friend_shows[:10], 'username': username, }) -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Caught an exception while rendering: Reverse for 'portal.compliance_index' with arguments '()' and keyword arguments '{}' not found.
Does your urls.py contain an entry for compliance_index? On Dec 2, 2:05 pm, Saravananwrote: > Environment: > > Request Method: GET > Request URL:http://shellwing251.atdesk.com/ > Django Version: 1.0.2 final > Python Version: 2.4.2 > Installed Applications: > ['django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.admin', > 'portal.utils', > 'portal.corp_act'] > Installed Middleware: > ('django.middleware.common.CommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'portal.utils.auth.ATDUserAuthMiddleware') > > Template error: > In template /home/skannan/borgTraining/atd/borg/portal/templates/ > index.html, error at line 10 > Caught an exception while rendering: Reverse for > 'portal.compliance_index' with arguments '()' and keyword arguments > '{}' not found. > 1 : {% extends "base.html" %} > > 2 : > > 3 : {% block breadcrumbs %}Home{% endblock %} > > 4 : {% block pageheading %}Borg Control for {{ SITE_LONG_NAME }}{% > endblock %} > > 5 : > > 6 : {% block content %} > > 7 : > > 8 : Customer/Conduit li> > > 9 : Corporate Actions li> > > 10 : Compliance li> > > 11 : > > 12 : {% endblock %} > > 13 : > > Traceback: > File "/usr/lib64/python2.4/site-packages/django/core/handlers/base.py" > in get_response > 86. response = callback(request, *callback_args, > **callback_kwargs) > File "/usr/lib64/python2.4/site-packages/django/views/generic/ > simple.py" in direct_to_template > 18. return HttpResponse(t.render(c), mimetype=mimetype) > File "/usr/lib64/python2.4/site-packages/django/template/__init__.py" > in render > 176. return self.nodelist.render(context) > File "/usr/lib64/python2.4/site-packages/django/template/__init__.py" > in render > 768. bits.append(self.render_node(node, context)) > File "/usr/lib64/python2.4/site-packages/django/template/debug.py" in > render_node > 71. result = node.render(context) > File "/usr/lib64/python2.4/site-packages/django/template/ > loader_tags.py" in render > 97. return compiled_parent.render(context) > File "/usr/lib64/python2.4/site-packages/django/template/__init__.py" > in render > 176. return self.nodelist.render(context) > File "/usr/lib64/python2.4/site-packages/django/template/__init__.py" > in render > 768. bits.append(self.render_node(node, context)) > File "/usr/lib64/python2.4/site-packages/django/template/debug.py" in > render_node > 71. result = node.render(context) > File "/usr/lib64/python2.4/site-packages/django/template/ > loader_tags.py" in render > 24. result = self.nodelist.render(context) > File "/usr/lib64/python2.4/site-packages/django/template/__init__.py" > in render > 768. bits.append(self.render_node(node, context)) > File "/usr/lib64/python2.4/site-packages/django/template/debug.py" in > render_node > 81. raise wrapped > > Exception Type: TemplateSyntaxError at / > Exception Value: Caught an exception while rendering: Reverse for > 'portal.compliance_index' with arguments '()' and keyword arguments > '{}' not found. > > Original Traceback (most recent call last): > File "/usr/lib64/python2.4/site-packages/django/template/debug.py", > line 71, in render_node > result = node.render(context) > File "/usr/lib64/python2.4/site-packages/django/template/ > defaulttags.py", line 378, in render > args=args, kwargs=kwargs) > File "/usr/lib64/python2.4/site-packages/django/core/ > urlresolvers.py", line 253, in reverse > return iri_to_uri(u'%s%s' % (prefix, get_resolver(urlconf).reverse > (viewname, > File "/usr/lib64/python2.4/site-packages/django/core/ > urlresolvers.py", line 242, in reverse > raise NoReverseMatch("Reverse for '%s' with arguments '%s' and > keyword " > NoReverseMatch: Reverse for 'portal.compliance_index' with arguments > '()' and keyword arguments '{}' not found. -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Show additional user information in admin
You'll have to "activate" the model like any other in order for it to show up on the Admin site. Have a look here: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overview On Dec 2, 3:32 pm, Kai Timmerwrote: > Hello, > by following this > guide:http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-... > I made a model and added some information to every user. What do I > have to do, to show these additional fields in the admin/user > interface? > > Greetings, > -- > Kai Timmer |http://kaitimmer.de > Email : em...@kaitimmer.de > Jabber (Google Talk): k...@kait.de -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Application not showing in admin panel
On Dec 2, 2:17 pm, "dr.NO"wrote: > I've installed application djangodblog, it's working, it's logging > everything into db - but it's not showing in the admin panel ... - any > idea how to fix thax ? Did you follow the steps outlined in the doc? http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overview -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: missing template for login page
> I tried copying /django/contrib/auth/tests/templates/ to > /django/contrib/auth/ but this gives me a form with only two fields and > no submit button ... The form you are getting sounds like the right one. You'll get a username field and a password field, but you'll have to provide your own tag and submit button. Have a look at the sample login template: http://docs.djangoproject.com/en/dev//topics/auth/#django.contrib.auth.views.login -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Capturing common data from all URLs
Hi, I'm working on porting a legacy site (addons.mozilla.org) where all urls begin with /locale/app/: e.g. https://addons.mozilla.org/en-US/firefox/ https://addons.mozilla.org/ja/firefox/addon/5890 https://addons.mozilla.org/en-US/thunderbird and in some cases, the application is not needed: http://www.mozilla.com/en-US/about/legal.html I know I can use django-localeurl to capture the locale, but I'm wondering if there's a more generic middleware that can capture anything (and store it in the request object) based on configuration? Cheers, -d -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Show additional user information in admin
Hello, by following this guide: http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users I made a model and added some information to every user. What do I have to do, to show these additional fields in the admin/user interface? Greetings, -- Kai Timmer | http://kaitimmer.de Email : em...@kaitimmer.de Jabber (Google Talk): k...@kait.de -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django tag cloud
On Thu, Nov 26, 2009 at 10:22 PM, Nick Arnettwrote: > What you need is called data normalization - fitting data to a desired scale > - in statistics and analysis. > > Here's a general page about normalization: > > http://www.qsarworld.com/qsar-statistics-normalization.php > > I'd imagine that there's a Python library or module that will do this for > you, but it's not hard to write your own. I've done a simple custom template tag to have my cloud working :) -- Alessandro Ronchi http://www.soasi.com SOASI - Sviluppo Software e Sistemi Open Source http://hobbygiochi.com Hobby & Giochi, l'e-commerce del divertimento -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Application not showing in admin panel
I've installed application djangodblog, it's working, it's logging everything into db - but it's not showing in the admin panel ... - any idea how to fix thax ? -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Caught an exception while rendering: Reverse for 'portal.compliance_index' with arguments '()' and keyword arguments '{}' not found.
Environment: Request Method: GET Request URL: http://shellwing251.atdesk.com/ Django Version: 1.0.2 final Python Version: 2.4.2 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.admin', 'portal.utils', 'portal.corp_act'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'portal.utils.auth.ATDUserAuthMiddleware') Template error: In template /home/skannan/borgTraining/atd/borg/portal/templates/ index.html, error at line 10 Caught an exception while rendering: Reverse for 'portal.compliance_index' with arguments '()' and keyword arguments '{}' not found. 1 : {% extends "base.html" %} 2 : 3 : {% block breadcrumbs %}Home{% endblock %} 4 : {% block pageheading %}Borg Control for {{ SITE_LONG_NAME }}{% endblock %} 5 : 6 : {% block content %} 7 : 8 : Customer/Conduit 9 : Corporate Actions 10 : Compliance 11 : 12 : {% endblock %} 13 : Traceback: File "/usr/lib64/python2.4/site-packages/django/core/handlers/base.py" in get_response 86. response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib64/python2.4/site-packages/django/views/generic/ simple.py" in direct_to_template 18. return HttpResponse(t.render(c), mimetype=mimetype) File "/usr/lib64/python2.4/site-packages/django/template/__init__.py" in render 176. return self.nodelist.render(context) File "/usr/lib64/python2.4/site-packages/django/template/__init__.py" in render 768. bits.append(self.render_node(node, context)) File "/usr/lib64/python2.4/site-packages/django/template/debug.py" in render_node 71. result = node.render(context) File "/usr/lib64/python2.4/site-packages/django/template/ loader_tags.py" in render 97. return compiled_parent.render(context) File "/usr/lib64/python2.4/site-packages/django/template/__init__.py" in render 176. return self.nodelist.render(context) File "/usr/lib64/python2.4/site-packages/django/template/__init__.py" in render 768. bits.append(self.render_node(node, context)) File "/usr/lib64/python2.4/site-packages/django/template/debug.py" in render_node 71. result = node.render(context) File "/usr/lib64/python2.4/site-packages/django/template/ loader_tags.py" in render 24. result = self.nodelist.render(context) File "/usr/lib64/python2.4/site-packages/django/template/__init__.py" in render 768. bits.append(self.render_node(node, context)) File "/usr/lib64/python2.4/site-packages/django/template/debug.py" in render_node 81. raise wrapped Exception Type: TemplateSyntaxError at / Exception Value: Caught an exception while rendering: Reverse for 'portal.compliance_index' with arguments '()' and keyword arguments '{}' not found. Original Traceback (most recent call last): File "/usr/lib64/python2.4/site-packages/django/template/debug.py", line 71, in render_node result = node.render(context) File "/usr/lib64/python2.4/site-packages/django/template/ defaulttags.py", line 378, in render args=args, kwargs=kwargs) File "/usr/lib64/python2.4/site-packages/django/core/ urlresolvers.py", line 253, in reverse return iri_to_uri(u'%s%s' % (prefix, get_resolver(urlconf).reverse (viewname, File "/usr/lib64/python2.4/site-packages/django/core/ urlresolvers.py", line 242, in reverse raise NoReverseMatch("Reverse for '%s' with arguments '%s' and keyword " NoReverseMatch: Reverse for 'portal.compliance_index' with arguments '()' and keyword arguments '{}' not found. -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Returning Django objects from Ajax request
ok I've just found it: from django.core import serializers data = serializers.serialize('json', Restaurant.objects.all()) On Dec 2, 8:26 pm, Frank DiRoccowrote: > I'm not so sure that a django question as much as it is a Python > question... > > http://docs.python.org/library/json.html > > On Dec 2, 2009, at 2:01 PM, jul wrote: > > > I'm using jQuery post: > > > $.post("/getRestaurant/", location, > > function(data) { > > /* stuff */ > > }); > > > In my view, how do I convert my Restaurant array to json? > > > Thanks for your reply! > > > On Dec 2, 7:52 pm, Javier Guerra wrote: > >> On Wed, Dec 2, 2009 at 1:36 PM, jul wrote: > >>> How can I return these objects to the javascript in my template? > > >> if you're using jQuery's elm.load(url) function, you have to return > >> an > >> HTML fragment to replace the one already in the browser; so use a > >> template that renders just this fragment. > > >> if you use a JavaScript template (there are several jQuery plugins), > >> just return the data in JSON. > > >> -- > >> Javier > > > -- > > > 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 this group, send email to > > django-users+unsubscr...@googlegroups.com > > . > > For more options, visit this group > > athttp://groups.google.com/group/django-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-us...@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-users?hl=en.
Re: Returning Django objects from Ajax request
I'm not so sure that a django question as much as it is a Python question... http://docs.python.org/library/json.html On Dec 2, 2009, at 2:01 PM, jul wrote: > I'm using jQuery post: > > $.post("/getRestaurant/", location, > function(data) { > /* stuff */ > }); > > In my view, how do I convert my Restaurant array to json? > > Thanks for your reply! > > > On Dec 2, 7:52 pm, Javier Guerrawrote: >> On Wed, Dec 2, 2009 at 1:36 PM, jul wrote: >>> How can I return these objects to the javascript in my template? >> >> if you're using jQuery's elm.load(url) function, you have to return >> an >> HTML fragment to replace the one already in the browser; so use a >> template that renders just this fragment. >> >> if you use a JavaScript template (there are several jQuery plugins), >> just return the data in JSON. >> >> -- >> Javier > > -- > > 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 this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-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-us...@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-users?hl=en.
Re: Returning Django objects from Ajax request
I'm using jQuery post: $.post("/getRestaurant/", location, function(data) { /* stuff */ }); In my view, how do I convert my Restaurant array to json? Thanks for your reply! On Dec 2, 7:52 pm, Javier Guerrawrote: > On Wed, Dec 2, 2009 at 1:36 PM, jul wrote: > > How can I return these objects to the javascript in my template? > > if you're using jQuery's elm.load(url) function, you have to return an > HTML fragment to replace the one already in the browser; so use a > template that renders just this fragment. > > if you use a JavaScript template (there are several jQuery plugins), > just return the data in JSON. > > -- > Javier -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Returning Django objects from Ajax request
On Wed, Dec 2, 2009 at 1:36 PM, julwrote: > How can I return these objects to the javascript in my template? if you're using jQuery's elm.load(url) function, you have to return an HTML fragment to replace the one already in the browser; so use a template that renders just this fragment. if you use a JavaScript template (there are several jQuery plugins), just return the data in JSON. -- Javier -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Returning Django objects from Ajax request
hi, I'm using jQuery to send data to a view with is supposed to return some Django objects (instances of a Restaurant model). Here's what I do 1- some javascript detect the user's location in the client side 2- the location is sent to a view which select some instances of my Restaurant model 3- these instances must be returned to the template. How can I return these objects to the javascript in my template? I'm not using render_to_response with my objects in the context since I think it reloads the whole template? Is that right? thanks jul -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Watermarker - Import error
Hi, I've installed module - django-watermark - using easy_install added watermarker to INSTALLED_APPS in settings.py then i run python manage.py validate - it shows 0 errors then python manage.py syncdb - database table was created without errors then i've checked if everytning is fine with watermarker ( executed python manage.py shell import watermarker; print watermarker.get_version() and the output was: django-watermark 0.1.5-pre1 And now i'm trying to view my page (page or admin panel) in browser i've got an error: (long code below) And i have no idea where to start looking for it ... But when i run python manage.py shell from project dir MOD_PYTHON ERROR ProcessId: 6717 Interpreter:'www.store.fantasyrealms.eu' ServerName: 'www.store.fantasyrealms.eu' DocumentRoot: '/home/arjsoftw/domains/store.fantasyrealms.eu/ public_html' URI:'/admin/' Location: None Directory: '/home/arjsoftw/domains/store.fantasyrealms.eu/ public_html/' Filename: '/home/arjsoftw/domains/store.fantasyrealms.eu/ public_html/admin' PathInfo: '/' Phase: 'PythonHandler' Handler:'django.core.handlers.modpython' Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch default=default_handler, arg=req, silent=hlist.silent) File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target result = _execute_target(config, req, object, arg) File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target result = object(arg) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/core/ handlers/modpython.py", line 228, in handler return ModPythonHandler()(req) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/core/ handlers/modpython.py", line 201, in __call__ response = self.get_response(request) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/core/ handlers/base.py", line 134, in get_response return self.handle_uncaught_exception(request, resolver, exc_info) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/core/ handlers/base.py", line 154, in handle_uncaught_exception return debug.technical_500_response(request, *exc_info) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/views/ debug.py", line 40, in technical_500_response html = reporter.get_traceback_html() File "/home/arjsoftw/root/lib/python2.5/site-packages/django/views/ debug.py", line 114, in get_traceback_html return t.render(c) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/ template/__init__.py", line 178, in render return self.nodelist.render(context) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/ template/__init__.py", line 779, in render bits.append(self.render_node(node, context)) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/ template/debug.py", line 81, in render_node raise wrapped TemplateSyntaxError: Caught an exception while rendering: No module named watermarker Original Traceback (most recent call last): File "/home/arjsoftw/root/lib/python2.5/site-packages/django/ template/debug.py", line 71, in render_node result = node.render(context) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/ template/debug.py", line 87, in render output = force_unicode(self.filter_expression.resolve(context)) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/ template/__init__.py", line 572, in resolve new_obj = func(obj, *arg_vals) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/ template/defaultfilters.py", line 687, in date return format(value, arg) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/utils/ dateformat.py", line 269, in format return df.format(format_string) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/utils/ dateformat.py", line 30, in format pieces.append(force_unicode(getattr(self, piece)())) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/utils/ dateformat.py", line 175, in r return self.format('D, j M Y H:i:s O') File "/home/arjsoftw/root/lib/python2.5/site-packages/django/utils/ dateformat.py", line 30, in format pieces.append(force_unicode(getattr(self, piece)())) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/utils/ encoding.py", line 71, in force_unicode s = unicode(s) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/utils/ functional.py", line 201, in __unicode_cast return self.__func(*self.__args, **self.__kw) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/utils/ translation/__init__.py", line 62, in ugettext return real_ugettext(message) File "/home/arjsoftw/root/lib/python2.5/site-packages/django/utils/ translation/trans_real.py", line 286, in ugettext return do_translate(message,
Re: Browsing Django modules from interactive python shell
On Wed, 2 Dec 2009 11:36:48 -0500 Bill Freemanwrote: > import a > > does not automatically import modules and sub packages of package a. > It takes special action in a's __init__.py to make this happen as it > does for os.path when > you import os. > > I assume that you're doing this directly in python, since in the > manage.py shell other stuff has already caused django.core to be > imported, so it's available. (And Frank was probably using the > manage.py shell, thus finding that he didn't have to separately > import django.core .) > > On Wed, Dec 2, 2009 at 11:14 AM, Kenny Meyer > wrote: > > Hi guys, > > > > I have some strange behaviour in my interactive python shell, when > > trying to browse Django modules... > > > > Example: > > > import django > dir(django.core) > > AttributeError: 'module' object has no attribute 'core' > > > import django.core > dir(django.core) > > ['__builtins__', '__doc__', '__file__', '__name__', '__package__', > > '__path__'] > > > > Can anyone, please, explain me this strange (to me) behaviour? > > > > Regards, > > Kenny > > > > > > .' `. knny [d0t] myer [at] gmail [d0t] com [42!] > > |a_a | http://kenny.paraguayinfos.de | gpg key ID: 0x00F56BA1B2 > > \<_)__/ > > /( )\ Everything should be made as simple as possible, but not > > |\`> < /\ simpler. > > \_|=='|_/ -- Albert Einstein > > > > -- > > 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 this group, send > email to django-users+unsubscr...@googlegroups.com. For more options, > visit this group at http://groups.google.com/group/django-users?hl=en. > > Hello Bill, I haven't seen your reply at first... Slow receiving from mail-client. I've done as you said, and yes, I successfully browse all modules when running `manage.py shell`, but because I was using directly using Python, I received just the limited output. Thanks for the explanation. Regards, Kenny signature.asc Description: PGP signature
Re: Browsing Django modules from interactive python shell
Hello Kenny, As Bill mentioned in this threads parallel thread, you are prolly just entring the python shell like thiis $ python Instead try this from you projects directory (django_site\mysite) $ python manage.py shell As bill mentioned all kindsa magical cool stuff happens... fdiro...@4b0x [~/Code/django-b-cool/mysite $] python manage.py shell Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> dir(django.core) Traceback (most recent call last): File "", line 1, in NameError: name 'django' is not defined >>> import django >>> dir(django.core) ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'cache', 'exceptions', 'files', 'management', 'signals', 'urlresolvers'] Thnx Bill for that info :] On Dec 2, 2009, at 11:37 AM, Kenny Meyer wrote: > On Wed, 2 Dec 2009 11:19:41 -0500 > Frank DiRoccowrote: > >> How about trying to look at whats available for django... mine says >> this >> > import django > dir(django) >> ['VERSION', '__builtins__', '__doc__', '__file__', '__name__', >> '__package__', '__path__', 'conf', 'contrib', 'core', 'db', >> 'dispatch', 'forms', 'get_version', 'http', 'middleware', >> 'shortcuts', 'template', 'utils', 'views'] > dir(django.core) >> ['__builtins__', '__doc__', '__file__', '__name__', '__package__', >> '__path__', 'cache', 'exceptions', 'files', 'management', 'signals', >> 'urlresolvers'] >> >> >> On Dec 2, 2009, at 11:14 AM, Kenny Meyer wrote: >> >>> Hi guys, >>> >>> I have some strange behaviour in my interactive python shell, when >>> trying to browse Django modules... >>> >>> Example: >>> >> import django >> dir(django.core) >>> AttributeError: 'module' object has no attribute 'core' >>> >> import django.core >> dir(django.core) >>> ['__builtins__', '__doc__', '__file__', '__name__', '__package__', >>> '__path__'] >>> >>> Can anyone, please, explain me this strange (to me) behaviour? >>> >>> Regards, >>> Kenny >>> >>> >>> .' `.knny [d0t] myer [at] gmail [d0t] com [42!] >>> |a_a | http://kenny.paraguayinfos.de | gpg key ID: 0x00F56BA1B2 >>> \<_)__/ >>> /( )\ Everything should be made as simple as possible, but not >>> |\`> < /\simpler. >>> \_|=='|_/-- Albert Einstein >> >> -- >> >> 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 this group, send >> email to django-users+unsubscr...@googlegroups.com. For more options, >> visit this group at http://groups.google.com/group/django-users? >> hl=en. >> >> > > Hi Frank, > > Well that's strange... I don't get similar output, but see it > yourself: > import django dir(django) > ['VERSION', '__builtins__', '__doc__', '__file__', '__name__', > '__package__', '__path__', 'get_version'] > > I'm running Ubuntu 9.10 and installed django with `aptitude` named > `python-django`. > > Regards, > Kenny -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Browsing Django modules from interactive python shell
On Wed, 2 Dec 2009 11:19:41 -0500 Frank DiRoccowrote: > How about trying to look at whats available for django... mine says > this > > >>> import django > >>> dir(django) > ['VERSION', '__builtins__', '__doc__', '__file__', '__name__', > '__package__', '__path__', 'conf', 'contrib', 'core', 'db', > 'dispatch', 'forms', 'get_version', 'http', 'middleware', > 'shortcuts', 'template', 'utils', 'views'] > >>> dir(django.core) > ['__builtins__', '__doc__', '__file__', '__name__', '__package__', > '__path__', 'cache', 'exceptions', 'files', 'management', 'signals', > 'urlresolvers'] > > > On Dec 2, 2009, at 11:14 AM, Kenny Meyer wrote: > > > Hi guys, > > > > I have some strange behaviour in my interactive python shell, when > > trying to browse Django modules... > > > > Example: > > > import django > dir(django.core) > > AttributeError: 'module' object has no attribute 'core' > > > import django.core > dir(django.core) > > ['__builtins__', '__doc__', '__file__', '__name__', '__package__', > > '__path__'] > > > > Can anyone, please, explain me this strange (to me) behaviour? > > > > Regards, > > Kenny > > > > > > .' `.knny [d0t] myer [at] gmail [d0t] com [42!] > > |a_a | http://kenny.paraguayinfos.de | gpg key ID: 0x00F56BA1B2 > > \<_)__/ > > /( )\ Everything should be made as simple as possible, but not > > |\`> < /\simpler. > > \_|=='|_/-- Albert Einstein > > -- > > 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 this group, send > email to django-users+unsubscr...@googlegroups.com. For more options, > visit this group at http://groups.google.com/group/django-users?hl=en. > > Hi Frank, Well that's strange... I don't get similar output, but see it yourself: >>> import django >>> dir(django) ['VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'get_version'] I'm running Ubuntu 9.10 and installed django with `aptitude` named `python-django`. Regards, Kenny signature.asc Description: PGP signature
Re: Browsing Django modules from interactive python shell
import a does not automatically import modules and sub packages of package a. It takes special action in a's __init__.py to make this happen as it does for os.path when you import os. I assume that you're doing this directly in python, since in the manage.py shell other stuff has already caused django.core to be imported, so it's available. (And Frank was probably using the manage.py shell, thus finding that he didn't have to separately import django.core .) On Wed, Dec 2, 2009 at 11:14 AM, Kenny Meyerwrote: > Hi guys, > > I have some strange behaviour in my interactive python shell, when > trying to browse Django modules... > > Example: > import django dir(django.core) > AttributeError: 'module' object has no attribute 'core' > import django.core dir(django.core) > ['__builtins__', '__doc__', '__file__', '__name__', '__package__', > '__path__'] > > Can anyone, please, explain me this strange (to me) behaviour? > > Regards, > Kenny > > > .' `. knny [d0t] myer [at] gmail [d0t] com [42!] > |a_a | http://kenny.paraguayinfos.de | gpg key ID: 0x00F56BA1B2 > \<_)__/ > /( )\ Everything should be made as simple as possible, but not > |\`> < /\ simpler. > \_|=='|_/ -- Albert Einstein > -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Browsing Django modules from interactive python shell
How about trying to look at whats available for django... mine says this >>> import django >>> dir(django) ['VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'conf', 'contrib', 'core', 'db', 'dispatch', 'forms', 'get_version', 'http', 'middleware', 'shortcuts', 'template', 'utils', 'views'] >>> dir(django.core) ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'cache', 'exceptions', 'files', 'management', 'signals', 'urlresolvers'] On Dec 2, 2009, at 11:14 AM, Kenny Meyer wrote: > Hi guys, > > I have some strange behaviour in my interactive python shell, when > trying to browse Django modules... > > Example: > import django dir(django.core) > AttributeError: 'module' object has no attribute 'core' > import django.core dir(django.core) > ['__builtins__', '__doc__', '__file__', '__name__', '__package__', > '__path__'] > > Can anyone, please, explain me this strange (to me) behaviour? > > Regards, > Kenny > > > .' `.knny [d0t] myer [at] gmail [d0t] com [42!] > |a_a | http://kenny.paraguayinfos.de | gpg key ID: 0x00F56BA1B2 > \<_)__/ > /( )\ Everything should be made as simple as possible, but not > |\`> < /\simpler. > \_|=='|_/-- Albert Einstein -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Browsing Django modules from interactive python shell
Hi guys, I have some strange behaviour in my interactive python shell, when trying to browse Django modules... Example: >>> import django >>> dir(django.core) AttributeError: 'module' object has no attribute 'core' >>> import django.core >>> dir(django.core) ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__'] Can anyone, please, explain me this strange (to me) behaviour? Regards, Kenny .' `.knny [d0t] myer [at] gmail [d0t] com [42!] |a_a | http://kenny.paraguayinfos.de | gpg key ID: 0x00F56BA1B2 \<_)__/ /( )\ Everything should be made as simple as possible, but not |\`> < /\simpler. \_|=='|_/-- Albert Einstein signature.asc Description: PGP signature
inlineformset and related instance creation at once
hi, im trying to create a form based on 2 models where model B will be a inlineformset related to model A. how can i tell the formset forms (model B) that the related instance is the just created instance based on model A? lets say i want to create the author and assign him many books in one shot. i get the form displayed but after the submit i get a: Cannot assign "": "Book.author" must be a "Author" instance. http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-an-inline-formset-in-a-view only tells how to create Book instances related to an existing author. (i admit i didnt try to hard today) another question i have is: do i have to define the amount of books in advance with extra= or is there a way to get a plus icon where i can click on and get a formset.form more displayed? http://docs.djangoproject.com/en/dev/topics/forms/formsets/#s-adding-additional-fields-to-a-formset here i can see an explaination about how to add fields... i would need something like can_delete or can_order but for adding new forms to the formset. thank you -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django and Authorize.net
Bruce has been working to split out the payments from Satchmo into a standalone app called django-bursar - http://bitbucket.org/bkroeze/django-bursar/overview/ Check that out and see if it meets your needs. I've also heard about this library but have not used it - http://www.adroll.com/labs -Chris On Wed, Dec 2, 2009 at 7:17 AM, Chris McComaswrote: > Greetings, > > We have an application for our school online, just recently the > university controller and business office finally gave us clearance to > accept our application fee online, and they setup an account with > authorize.net. > > I'm trying to integrate the payment within our Application app, I was > curious if anyone had done any one-off payments with Django/ > authorize.net, or if there were and pluggable apps out there (I know > Satchmo, that's my backup plan). > > Thanks, > > Chris > > -- > > 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 this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-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-us...@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-users?hl=en.
Re: missing template for login page
I'm very interested in this as well. I wrote almost all the forms and logic to do what this module already does :/ I should lrn2RTFM! but that's been an uphill battle for many ppl ;) On Dec 2, 2009, at 8:48 AM, Andreas Kuntzagk wrote: > Hi, > > I try to get user authentication working. I followed the advice on > http://docs.djangoproject.com/en/dev//topics/auth/#django.contrib.auth.decorators.login_required > to use the login_required decorator. I also get forwarded to > http://bbc:8000/accounts/login/?next=/blabla > url.py for this reads: > (r'^accounts/login/$', 'django.contrib.auth.views.login'), > > but then it complains about a missing template registration/login.html > > I tried copying /django/contrib/auth/tests/templates/ to > /django/contrib/auth/ but this gives me a form with only two fields > and > no submit button so it's probably the wrong template. Where do I find > the right one or do I have to write it on my own. > > regards, Andreas > > -- > > 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 this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-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-us...@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-users?hl=en.
missing template for login page
Hi, I try to get user authentication working. I followed the advice on http://docs.djangoproject.com/en/dev//topics/auth/#django.contrib.auth.decorators.login_required to use the login_required decorator. I also get forwarded to http://bbc:8000/accounts/login/?next=/blabla url.py for this reads: (r'^accounts/login/$', 'django.contrib.auth.views.login'), but then it complains about a missing template registration/login.html I tried copying /django/contrib/auth/tests/templates/ to /django/contrib/auth/ but this gives me a form with only two fields and no submit button so it's probably the wrong template. Where do I find the right one or do I have to write it on my own. regards, Andreas -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: loaddata encoding problem
Hi Ian, I do have NVARCHAR2 columns and the NLS_NCHAR_CHARACTERSET is AL16UTF16 in both schemas. When trying to decode and encode according to your instruction I get: UnicodeEncodeError: 'latin-1' codec can't encode characters in position 4171134-4176189: ordinal not in range(256) When looking at that position in the file I discovered that we had some "chinese" chars there. And they shouldn't be there (-there seems to be a problem when the size of a oracle CLOB field is exceeded). So now I fount out what the problem is and I thank you for your help.. Regards, Johan On 1 Dec, 19:54, Ianwrote: > On Dec 1, 9:29 am, Johan wrote: > > > > > Hi, > > > I have two oracle schemas created with the same characterset > > (NLS_CHARACTERSET = WE8ISO8859P1). > > > I get a "DatabaseError: ORA-12704: character set mismatch" when doing > > this: > > 1) dumpdata to export data from a module named log in the first schema > > and then > > 2) loaddata to import the result into the second schema. > > > Stacktrace: > > > Problem installing fixture '../../data/fixtures/dev/r1797_20091201/ > > log.xml': Traceback (most recent call last): > > File "/usr/lib/python2.6/site-packages/Django-1.1-py2.6.egg/django/ > > core/management/commands/loaddata.py", line 153, in handle > > obj.save() > > File "/usr/lib/python2.6/site-packages/Django-1.1-py2.6.egg/django/ > > core/serializers/base.py", line 163, in save > > models.Model.save_base(self.object, raw=True) > > File "/usr/lib/python2.6/site-packages/Django-1.1-py2.6.egg/django/ > > db/models/base.py", line 495, in save_base > > result = manager._insert(values, return_id=update_pk) > > File "/usr/lib/python2.6/site-packages/Django-1.1-py2.6.egg/django/ > > db/models/manager.py", line 177, in _insert > > return insert_query(self.model, values, **kwargs) > > File "/usr/lib/python2.6/site-packages/Django-1.1-py2.6.egg/django/ > > db/models/query.py", line 1087, in insert_query > > return query.execute_sql(return_id) > > File "/usr/lib/python2.6/site-packages/Django-1.1-py2.6.egg/django/ > > db/models/sql/subqueries.py", line 320, in execute_sql > > cursor = super(InsertQuery, self).execute_sql(None) > > File "/usr/lib/python2.6/site-packages/Django-1.1-py2.6.egg/django/ > > db/models/sql/query.py", line 2369, in execute_sql > > cursor.execute(sql, params) > > File "/usr/lib/python2.6/site-packages/Django-1.1-py2.6.egg/django/ > > db/backends/util.py", line 19, in execute > > return self.cursor.execute(sql, params) > > File "/usr/lib/python2.6/site-packages/Django-1.1-py2.6.egg/django/ > > db/backends/oracle/base.py", line 434, in execute > > raise e > > DatabaseError: ORA-12704: character set mismatch > > > Why do I get this "character set mismatch" when I have the same > > character sets in the two schemas? > > > Thanks, > > Johan > > Hi Johan, > > Do you only have VARCHAR2 / CLOB columns in the tables, or are there > any NVARCHAR2 / NCLOB columns (which Django creates by default)? If > the latter, then what is the NLS_NCHAR_CHARACTERSET of each database? > > Also, the dumpdata output should be in utf-8. Can you verify that it > can be re-encoded as iso-8859-1 by running the code `file > ('dumpdata.json').read().decode('utf-8').encode('iso-8859-1')`? > > Thanks, > Ian -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Inlineformset_factory and User model
request.user will give you the User object from the django.contrib.auth.models, but Authors has no relation. If you slightly modify your Book model to make authors relate to the above module, you can eliminate the Authors Model and the "user" of you Book model. class Book(models.Model): ... authors = models.ManyToManyField(User, related_name='Entries') ... Now in you view, all you have to do is: def add_books(request): if not request.user.is_authenticated(): return HttpResponseRedirect("accounts/login") if request.method == "POST": formset = BookFormSet(request.POST) if formset.is_valid(): formset.save() return HttpResponseRedirect('books/latest.html') I'm a n3wb so, I'm fishing to see if I'm understanding the same :] -Frank On Dec 2, 2009, at 8:06 AM, saved...@gmail.com wrote: > Hello All! > I am trying to have my users post multiple books via > Inlineformset_factory. Basically, I am unable to do that > automatically via the following code without having them select their > name. I get an error saying that 'User has no attribute 'get''. Any > help is much appreciated. Ken > > models.py > = > class Author(models.Model): >name = models.CharField(max_length=100) >user = models.ForeignKey(User) > > class Book(models.Model): >author = models.ForeignKey(Author) >title = models.CharField(max_length=100) >user = models.ForeignKey(User) > > forms.py > > class AuthorForm(forms.ModelForm): >def __init__(self, user=None, *args, **kwargs): >self.user = user >super(AuthorForm, self).__init__(*args, **kwargs) > >class Meta: >model = Author > > BookFormSet = inlineformset_factory(Author, Book, extra=4, max_num=4, > can_delete=False, exclude ='user') > > > views.py > = > def add_books(request, author_id): >author = Author.objects.get(pk=author_id) >if request.method == "POST": >formset = BookFormSet(request.user, request.POST, > request.FILES, instance=author) >if formset.is_valid(): >books = formset.save(commit=False) >books.user = request.user >books.save() >else: >formset = BookFormSet(instance=author) >return render_to_response("manage_books.html", { >"formset": formset, >}) > > -- > > 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 this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-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-us...@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-users?hl=en.
Re: Help with installing MySQLdb package for Django on OS X Snow Leopard
To sum up (because I've been helping him off list too): It looks like he had old versions of setuptools and XCode (from OS X 10.4, running 10.6). I think once XCode gets upgraded, he should be OK... assuming MySQL is actually installed... As for ZMySQLDA: SourceForge features the most release of any project files, and that happens to be the latest one. I'm planning to spin off ZMySQLDA into a separate project, because I don't work on it any more; John EIkenberry is developing it now. On Wed, Dec 2, 2009 at 8:13 AM, Frank DiRoccowrote: > James, > > With Snow Leo and preinstalled MySQL5 the package I'm using is here. > http://sourceforge.net/projects/mysql-python/files/ > MySQL-python-1.2.3c1.tar.gz > > Direct Link: > http://sourceforge.net/projects/mysql-python/files/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz/download > > IMHO, source forge is a little wack these days. The UI is kinda > convoluted, it took me a little digging before I found the file too :] > > -Frank > > On Dec 2, 2009, at 7:18 AM, James Dekker wrote: > >> Daniel, >> >> Under the Files tab, the only ones that are available are for Linux >> not OS X Snow Leopard... >> >> -James >> >> On Wed, Dec 2, 2009 at 1:37 AM, Daniel Roseman >> wrote: >>> On Dec 1, 11:23 pm, James Dekker wrote: >>> My problem, however, is that I can't seem to figure out how to install the MySQLdb package for Python / Django? Downloaded the tar.gz from: http://sourceforge.net/projects/mysql-python/ >>> >>> The main 'Download Now' link from this page for some reason links to >>> the Zope adaptor. However you can click on 'View all files' to see >>> the >>> actual packages for MySQLdb. >>> >>> Of course if you're still having problems there's no requirement to >>> use MySQL in Django, you can just use sqlite3 which should work >>> without any additional requirements. >>> -- >>> DR. >>> >>> -- >>> >>> 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 this group, send email to >>> django-users+unsubscr...@googlegroups.com >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/django-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-us...@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-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-us...@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-users?hl=en. > > > -- Patriotism means to stand by the country. It does not mean to stand by the president. -- T. Roosevelt MANDATED GOVERNMENT HEALTH WARNING: Government mandates may be hazardous to your health. This message has been scanned for memes and dangerous content by MindScanner, and is believed to be unclean. -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django and Authorize.net
Greetings, We have an application for our school online, just recently the university controller and business office finally gave us clearance to accept our application fee online, and they setup an account with authorize.net. I'm trying to integrate the payment within our Application app, I was curious if anyone had done any one-off payments with Django/ authorize.net, or if there were and pluggable apps out there (I know Satchmo, that's my backup plan). Thanks, Chris -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Help with installing MySQLdb package for Django on OS X Snow Leopard
James, With Snow Leo and preinstalled MySQL5 the package I'm using is here. http://sourceforge.net/projects/mysql-python/files/ MySQL-python-1.2.3c1.tar.gz Direct Link: http://sourceforge.net/projects/mysql-python/files/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz/download IMHO, source forge is a little wack these days. The UI is kinda convoluted, it took me a little digging before I found the file too :] -Frank On Dec 2, 2009, at 7:18 AM, James Dekker wrote: > Daniel, > > Under the Files tab, the only ones that are available are for Linux > not OS X Snow Leopard... > > -James > > On Wed, Dec 2, 2009 at 1:37 AM, Daniel Roseman >wrote: >> On Dec 1, 11:23 pm, James Dekker wrote: >> >>> My problem, however, is that I can't seem to figure out how to >>> install the MySQLdb package for Python / Django? >>> >>> Downloaded the tar.gz from: >>> >>> http://sourceforge.net/projects/mysql-python/ >> >> The main 'Download Now' link from this page for some reason links to >> the Zope adaptor. However you can click on 'View all files' to see >> the >> actual packages for MySQLdb. >> >> Of course if you're still having problems there's no requirement to >> use MySQL in Django, you can just use sqlite3 which should work >> without any additional requirements. >> -- >> DR. >> >> -- >> >> 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 this group, send email to >> django-users+unsubscr...@googlegroups.com >> . >> For more options, visit this group at >> http://groups.google.com/group/django-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-us...@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-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-us...@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-users?hl=en.
Re: Help with installing MySQLdb package for Django on OS X Snow Leopard
On Dec 2, 12:18 pm, James Dekkerwrote: > Daniel, > > Under the Files tab, the only ones that are available are for Linux > not OS X Snow Leopard... > > -James No, they're not 'for' anything. They're source code, which you compile on your platform. Here's the link to the page: http://sourceforge.net/projects/mysql-python/files/ and here's the direct link to the file you want: http://sourceforge.net/projects/mysql-python/files/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz/download -- DR. -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Inlineformset_factory and User model
Hello All! I am trying to have my users post multiple books via Inlineformset_factory. Basically, I am unable to do that automatically via the following code without having them select their name. I get an error saying that 'User has no attribute 'get''. Any help is much appreciated. Ken models.py = class Author(models.Model): name = models.CharField(max_length=100) user = models.ForeignKey(User) class Book(models.Model): author = models.ForeignKey(Author) title = models.CharField(max_length=100) user = models.ForeignKey(User) forms.py class AuthorForm(forms.ModelForm): def __init__(self, user=None, *args, **kwargs): self.user = user super(AuthorForm, self).__init__(*args, **kwargs) class Meta: model = Author BookFormSet = inlineformset_factory(Author, Book, extra=4, max_num=4, can_delete=False, exclude ='user') views.py = def add_books(request, author_id): author = Author.objects.get(pk=author_id) if request.method == "POST": formset = BookFormSet(request.user, request.POST, request.FILES, instance=author) if formset.is_valid(): books = formset.save(commit=False) books.user = request.user books.save() else: formset = BookFormSet(instance=author) return render_to_response("manage_books.html", { "formset": formset, }) -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Mod auth django available
Hello everyone, A small announcement about mod_auth_django. A small Apache module which let you authenticate Apache on the Django database. This module is intended for Apache instances not running on the Django server, but with access to the Django database. It is a small modification over mod_authn_dbd to use Django password format. Module page: http://bitbucket.org/kuon/mod_auth_django Regards Kuon smime.p7s Description: S/MIME cryptographic signature
Re: Help with installing MySQLdb package for Django on OS X Snow Leopard
Daniel, Under the Files tab, the only ones that are available are for Linux not OS X Snow Leopard... -James On Wed, Dec 2, 2009 at 1:37 AM, Daniel Rosemanwrote: > On Dec 1, 11:23 pm, James Dekker wrote: > >> My problem, however, is that I can't seem to figure out how to install the >> MySQLdb package for Python / Django? >> >> Downloaded the tar.gz from: >> >> http://sourceforge.net/projects/mysql-python/ > > The main 'Download Now' link from this page for some reason links to > the Zope adaptor. However you can click on 'View all files' to see the > actual packages for MySQLdb. > > Of course if you're still having problems there's no requirement to > use MySQL in Django, you can just use sqlite3 which should work > without any additional requirements. > -- > DR. > > -- > > 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 this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-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-us...@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-users?hl=en.
Re: MySQL error 1406 while running syncdb
Wiadomość napisana w dniu 2009-12-02, o godz. 11:30, przez chefsmart: > Hi, I'm am getting MySQL error 1406 while running syncdb. (See link > http://pastebin.org/59605) > > This happens after I create the superuser. > > The error says _mysql_exceptions.DataError: (1406, "Data too long for > column 'name' at row 1") > > I am not doing any pre-population of data. So I checked the tables > whose names start with "django_" and columns called "name" appear for > the django_content_type table and the django_site tables. The former > is varchar(100) and the latter is varchar(50). > > I am definitely safe as far as the django_site table is concerned. And > I am also safe with the django_content_type table so I'm not sure why > this is happening. > > Where does Django populate the django_content_type.name column from? I > am guessing it would take the model name or the verbose_name if > supplied. > > All my models are named well within the varchar(100) limit. > > Any idea what is going on? By the way, I'm also using contrib.auth. Here's the culprit: File "D:\Python25\lib\site-packages\django\contrib\auth\management \__init__.py", line 28, in create_permissions defaults={'name': name, 'content_type': ctype}) Do you have any custom-defined permissions for your models? -- Artificial intelligence stands no chance against natural stupidity Jarek Zgoda, R, Redefine jarek.zg...@redefine.pl -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
MySQL error 1406 while running syncdb
Hi, I'm am getting MySQL error 1406 while running syncdb. (See link http://pastebin.org/59605) This happens after I create the superuser. The error says _mysql_exceptions.DataError: (1406, "Data too long for column 'name' at row 1") I am not doing any pre-population of data. So I checked the tables whose names start with "django_" and columns called "name" appear for the django_content_type table and the django_site tables. The former is varchar(100) and the latter is varchar(50). I am definitely safe as far as the django_site table is concerned. And I am also safe with the django_content_type table so I'm not sure why this is happening. Where does Django populate the django_content_type.name column from? I am guessing it would take the model name or the verbose_name if supplied. All my models are named well within the varchar(100) limit. Any idea what is going on? By the way, I'm also using contrib.auth. Regards. -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django not finding modules on pythonpath
On Dec 2, 4:53 pm, neridajwrote: > I have a few novice user questions: > > 1. If I installed apache2 with prefork do I need to uninstall in order > to change to worker? Uninstall what? Apache or mod_wsgi? Also, what you need to do really depends on how you installed both, whether from source code yourself or from binary packages. Too hard to say as have no idea. If binary packages, follow your Linux distributions documentation or use their tools appropriately. > 2. If I add the following lines to my vhost definition does this make > mod_wsgi run in daemon mode? > > WSGIDaemonProcess mysite.com processes=1 threads=5 display-name=% > {GROUP} > WSGIProcessGroup mysite.com Don't use 'processes=1' as it defaults to one process if that option isn't set and setting has certain implications. That is explained in description of that option in documentation I directed you to last time. Read that documentation again as well as: http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide > 3. What is the syntax for adding the value of PYTHONPATH to the python- > path= option? The documentation I referred you to last time describes what it should be in the section related to that option. Specifically, colon separated list of directories, exactly like PYTHONPATH user environment variable. I even said to use exact same value as used for PYTHONPATH in past post. > 4. What is the syntax for adding the python-path option to > apache2.conf? How is this question different to (3). Also perhaps read: http://code.google.com/p/modwsgi/wiki/VirtualEnvironments if you want to know more about setting Python module search path. If you are a novice as you say, then try and endeavour to read documentation you are referred to and also look at what other documentation exists on that site, starting at: http://code.google.com/p/modwsgi/wiki/InstallationInstructions Graham > > J > On Dec 1, 5:22 pm, Graham Dumpleton > wrote: > > > > > On Dec 2, 12:02 pm, neridaj wrote: > > > > During development I had my project apps in the same directory that > > > django-admin.py startproject mysite created. I would now like to have > > > my apps in a global directory, django-apps, to be used in other > > > projects. I thought this was what the PYTHONPATH environment variable > > > was for, do I need to add every PYTHONPATH module directory > > > from .profile to mysite.wsgi? > > > Any directories listed in PYTHONPATH environment variable of user when > > running django-admin.py, must be individually added to 'sys.path' in > > the WSGI script file. > > > Alternatively, take what you have in PYTHONPATH and use that same > > value to define WSGIPythonPath directive if using mod_wsgi embedded > > mode, or the python-path option to WSGIDaemonProcess if using mod_wsgi > > daemon mode. For information about the latter two directives see: > > > http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPyt... > > http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDae... > > > Do note that by doing it in WSGI script file, only applies to that > > Django instance. If done in Apache configuration, applies to all > > Django instances running in embedded mode or that daemon mode process > > group, as appropriate for way configured. > > > As such, setting these in WSGI script file is better if they relate > > only to a specific Django instance. > > > Graham > > > > On Dec 1, 3:03 pm, Graham Dumpleton > > > wrote: > > > > > Have a read of: > > > > >http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango > > > > > In particular where it says: > > > > > """ > > > > If you have been using the Django development server and have made use > > > > of the fact that it is possible when doing explicit imports, or when > > > > referencing modules in 'urls.py', to leave out the name of the site > > > > and use a relative module path, you will also need to add to sys.path > > > > the path to the site package directory itself. > > > > > sys.path.append('/usr/local/django') > > > > sys.path.append('/usr/local/django/mysite') > > > > > In other words, you would have the path to the directory containing > > > > the 'settings.py' file created by 'django-admin.py startproject', as > > > > well as the parent directory of that directory, as originally added > > > > above. > > > > > Note that it is not recommended to be setting 'DJANGO_SETTINGS_MODULE' > > > > to be 'settings' and only listing the path to the directory containing > > > > the 'settings.py' file. This is because such a setup will not mirror > > > > properly how the Django development server works and everything may > > > > not work as expected. > > > > """ > > > > > You have only added the path to the parent directory and not the path > > > > of the directory containing the settings.py file. Your use of relative > > > > modules references within the site package may
Re: Is there any way to make USStateField() to not have a pre-selected value?
2009/12/2 Continuation: > I use USStateField() from localflavor in one of my models: > > class MyClass(models.Model): > state = USStateField(blank=True) > > Then I made a form from that class: > > class MyClassForm(forms.ModelForm): > class Meta: > model = MyClass > > When I display the form, the field "State" is a drop-down box with > "Alabama" pre-selected. > > Is there any way to make the drop-down box to show no pre-selected > value at all? > > -- > > 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 this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > Maybe using default as argument to your field? http://docs.djangoproject.com/en/dev/ref/models/fields/#default -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Help with installing MySQLdb package for Django on OS X Snow Leopard
On Dec 1, 11:23 pm, James Dekkerwrote: > My problem, however, is that I can't seem to figure out how to install the > MySQLdb package for Python / Django? > > Downloaded the tar.gz from: > > http://sourceforge.net/projects/mysql-python/ The main 'Download Now' link from this page for some reason links to the Zope adaptor. However you can click on 'View all files' to see the actual packages for MySQLdb. Of course if you're still having problems there's no requirement to use MySQL in Django, you can just use sqlite3 which should work without any additional requirements. -- DR. -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Trouble with Pythonpath and getting my server to start
2009/12/1 Dave: > Hi all, > > I created a django project and when I try to start the server I get > this: > > Traceback (most recent call last): > File "manage.py", line 2, in > from django.core.management import execute_manager > ImportError: No module named django.core.management > > I did some Googling and I think it's because I got an error when > trying to create a symlink in the installation instructions: > > "Next, make sure that the Python interpreter can load Django's code. > There are various ways of accomplishing this. One of the most > convenient, on Linux, Mac OSX or other Unix-like systems, is to use a > symbolic link: > > ln -s `pwd`/django-trunk/django SITE-PACKAGES-DIR/django" > > I changed SITE-PACKAGES-DIR to my directory and got this error: > > $ ln -s `pwd`/django-trunk/django /Library/Frameworks/Python.framework/ > Versions/2.6/lib/python2.6/site-packages/django > ln: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ > site-packages/django: File exists > > I'm not sure what it means by "file exists". The other option was > changing the Pythonpath to include the Django directory, but I'm not > sure how to do that. Answers on Google didn't make sense to me or > didn't seem to apply. Any help would be greatly appreciated! > > -- > > 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 this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > My first guess would be that destination file exists and `ln` doesn't want to overwrite the file First try moving file or directory named "django" from site-packages somewhere else and then try to link again. $ mv /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django /tmp/DJANGO_TMP $ ln -s `pwd`/django-trunk/django /Library/Frameworks/Python.framework/ Davor -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.