Re: Best Way to Organize Project With Overlapping Functionality

2015-08-10 Thread ringemup
Thank you, Mike, that’s helpful! On Aug 9, 2015, at 7:42 PM, Mike Dewhirst wrote: > On Monday, August 10, 2015 at 8:34:28 AM UTC+10, Nan wrote: > Hi everyone -- > > I'm building a project that allows users to create mailing lists. In order > to create a mailing list, you must first create a

Re: Generic Relation in Legacy Database?

2015-03-10 Thread ringemup
Thanks, Gergely — it’s actually Eloquent, which handles GFKs a little more similarly to Django than Doctrine does, AFAICT. Would you mind sharing your GFK changes-in-progress? Maybe we could collaborate on a broader solution. On Mar 10, 2015, at 3:30 PM, Gergely Polonkai wrote: > Hello, >

Re: Generic Relation in Legacy Database?

2015-03-10 Thread ringemup
Avraham, are you at all familiar with Django’s GenericForeignKey model field? It relies on *two* fields in the model. Django resolves a generic foreign key by looking up the content type (a FK to the content types table) to figure out what table to look for the object ID in. Then it looks f

Re: Admin URL validation too strict?

2011-02-10 Thread ringemup
and my admin accepts (and correctly validates it) the port > inside a URL. > > In django.core.validators.py you can see, that the port is accepted. > > On 10.02.2011, at 22:55, ringemup wrote: > > > > > Er, Correction > > > It's not an anchor that's caus

Re: Admin URL validation too strict?

2011-02-10 Thread ringemup
Er, Correction It's not an anchor that's causing problems, but a port specification -- e.g. http://www.example.com:81/example.html On Feb 10, 4:45 pm, ringemup wrote: > I've been trying to use the Django admin to moderate spam comments, > but it appears that the URL v

Admin URL validation too strict?

2011-02-10 Thread ringemup
I've been trying to use the Django admin to moderate spam comments, but it appears that the URL validation is stricter in the admin (i.e. in the default ModelForm) than in the comment posting form. Any URL with an anchor in it (i.e. http://www.example.com/example.html#whatever) passes validation f

Abstract Model Inheritance and Custom Managers?

2011-01-13 Thread ringemup
If a manager is defined on an abstract model, do non-abstract child models inherit the manager? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, s

Re: Having a tough time getting started with Django

2011-01-05 Thread ringemup
Check the capitalization of the word "models" in some of your model definitions. On Jan 5, 11:00 am, "Peter L. Berghold" wrote: > OK:  Trying to get a handle on getting started with Django and like I > always do when learning a new environment I've dived in head first. > > Here is an error messag

Re: What's your workflow?

2010-12-22 Thread ringemup
rting the shell. > But, for things like model lookups etc, I find it a great deal easier > than writing huge chunks of SELECT SQL. > > On 22/12/2010 22:12, ringemup wrote: > > >>      * If you want to test work flow, then try and make good use of the > >>        &qu

Re: What's your workflow?

2010-12-22 Thread ringemup
>     * If you want to test work flow, then try and make good use of the >       "manage.py shell" and also the ability to create management >       commands. This will allow you to quickly test code changes, >       without having to do app restarts, or going through login >       processes. Cal

Re: Where Are Forms Built

2010-12-22 Thread ringemup
> I've seen how to build my own forms in the documentation and how to > import the Django base forms class, but where does the code to build > my own screens get put? Is it supposed to be put in the views module > for my app or somewhere else? I'm guessing it goes in the views, but > that's only m

Re: Forms Questions

2010-12-22 Thread ringemup
> First do I have to code/generate my forms using my models? No. Model forms are basically a shortcut to the very common use case of creating a form to update or save a single model object. With regular forms, you just have to explicitly declare your form fields instead of counting on the modelf

Re: Confused about thread locals... again.

2010-12-15 Thread ringemup
I faced this problem, and ran into the issue that the request object is not passed to the template loader, so there's no way to get your domain from within a custom template loader without using threadlocals. What I did instead was as follows: 1) Write a custom render-to-response type function t

Re: When to use Form API

2010-12-08 Thread ringemup
This. Form processing is one of those tedious things 90% of which is the same in every form: field definition, display, validation, and error handling/presentation. Django takes care of the repetitive parts, and if you need to customize the validation or display, allows you to do so while still a

Re: Add Content from a Custom View to the Django Admin Change Form

2010-11-28 Thread ringemup
You can either create a custom widget and ModelAdmin.formfield_overrides [1] or (if you need to customize the data processing as well as the display, create a custom form and use ModelAdmin.form [2]. [1] http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.form

Re: Is there a way to create a new database table other than model?

2010-11-23 Thread ringemup
Perhaps there's another way to accomplish your goal. Why do you want a table for each game? On Nov 23, 5:14 am, vbs wrote: > Hi all, > > This is my situation, I want to make a web based game-hall. > I have a model named Game. When I add a new game from the admin panel, > a new record will be add

Re: I have an idea for a new tag

2010-11-20 Thread ringemup
Is there a reason you wouldn't do the sorting in the view before passing it to the template? On Nov 19, 11:55 am, Paweł Roman wrote: > When rendering dictionary, there is absolutely no way to display > values sorted by keys. The only workaround is to copy all the dict > items to a sortable struc

Re: arbitrary ordering in a model

2010-11-18 Thread ringemup
Grappelli now has a drag-n-drop sorting option, but it only works for inlines. On Nov 18, 1:11 pm, Daniel Carvalho wrote: > Hi > I have some models where I want objects to be displayed in an arbitrary > order. > > For that I have in the model a number field, which is used to sort. > class MyModel

Re: Generic Views - do you use them?

2010-11-09 Thread ringemup
I don't use them either for much the same reasons, and because I often end up using custom render_to_response shortcuts that set common context or handle custom template loading. Although the new class- based views may make them more customizable. I don't see much need for an alternative, though

Re: Multi-table Inheritance: How to add child to parent model?

2010-11-07 Thread ringemup
nt.save() > > [1]http://code.djangoproject.com/ticket/7623 > [2]http://code.djangoproject.com/ticket/11618 > > On Nov 4, 9:25 pm, ringemup wrote: > > > I have an existing model that I want to extend using multi-table > > inheritance.  I need to create a child instance

Re: Multi-table Inheritance: How to add child to parent model?

2010-11-07 Thread ringemup
ls.BooleanField() >   >   > This is abstract inheritance and any model inheriting Place will get a copy > of Place's fields onto the child object instead of getting another Table > placed there. >   > Michael  > > --- On Sat, 11/6/10, ringemup wrote: > >

Re: Multi-table Inheritance: How to add child to parent model?

2010-11-06 Thread ringemup
ls/one_to_one/ > > On 6 November 2010 14:47, ringemup wrote: > > > I can't find that example in this documentation [1].  Is there other > > documentation that I'm not aware of? > > > [1] > >http://docs.djangoproject.com/en/dev/topics/db/models/#multi-t

Re: Multi-table Inheritance: How to add child to parent model?

2010-11-06 Thread ringemup
On 5 November 2010 18:24, ringemup wrote: > > > **{} is sort of the inverse of **kwargs in a function signature -- > > it's a way to use a dictionary in place of keyword arguments, and > > should function identically. > > > Which "original example&qu

Re: Multi-table Inheritance: How to add child to parent model?

2010-11-05 Thread ringemup
gt; Pass the ID of the "parent" object as this object's ID. > > Are you sure that the place ID is, in fact, what is being transferred? > > On 5 November 2010 15:59, ringemup wrote: > > > I'm not trying to create a Restaurant without a name and address.  I'm

Re: Multi-table Inheritance: How to add child to parent model?

2010-11-05 Thread ringemup
ve > a name and address? > > On Nov 4, 10:25 pm, ringemup wrote: > > > I have an existing model that I want to extend using multi-table > > inheritance.  I need to create a child instance for each parent > > instance in the database, but I can't figure out ho

Multi-table Inheritance: How to add child to parent model?

2010-11-04 Thread ringemup
I have an existing model that I want to extend using multi-table inheritance. I need to create a child instance for each parent instance in the database, but I can't figure out how. I've scoured google and haven't come up with anything other than Ticket #7623[1]. Here are some of the things I've

Re: FormWizard and permission_required

2010-11-03 Thread ringemup
I use a wrapping view, rather like this: # urls.py (r'^my_url/?$', my_view, ...) # views.py @permission_required('some_permission') def my_view(request): return MyWizard([Step1, Step2, Step3, ...]) On Nov 3, 9:54 am, cootetom wrote: > Hi, > > When creating normal views I can decorate the v

Re: how to use tkinter widget in django

2010-10-26 Thread ringemup
Try the HTML5 . On some current browsers, it'll just appear as a text field, although you can supplement it with javascript. Moving forwards, as more browsers support HTML5 forms, it'll appear as a slider widget. See [1]. [1]http://diveintohtml5.org/forms.html#type-range On Oct 26, 7:17 am, j

[solved] Re: Can't uninstall debug toolbar?

2010-10-22 Thread ringemup
Never mind, restarting Apache did the trick, although I have no clue why that was necessary. On Oct 22, 1:01 pm, ringemup wrote: > For some reason, even though I've removed it from my INSTALLED_APPS > and MIDDLEWARE_CLASSES, and touched my wsgi file, the debug toolbar > just won&#

Can't uninstall debug toolbar?

2010-10-22 Thread ringemup
For some reason, even though I've removed it from my INSTALLED_APPS and MIDDLEWARE_CLASSES, and touched my wsgi file, the debug toolbar just won't go away. I'm sure I'm doing something remarkably stupid, but at this point can't fathom what that might be. Any ideas? Thanks! -- You received this

Re: moving from Postgres to MySQL

2010-10-22 Thread ringemup
Not spectacular, but mysqldump has flags that can increase the chances of portability, and one would hope pg_dumpall does too. I figured something like that might be worth a try before you write a custom migration script. On Oct 22, 2:58 am, Chris Withers wrote: > On 21/10/2010 15:40, ringe

Re: call more than one view action from an uri path?

2010-10-21 Thread ringemup
> You could try something like: > >     args = iter(args)    # may need args.__iter__() in earlier Pythons? >     for func in args: >         arg = next(args) # may need args.next() in earlier Pythons? >            ... > > >     if func in list_of_allowed_funcs: > >       func(arg) > >   return Ht

Re: call more than one view action from an uri path?

2010-10-21 Thread ringemup
Well, like I said, I haven't tested that particular regex. But it should be possible to write a regex that does work. If Django's dispatcher chokes on subpatterns, then just use the ^(.+)$ approach and split it yourself in the view, then iterate. Either way, you shouldn't have to call multiple f

Re: call more than one view action from an uri path?

2010-10-21 Thread ringemup
You can't do something like this? #urls.py #note: untested regex, but a regex should be able to do this url('^((\w+)/(\d+)/)+$', 'myview', ...) #views.py # note: this is pseudocode def myview(request, *args, **kwargs): # iterate through args two at a time for func, arg in args: if func in

Re: Spaces in request.GET

2010-10-21 Thread ringemup
try this: Unquoted attributes are invalid HTML, and your browser is probably treating the second half of the string as a separate attribute. On Oct 21, 9:24 am, Govindarajan wrote: > First off I have to say that I am new to django. I am trying to get a > value from drop down select in HTML p

Re: moving from Postgres to MySQL

2010-10-21 Thread ringemup
MySQL has a tool (mysqldump) that will output the contents of an entire database to a SQL file that can then be loaded directly into another database. Does Postgres not have anything analogous? On Oct 11, 8:58 am, Chris Withers wrote: > Hi All, > > I have an existing Django app with lots of da

Re: how safe is the template engine

2010-10-18 Thread ringemup
In addition to what Jonathan said, keep in mind that letting your users enter raw HTML opens your site up to XSS attacks, since userInput could contain javascript, and it won't be escaped if you just turn it directly into a template. You could render userInput into the template as a context variab

Re: Admin "Bulk Edit"?

2010-10-16 Thread ringemup
Does the list_editable feature not cover your use case? On Oct 16, 6:25 pm, Ted wrote: > Is there a way to enable bulk editing in the admin?  I'm looking for a > feature like PHPmyadmin's multiple record edit - click the boxes for > the items then they show up on the next page one after the other

Re: What is the best way to implement time-based / cronjob actions in a Django app?

2010-10-14 Thread ringemup
results can be checked on later by > task-id which can be easily stored in a plain django model.  We have built > several analytics and research compute clusters using celery and > django-celery. > > Best, > Brian > > > > On Wed, Oct 13, 2010 at 5:07 PM, ringemup wrote: &g

Re: What is the best way to implement time-based / cronjob actions in a Django app?

2010-10-13 Thread ringemup
at 4:11 PM, ringemup wrote: > > > > >> It's surprisingly easy to get set up with nothing more than the > >> tutorial/into for django-celery. If anyone has problems with it I'd be > >> happy to try to assist. > > > Thanks, I might take you u

Re: What is the best way to implement time-based / cronjob actions in a Django app?

2010-10-13 Thread ringemup
> It's surprisingly easy to get set up with nothing more than the tutorial/into > for django-celery. If anyone has problems with it I'd be happy to try to > assist. Thanks, I might take you up on that. > Although getting everything working is fairly easy, in my opinion the docs > aren't too c

Re: What is the best way to implement time-based / cronjob actions in a Django app?

2010-10-13 Thread ringemup
You can also use this technique[1] to create a python script that you can call from your crontab. Basically, you can call anything in Django from any Python script as long as you set the DJANGO_SETTINGS_MODULE environment variable first and have Django, your project, and your apps on your path.

Re: Custom validation in model formset

2010-10-11 Thread ringemup
try this... from django.forms import ValidationError ... for form in self.forms: ... raise ValidationError('whatever') On Oct 11, 1:32 pm, Duane Hilton wrote: > Changing forms to form brings a new error: > > *Exception Value: 'CandidateFeedForm' object has no attribute > 'Validation

Re: Migrating Groups of Permissions

2010-10-08 Thread ringemup
I've run afoul of this too, and would love to see a workable solution. On Oct 7, 1:21 pm, Dan Gentry wrote: > As I deploy my application into production, I haven't found a good way > to migrate the groups of permissions I have defined and tested in > development.  In fact, due to my poor typing

Re: treating different versions of website urls as one

2010-10-05 Thread ringemup
Part of your problem will be that there is no way to consistently determine whether the addresses are duplicate. In most cases, yes, www.example.com and example.com are the same site -- but in some they're not. Ditto for index.html, index.php, etc. (yes, I've seen sites where index.html and inde

Re: treating different versions of website urls as one

2010-10-05 Thread ringemup
Is this for request routing, or for data input processing? On Oct 5, 12:17 pm, harryos wrote: > hi > I am trying out a web app where it needs to process user given website > addresses .My problem is that ,I need to treat >  http://mysite.com,www.mysite.com, > mysite.com,www.mysite.com/index.html,

Is this safe? (django.utils.translation.activate)

2010-09-27 Thread ringemup
I picked up a tip on dynamic translation here: http://fseoane.net/blog/2009/django-change-language-settings-dynamically Basically, you import "activate" from django.utils.translation, and use that as necessary to change your active language on the fly (something I need to do in order to store use

select_template but return only template name?

2010-09-21 Thread ringemup
I've set up a theming system that relies on using select_template to find the correct template for each view, searching first the skin's template directory, then the theme's template directory, then the master template directory. (A "skin" in this case being mostly a stylesheet that applies a colo

Re: Multi-table + Abstract Model Inheritance

2010-09-18 Thread ringemup
Well, on the surface this works. I'm sure if anything unexpected happens I'll be back. On Sep 17, 8:34 am, ringemup wrote: > Sure, it's easy enough to find out if it works in a general sense -- > but I'm also concerned about running into subtle bugs down the road, &

Re: Multi-table + Abstract Model Inheritance

2010-09-17 Thread ringemup
Sure, it's easy enough to find out if it works in a general sense -- but I'm also concerned about running into subtle bugs down the road, and having to restructure my entire database as a result. On Sep 17, 4:15 am, bruno desthuilliers wrote: > On 16 sep, 22:11, ringemup wrote

Multi-table + Abstract Model Inheritance

2010-09-16 Thread ringemup
Is it possible for a model to inherit from an abstract model, which in turn inherits from a non-abstract model? Here's an example. In this case, the reason for using multi-table inheritance rather than an explicit one-to-one relation would be that the office addresses would be editable via office

Re: Initialize model's fields

2010-09-15 Thread ringemup
Your produce_string method is being run not just every time you create a new Mymodel, but every time you load an existing one from the database -- so it's overwriting your random strings on load. You'd probably do better producing the random strings in the save() method. On Sep 15, 12:35 pm, mar

Re: Admin / Login / "Permission Denied" Message Dilemma

2010-09-10 Thread ringemup
On a related note, the admin login screen doesn't seem to be willing to redirect users to a "next" destination outside the admin app, which means having two separate login screens for different purposes, which doesn't make any sense at all. On Sep 10, 5:12 pm, ringemup w

Admin / Login / "Permission Denied" Message Dilemma

2010-09-10 Thread ringemup
I'm a little frustrated trying to set up logins for my site. Using @permission_required, if a user is already logged in but doesn't have sufficient permissions for a particular view, they just get redirected to the login form, with no explanation. I can set up a custom login view that will give t

Re: custom file validation

2010-09-03 Thread ringemup
Two things going on here: 1) Validation that involves checking multiple fields should be done in the form's clean() method rather than its clean_FIELDNAME method. Not all fields are guaranteed to have been added to cleaned_data until you reach the clean() method. 2) Try using self.cleaned_data.

Re: Possible to do location detection?

2010-08-25 Thread ringemup
Unless most of your users will be on location-enabled mobile devices, automatic location detection is usually IP-based, so you'd need to find either a database or a service with an API to do lookups. On Aug 25, 3:37 am, Andy wrote: > I'd like to detect the location of each user and then set the d

Re: How to troubleshoot path and permission problems?

2010-08-23 Thread ringemup
Your server's error logs can also be informative. On Aug 23, 2:02 pm, Antoni Aloy wrote: > 2010/8/23 vishy : > > > Hi, > > > I am having issues with production server.Everything is running fine > > on my local development server.On production site(using apache), CSS > > files related to admin sec

Re: searching stackedinline fields via search_fields in admin

2010-08-22 Thread ringemup
To add a filter that works with a related field, you have to write a custom filterspec (which isn't really documented anywhere AFAIK). To add the search on the related fields you just need to do what I described above: class CarAdmin(admin.ModelAdmin) search_fields = ['model', 'radio_set__na

Re: Path mess

2010-08-20 Thread ringemup
You need your external program to do several things: 1) make sure django is on your PYTHONPATH (or within the Python script, on sys.path) 2) make sure your apps are also on the PYTHONPATH (or sys.path) 3) set the DJANGO_SETTINGS_MODULE environment variable in your shell or script Then you just i

Re: searching stackedinline fields via search_fields in admin

2010-08-20 Thread ringemup
The admin search isn't searching the ModelAdmin or Inline files, it's searching the fields from the model. You can search a ForeignKey's fields by listing 'foreignkeyfieldname__relatedmodelfieldname' in your search_fields. So for example if you had the following models: class Author(models.Model

[Really solved] Re: NoReverseMatch under mod_wsgi with custom admin.get_urls()

2010-08-19 Thread ringemup
docs. On Aug 19, 4:48 pm, ringemup wrote: > And on third review, it only solves the issue in the templates.  In > any view that is not an AdminSite method, this line throws a > NoReverseMatch error: > > rev = reverse('account_wizard', current_app='staff_admin'

Re: NoReverseMatch under mod_wsgi with custom admin.get_urls()

2010-08-19 Thread ringemup
And on third review, it only solves the issue in the templates. In any view that is not an AdminSite method, this line throws a NoReverseMatch error: rev = reverse('account_wizard', current_app='staff_admin') On Aug 19, 4:39 pm, ringemup wrote: > Never mind, namespacing

[Solved] Re: NoReverseMatch under mod_wsgi with custom admin.get_urls()

2010-08-19 Thread ringemup
Never mind, namespacing the reverse() calls and {% url %} tags seems to have fixed things. On Aug 19, 4:32 pm, ringemup wrote: > I'm using a custom admin.get_urls() method.  It was working flawlessly > on the development server, but now under mod_wsgi I'm getting > NoReverse

NoReverseMatch under mod_wsgi with custom admin.get_urls()

2010-08-19 Thread ringemup
I'm using a custom admin.get_urls() method. It was working flawlessly on the development server, but now under mod_wsgi I'm getting NoReverseMatch errors almost anywhere I try to reverse the URL patterns it adds (but not everywhere). Here's the method: class CustomAdminSite(AdminSite):

Re: Fixtures for Groups and Permissions

2010-08-19 Thread ringemup
How would you implement that for a contrib app? Model inheritance? Proxy models? On Aug 19, 4:12 pm, Shawn Milochik wrote: > It sounds like a job for natural keys. > > http://docs.djangoproject.com/en/dev/releases/1.2-alpha-1/#natural-ke... > > Shawn -- You received this message because you a

Fixtures for Groups and Permissions

2010-08-19 Thread ringemup
Since permissions are created with different IDs each time you install a project with syncdb, it's not possible to use fixtures to freeze usergroup permission. Is there any way to export Groups with assigned permissions that can be easily imported as part of the installation process? Thanks --

Re: Validation and dynamically extending ChoiceField choices

2010-08-17 Thread ringemup
od could check that the domain is > valid. > > Alex > On Aug 16, 1:39 pm, ringemup wrote: > > > I have a domain search form with two fields: a Textarea for inputting > > a list of domains to check, and a ChoiceField for selecting a domain > > based on suggestions. >

Validation and dynamically extending ChoiceField choices

2010-08-16 Thread ringemup
I have a domain search form with two fields: a Textarea for inputting a list of domains to check, and a ChoiceField for selecting a domain based on suggestions. The ChoiceField is required, and on the first submission is auto- populated with suggestions based on the domains listed in the textarea.

Re: save a values_list to a charfield

2010-07-27 Thread ringemup
', '.join(primary_ids) The fact that you're doing this with foreign keys, though, suggests to me that you may have a database normalization problem. On Jul 27, 3:26 pm, Nick wrote: > I am getting this to save but I can't get it to output properly > > it's outputting as [16L, 451L, 521L] for a l

Re: Many to many ajax widget for admin

2010-07-26 Thread ringemup
You might want to check out grappelli and its Related Lookups feature: http://code.google.com/p/django-grappelli/ On Jul 26, 4:30 pm, Sævar Öfjörð wrote: > Hi > > I have some models (Song and Author) that are related through an > intermediary model (Authorship) like this: > > class Song(models

Re: Look up model instance by id

2010-07-14 Thread ringemup
Try: directory.models.Entity.objects.get(pk=id) Which does pretty much the same thing as: directory.models.Entity.objects.filter(id__exact = id)[0] (note id__exact rather than id__equals) On Jul 14, 3:18 pm, Jonathan Hayward wrote: > How do I look up a model instance by id (its prim

Re: Mass Hosting on mod_wsgi?

2010-07-13 Thread ringemup
'm feeling confident about at least getting this running now. On Jul 13, 7:11 pm, Graham Dumpleton wrote: > On Jul 14, 3:05 am, ringemup wrote: > > > So it would work to just create a standard deployment for each > > VirtualHost, just specifying a different DJANGO_SETTIN

Re: Mass Hosting on mod_wsgi?

2010-07-13 Thread ringemup
So it would work to just create a standard deployment for each VirtualHost, just specifying a different DJANGO_SETTINGS_MODULE in each WSGI script? I should be able to get that working, as a fallback at worst. I've read the Django integration and Application Issues pages from the mod_wsgi docs,

Mass Hosting on mod_wsgi?

2010-07-12 Thread ringemup
Hi folks -- I'm planning on mass hosting a SaaS project built on Django, using Apache and mod_wsgi. There will be hundreds of domains running off a single copy of the project code; each domain has a different Site ID and settings file, and can have its own Virtual Host (I'm also willing to serve

Re: Smarter URLs

2010-07-07 Thread ringemup
Add a SlugField to the Page model, and populate it based on the title (this can be done automatically either via the admin's prepopulated_fields, or via a custom model save() method) class Page(models.Model): title = models.CharField(max_length=50) slug = models.SlugField() Then use a reg

Re: Is {% cycle ... as ... %} supposed to output a value?

2010-07-07 Thread ringemup
Elements with display:none sadly trigger the same bug. Looks like a custom tag may be in order. On Jul 7, 12:34 pm, Tom Evans wrote: > On Wed, Jul 7, 2010 at 5:25 PM, ringemup wrote: > > I guess that's a workaround.  It would be a bit less tricky if HTML > > comments in th

Re: Is {% cycle ... as ... %} supposed to output a value?

2010-07-07 Thread ringemup
I guess that's a workaround. It would be a bit less tricky if HTML comments in the wrong place didn't break output in IE6[1] (no, I can't drop IE 6 support yet). This behavior just seems odd to me, since other tags with an "as" option ( e.g. {% url ... as ... %}) do not output when they're called

Re: Is {% cycle ... as ... %} supposed to output a value?

2010-07-07 Thread ringemup
wrote: > This is the desired behavior. Until the loop is done it cycles the > given values you provided in your case 'a' 'b' and since the loop is > running 3 times it cycles back to 'a' again. > > Cheers, > Thusjanthan > > On Jul 7, 8:55 am, ringe

Re: Is {% cycle ... as ... %} supposed to output a value?

2010-07-07 Thread ringemup
Er, that was sloppy of me. Actual output: a a b b a a On Jul 7, 11:53 am, ringemup wrote: > I thought that {% cycle 'a' 'b' as mycycle %} was supposed to just set > the variable {{ mycycle }} and not output anything to the template. > > Howev

Is {% cycle ... as ... %} supposed to output a value?

2010-07-07 Thread ringemup
I thought that {% cycle 'a' 'b' as mycycle %} was supposed to just set the variable {{ mycycle }} and not output anything to the template. However, the following template (with myrange=[1, 2, 3]): {* start template *} {% for i in myrange %} {% cycle 'a' 'b' as mycycle %} {{ mycycle }}

Re: More than one primary key for a model

2010-06-29 Thread ringemup
m2m join it randomly pics one of the compounded keys and tries to > join them? :| Does the unique_together parameter fix that problem? as > in does it use the unique_together to do the joins? > > On Jun 28, 10:20 am, ringemup wrote: > > > By definition a database table can have o

Re: More than one primary key for a model

2010-06-28 Thread ringemup
By definition a database table can have only one primary key. I believe what you're looking to implement are compound primary keys. Depending on the database backend you're using, the unique_together Meta attribute may accomplish most of what you're looking to do. On Jun 28, 12:49 pm, thusjantha

Re: Admin Media output order?

2010-06-25 Thread ringemup
rs - Domain Referers > > Referers - Search Engine Referers > > Referers - URL Referers > > > It's the cleanest way I've found to do such a thing. > > > Cheers, > > Brenton > > > On Jun 25, 5:18 am, ringemup wrote: > > > > Is there any

Re: null=False, blank=True and errors saving in admin?

2010-06-24 Thread ringemup
6:22 pm, Karen Tracey wrote: > On Thu, Jun 24, 2010 at 5:40 PM, ringemup wrote: > > Upgrading from Django 1.0 to 1.2, I'm suddenly getting errors when > > creating objects in the admin form a class that essentially looks like > > this: > > > class MyObject(models.

null=False, blank=True and errors saving in admin?

2010-06-24 Thread ringemup
Upgrading from Django 1.0 to 1.2, I'm suddenly getting errors when creating objects in the admin form a class that essentially looks like this: class MyObject(models.Model): name = models.CharField(max_length=50) other_thing = models.ForeignKey(MyOtherModel, null=False, blank=True) def save

Admin Media output order?

2010-06-24 Thread ringemup
Is there any way to change the order in which admin media are output (e.g. outputting a ModelAdmin-level javascript after a widget-level script)? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django

HOW TO? multiple sites, one virtual host, routing settings.py?

2010-06-21 Thread ringemup
I'll soon be deploying a project that will need to be able to dynamically add domains. Each domain will have different users, separate data, and a different SITE_ID, but will all run off a single Django instance. The data will all be housed in a single database, since all domains' data will need

Admin Inlines, unique_together, and updates?

2010-06-08 Thread ringemup
Say I have a pair of classes roughly like so: class Parent(models.Model): name = models.CharField(maxlength=50) class Child(models.Model): parent = models.ForeignKey(Parent) name = models.CharField(maxlength=50) order = models.IntegerField() class Meta: unique_togethe

Re: Security Question...

2010-05-25 Thread ringemup
y. > > Alex > > > > On Tue, May 25, 2010 at 9:17 AM, ringemup wrote: > > > By app-level solution you mean some sort of custom encryption / > > decryption scheme for the data dictionaries? > > > I'm still not convinced the data needs encryption -- I mean, it

Re: Security Question...

2010-05-25 Thread ringemup
rsal. As I think about it, I > think it is normally browsers that whine about self-signed certs. > Maybe the other server wouldn't even mention it? Anyway, it'd be a lot > easier to setup an ssl cert than roll your own app level solution. > > Good luck! > Alex > >

Re: Security Question...

2010-05-24 Thread ringemup
self-signed security cert. It would be free and > protect your data. It won't show up as trusted to users, but your > other server can be set to accept it. (Assuming the lack of ssl is a > budget issue, that wouldn't fix a technical issue.) > > Alex > > On May 23, 10:

Security Question...

2010-05-23 Thread ringemup
Hi folks -- I'm putting together a simple API to allow a separately-hosted but trusted site to perform a very limited set of actions on my site. I'm wondering whether the design I've come up with is reasonably secure: - Other site gets an API key, which is actually in two parts, public key and p

What Happened to Sorl Curator?

2010-05-07 Thread ringemup
I'm about to dive into upgrading a project built about a year ago on Django 1.0, and was saddened to discover that one of its dependencies, Sorl Curator, appears to have been abandoned... Does anyone know what happened to it, or know of any alternative apps that would provide a straightforward upg

Re: Pass variable as view name to {% url %}

2009-11-17 Thread ringemup
Thanks for the links. On Nov 17, 7:56 pm, Karen Tracey wrote: > On Tue, Nov 17, 2009 at 7:33 PM, ringemup wrote: > > > It's really problematic to generate all the URLs (there are a lot of > > them) in the view and then retrieve the correct ones in the correct > >

Re: Pass variable as view name to {% url %}

2009-11-17 Thread ringemup
: > On Tue, Nov 17, 2009 at 7:05 PM, ringemup wrote: > > Is there any way to make the following work? Right now it's throwing > > a template syntax error, apparently treating "the_pattern" as a string > > literal instead of a variable name and looking for

Pass variable as view name to {% url %}

2009-11-17 Thread ringemup
Is there any way to make the following work? Right now it's throwing a template syntax error, apparently treating "the_pattern" as a string literal instead of a variable name and looking for a view named "the_pattern". [urls.py] urlpatterns = patterns('', (r'^(?P\s{1,8})/$', 'myapp.views.my_v

Re: when click ,the corresponding view function was called twice,why?

2009-10-17 Thread ringemup
I've had that problem when a stylesheet import in my document head used an empty string for the path -- the browser called the same URL as for the document in an attempt to import the stylesheet. On Oct 17, 11:59 am, hao he wrote: > with the follow code/config,one request lead to view functi

Re: When would you use Context instead of RequestContext?

2009-10-15 Thread ringemup
You have a point. Then again, Django does have a wiki, which is a good place for suggestions to be annotated with a discussion of the pros and cons of a particular approach. On Oct 15, 6:13 pm, bruno desthuilliers wrote: > > who is going to decide which are "best" practices ?-) --~--~-

Re: When would you use Context instead of RequestContext?

2009-10-15 Thread ringemup
I don't think I've seen the two-function technique used much, if at all. I'd certainly find it beneficial if more of the pluggables I use took that approach. I wonder if a central repository of information about best practices would benefit the community? On Oct 15, 3:40 am, bruno desthuillie

When would you use Context instead of RequestContext?

2009-10-14 Thread ringemup
Is there ever a reason to pass a plain Context rather than a RequestContext when rendering a template? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-

  1   2   3   >