Re: how to “break” from a regex in urlconf

2012-08-27 Thread Melvyn Sopacua
On 27-8-2012 4:14, Matthew Meyer wrote:

> So the question: Is there a way I can keep the flexible tag regex redirect 
> behavior but then "break" from it once I reach a product page? One 
> important thing to note is that I want to keep the product page within the 
> built up url scheme like: mens/shirts/buttonups/shirt-product/

The first thing to note is that you need to get "redirect" and "break
out" out of your vocabulary. While Django's urlconfs look and walk like
rewrite engines, they are not rewrite engines. The primary difference is
that matches are handled in order and the first match wins, so there is
no "break out" principle.
Since a slug and a tag in your matches consist of identical character
classes there is no way to differentiate between one or the other. The
easy solution and one that is in line with the semantics of URLs is to
drop the trailing slash for the product.
"Back in the day" trailing slashes meant "directory listings" and no
trailing slash referred to "document requests" and this applies to your
scheme also. So your product url becomes:
url(r'^(?P.+)/(?P[-\w]+)$', 'product_page'),
-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django development running on 127.0.0.1:8000 not accessible from same machine

2012-08-27 Thread nav
Dear Folks,

I am running my django development server on 127.0.0.1:8000 and accessing 
this address from my web browser on the same machine. In the past few days 
I have found thet the web browsers keep prepending the address with "www." 
when using the above address. 127.0.0.1 without the prot number works fine 
but the django development server requires a port number.

I have not encountered this problem before and am puzzled by what is 
happening. I am working on a Kubuntu 12.04 linux box and my /etc/hosts/ 
file is below if that helps:


127.0.0.1   localhost
127.0.1.1   

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


TIA
Cheers,
nav

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/EZzlz6iQOGoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Column widths in TabularInline

2012-08-27 Thread Mike Dewhirst

On 27/08/2012 4:34pm, Vikas Rawal wrote:

There is a field in my model called "name". What do I give in the css
file to reduce its width to say 100px?


This is css rather than Django but this is what I did to make my
input field wider ...

.wider .vTextField {
 width: 60em !important;
}

If you view source in your browser you should see input elements
with class="vTextField" among others depending on the type of
element.

However, you should also see that each field has its own
id="whatever" so you can address each field individually in your css
file using #whatever .vTextField {...}.


The problem is that the #id is different for each row of the tabular
inline object.

it takes the form

id="id_member_set-0-name" for the first row, id="id_member_set-1-name"
for the second row, etc.

Therefore #whatever does not work. Is there a way of using regex or
something like that to cover all the above formulations of "id".


Ok - I thought you wanted to address each one individually. If you 
search django snippets for your precise requirements I'm sure something 
will pop up. I haven't needed to do what you appear to need so I have no 
relevant experience there.


Cheers

Mike





Vikas



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: expand fieldset by choice

2012-08-27 Thread Axel Rau
To clarify:
--- from admin.py:
class MailboxAdmin(admin.ModelAdmin):
list_display = ('localpart', 'localdomainfk', 'type', 
'aliastargetaddresses', 'created', 'updated')
fieldsets = (
(None, {
'fields': (('localpart', 'localdomainfk'), 'accountfk', 
'lifetime', 'type')
}),
(_('Mailbox'), {
'classes': ('collapse',),
'fields': ('aoxuserid', 'quota')
}),
(_('Alias'), {
'classes': ('collapse',),
'fields': ('aliastargetaddresses',)
}),
(None, {
'fields': ('remarks',)
})
)

...
admin.site.register(Mailbox, MailboxAdmin)

--- from models.py:
class Mailbox(models.Model):
id = models.AutoField(primary_key=True)
localpart = models.CharField(_('Localpart'), max_length=40)
localdomainfk = models.ForeignKey(Localdomain,  
verbose_name=_('Domainteil'), db_column='localdomainfk')
accountfk = models.ForeignKey(Account, db_column='accountfk')
aoxuserid = models.IntegerField(_('IMAP Server User ID'), null=True, 
blank=True)
serverpassword = NULLCharFieldM(_('Server Password'), null=True, 
blank=True, max_length=40)
quota = models.PositiveSmallIntegerField(_('IMAP Server Quota'),null=True, 
blank=True)
type = models.CharField('Typ', max_length=1, choices=
(('A', _('Alias')), ('M', _('Mailbox')), ('S', _('Systemalias'
aliastargetaddresses = NULLCharFieldM(_('Alias Targetaddress'),null=True, 
blank=True, max_length=60)
status = models.CharField(_('Status'), max_length=1, choices=
(('N', _('New')), ('E', _('Enabled')), ('L', _('Locked')), ('D', 
_('Disabled')), ('C', _('Closed'))),
default='N')
created = models.DateField(_('Created'), auto_now_add=True)
updated = models.DateField(_('Updated'), auto_now=True)
remarks = models.TextField(_('Remarks'),null=True, blank=True)
lifetime = TimedeltaDayFieldM(_('Lifetime of Data'), max_length=10)
class Meta:
db_table = u'mailbox'
verbose_name = _('Mailbox')
verbose_name_plural = _('Mailboxes')
ordering = ['localpart']
unique_together = ('localpart', 'localdomainfk')
def __unicode__(self):
return self.localpart+'@'+self.localdomainfk.name
---
If the user selects 'Alias' or 'Systemalias' in the type choice, I would like 
to see the 'Alias' fieldset expanded.
If he selects 'Mailbox', the fieldset 'Mailbox'.

How can I do this in admin site?

Axel

Am 27.08.2012 um 01:11 schrieb Nicolas Emiliani:

> On Sun, Aug 26, 2012 at 5:03 PM, Axel Rau  wrote:
> 
>> In my admin site, I have a fieldset which depends on a choice.
>> I would like to control expansion of the related fieldset by the choice
>> instead of the standard widgets.
>> How can I do this?
>> 
> 
> I don't understand clearly what you want, but, correct me if I'm wrong, you
> have some field and by doing something on it, maybe selecting it ? you want
> to something else on some other fields, maybe show/hide them ?
> 
> If this is what you are looking for, you could use javascript to do the
> magic, you can tell the admin form to use a specific js script and u can
> even generate that js dynamically.
> 
> If this is not helpful please be more specific.
> 
> 
> 
>> Axel
>> ---
>> PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius
>> 
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>> 
>> 
> 
> 
> -- 
> Nicolas Emiliani
> 
> Lo unico instantaneo en la vida es el cafe, y es bien feo.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

---
PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Ecommerce Solution

2012-08-27 Thread Swaroop Shankar V
Hi Alec,
Cartridge is the one you mean I guess, but after going through the document
it seems i will require to install Mezzanine too. I was looking for an app
which i can use with my existing project and also with some good
documentation.

Thanks and Regards,
Swaroop Shankar V



On Mon, Aug 27, 2012 at 2:37 AM, Alec Taylor  wrote:

> Mezzanine?
>
> On Mon, Aug 27, 2012 at 6:03 AM, Swaroop Shankar V 
> wrote:
> > Hi All,
> > Previously I had asked similar question on this group and decided to go
> with
> > Satchmo. After the implementation it turned out to be bit difficult to
> > maintain since the system do not provide much plugin or customization
> > support. So am thinking of implementing another ecommerce solution. The
> > system am looking for is an app which I can use with my existing site.
> Also
> > It would be better if the system would support a mechanism to migrate the
> > existing data from satchmo. I checked few but almost every project lacks
> > proper documentation. So is there any django ecommerce project that have
> > good documentation and easy to integrate?
> >
> > Thanks and Regards,
> >
> > Swaroop Shankar V
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-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-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Ecommerce Solution

2012-08-27 Thread Alec Taylor
Well there's Django-Shop

On Mon, Aug 27, 2012 at 8:38 PM, Swaroop Shankar V  wrote:
> Hi Alec,
> Cartridge is the one you mean I guess, but after going through the document
> it seems i will require to install Mezzanine too. I was looking for an app
> which i can use with my existing project and also with some good
> documentation.
>
> Thanks and Regards,
> Swaroop Shankar V
>
>
>
> On Mon, Aug 27, 2012 at 2:37 AM, Alec Taylor  wrote:
>>
>> Mezzanine?
>>
>> On Mon, Aug 27, 2012 at 6:03 AM, Swaroop Shankar V 
>> wrote:
>> > Hi All,
>> > Previously I had asked similar question on this group and decided to go
>> > with
>> > Satchmo. After the implementation it turned out to be bit difficult to
>> > maintain since the system do not provide much plugin or customization
>> > support. So am thinking of implementing another ecommerce solution. The
>> > system am looking for is an app which I can use with my existing site.
>> > Also
>> > It would be better if the system would support a mechanism to migrate
>> > the
>> > existing data from satchmo. I checked few but almost every project lacks
>> > proper documentation. So is there any django ecommerce project that have
>> > good documentation and easy to integrate?
>> >
>> > Thanks and Regards,
>> >
>> > Swaroop Shankar V
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-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-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django - change select items display

2012-08-27 Thread jm
hi

do you solved it ? I'm looking for the same and do not find anything to 
change which column is used in the SELECT instead of __unicode__

thanks

jm

Le mercredi 20 juillet 2011 00:16:06 UTC+2, galgal a écrit :
>
> I use ModelForm. One of fields is:
>
> repertoire = models.ForeignKey(Repertoire)
>
> I need to change it's display type. Instead of using *unicode* in display 
> I want to show name and date of repertoire. How in ModelForm I can do that?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/gbAncWxkSL4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django - change select items display

2012-08-27 Thread Jani Tiainen

27.8.2012 12:11, jm kirjoitti:

hi

do you solved it ? I'm looking for the same and do not find anything to
change which column is used in the SELECT instead of __unicode__

thanks

jm

Le mercredi 20 juillet 2011 00:16:06 UTC+2, galgal a écrit :

I use ModelForm. One of fields is:

|repertoire=  models.ForeignKey(Repertoire)
|

I need to change it's display type. Instead of using *unicode* in
display I want to show name and date of repertoire. How in ModelForm
I can do that?

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/gbAncWxkSL4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


You can change it by creating custom field and overriding 
label_from_instance method.


It's documented just below 
https://docs.djangoproject.com/en/1.3//ref/forms/fields/#django.forms.ModelChoiceField.empty_label


HTH,

--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to “break” from a regex in urlconf

2012-08-27 Thread Matthew Meyer
Fantastic solution, thank you so much. I will be sure to loose those 
phrases from my vocab as well :)

On Monday, August 27, 2012 3:18:52 AM UTC-4, Melvyn Sopacua wrote:
>
> On 27-8-2012 4:14, Matthew Meyer wrote: 
>
> > So the question: Is there a way I can keep the flexible tag regex 
> redirect 
> > behavior but then "break" from it once I reach a product page? One 
> > important thing to note is that I want to keep the product page within 
> the 
> > built up url scheme like: mens/shirts/buttonups/shirt-product/ 
>
> The first thing to note is that you need to get "redirect" and "break 
> out" out of your vocabulary. While Django's urlconfs look and walk like 
> rewrite engines, they are not rewrite engines. The primary difference is 
> that matches are handled in order and the first match wins, so there is 
> no "break out" principle. 
> Since a slug and a tag in your matches consist of identical character 
> classes there is no way to differentiate between one or the other. The 
> easy solution and one that is in line with the semantics of URLs is to 
> drop the trailing slash for the product. 
> "Back in the day" trailing slashes meant "directory listings" and no 
> trailing slash referred to "document requests" and this applies to your 
> scheme also. So your product url becomes: 
> url(r'^(?P.+)/(?P[-\w]+)$', 'product_page'), 
> -- 
> Melvyn Sopacua 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/FiWEJMZ7PHoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django development running on 127.0.0.1:8000 not accessible from same machine

2012-08-27 Thread Anton Baklanov
try running dev server with command like "./manage.py runserver 0.0.0.0:8000"
- 0.0.0.0 means that socket will listen for connections on all interfaces.
other people in your network will be able to connect your box using your ip.

if this does not help - show us output of 'sudo iptables-save' and 'sudo
ifconfig'

On Mon, Aug 27, 2012 at 10:53 AM, nav  wrote:

> Dear Folks,
>
> I am running my django development server on 127.0.0.1:8000 and accessing
> this address from my web browser on the same machine. In the past few days
> I have found thet the web browsers keep prepending the address with "www."
> when using the above address. 127.0.0.1 without the prot number works fine
> but the django development server requires a port number.
>
> I have not encountered this problem before and am puzzled by what is
> happening. I am working on a Kubuntu 12.04 linux box and my /etc/hosts/
> file is below if that helps:
>
> 
> 127.0.0.1   localhost
> 127.0.1.1   
>
> # The following lines are desirable for IPv6 capable hosts
> ::1 ip6-localhost ip6-loopback
> fe00::0 ip6-localnet
> ff00::0 ip6-mcastprefix
> ff02::1 ip6-allnodes
> ff02::2 ip6-allrouters
> 
>
> TIA
> Cheers,
> nav
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/EZzlz6iQOGoJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards,
Anton Baklanov

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django development running on 127.0.0.1:8000 not accessible from same machine

2012-08-27 Thread Anton Baklanov
oh, i misunderstood your question.

try to type url with schema into browser's address bar. i mean, use '
http://localhost:8000/' instead of 'localhost:8000'.
also it's possible that some browser extension does this, try disabling
them all.

On Mon, Aug 27, 2012 at 10:53 AM, nav  wrote:

> Dear Folks,
>
> I am running my django development server on 127.0.0.1:8000 and accessing
> this address from my web browser on the same machine. In the past few days
> I have found thet the web browsers keep prepending the address with "www."
> when using the above address. 127.0.0.1 without the prot number works fine
> but the django development server requires a port number.
>
> I have not encountered this problem before and am puzzled by what is
> happening. I am working on a Kubuntu 12.04 linux box and my /etc/hosts/
> file is below if that helps:
>
> 
> 127.0.0.1   localhost
> 127.0.1.1   
>
> # The following lines are desirable for IPv6 capable hosts
> ::1 ip6-localhost ip6-loopback
> fe00::0 ip6-localnet
> ff00::0 ip6-mcastprefix
> ff02::1 ip6-allnodes
> ff02::2 ip6-allrouters
> 
>
> TIA
> Cheers,
> nav
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/EZzlz6iQOGoJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards,
Anton Baklanov

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: widget construction issue

2012-08-27 Thread Nicolas Emiliani
On Mon, Aug 27, 2012 at 3:54 AM, Melvyn Sopacua wrote:

> On 27-8-2012 1:21, Nicolas Emiliani wrote:
>
> > The thing is that the GridWidget.__init__ method does not get executed
> > each time I access the form that contains it, so if the queryset changes
> the
> > widget gets 'obsolete'.
>
> That's because the widget is merely the piece that get rendered. It's
> driven by the form field and the form field should be the one managing
> the available choices.
>
>
I see ... since the field also has the queryset I can make it reload the
multi widget
_widgets and that should fix it, that way responsibilities seem to be
pretty clear to.

Thanks!


> --
> Melvyn Sopacua
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Column widths in TabularInline

2012-08-27 Thread Nicolas Emiliani
On Mon, Aug 27, 2012 at 3:34 AM, Vikas Rawal <
vikasli...@agrarianresearch.org> wrote:

> > >There is a field in my model called "name". What do I give in the css
> > >file to reduce its width to say 100px?
> >
> > This is css rather than Django but this is what I did to make my
> > input field wider ...
> >
> > .wider .vTextField {
> > width: 60em !important;
> > }
> >
> > If you view source in your browser you should see input elements
> > with class="vTextField" among others depending on the type of
> > element.
> >
> > However, you should also see that each field has its own
> > id="whatever" so you can address each field individually in your css
> > file using #whatever .vTextField {...}.
>
> The problem is that the #id is different for each row of the tabular
> inline object.
>
> it takes the form
>
> id="id_member_set-0-name" for the first row, id="id_member_set-1-name"
> for the second row, etc.
>
> Therefore #whatever does not work. Is there a way of using regex or
> something like that to cover all the above formulations of "id".
>
>
Yes there is, but this is no django thing you are asking, using jquery you
can accomplish that :

http://api.jquery.com/attribute-starts-with-selector/

 jQuery('[id^=id_member_set]').each(so_stuff)

Check the web, there is a __LOT__ of info on this.

Vikas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: expand fieldset by choice

2012-08-27 Thread Nicolas Emiliani
On Mon, Aug 27, 2012 at 6:36 AM, Axel Rau  wrote:

> To clarify:
> --- from admin.py:
> class MailboxAdmin(admin.ModelAdmin):
> list_display = ('localpart', 'localdomainfk', 'type',
> 'aliastargetaddresses', 'created', 'updated')
> fieldsets = (
> (None, {
> 'fields': (('localpart', 'localdomainfk'),
> 'accountfk', 'lifetime', 'type')
> }),
> (_('Mailbox'), {
> 'classes': ('collapse',),
> 'fields': ('aoxuserid', 'quota')
> }),
> (_('Alias'), {
> 'classes': ('collapse',),
> 'fields': ('aliastargetaddresses',)
> }),
> (None, {
> 'fields': ('remarks',)
> })
> )
>
> ...
> admin.site.register(Mailbox, MailboxAdmin)
>
> --- from models.py:
> class Mailbox(models.Model):
> id = models.AutoField(primary_key=True)
> localpart = models.CharField(_('Localpart'), max_length=40)
> localdomainfk = models.ForeignKey(Localdomain,
>  verbose_name=_('Domainteil'), db_column='localdomainfk')
> accountfk = models.ForeignKey(Account, db_column='accountfk')
> aoxuserid = models.IntegerField(_('IMAP Server User ID'), null=True,
> blank=True)
> serverpassword = NULLCharFieldM(_('Server Password'), null=True,
> blank=True, max_length=40)
> quota = models.PositiveSmallIntegerField(_('IMAP Server
> Quota'),null=True, blank=True)
> type = models.CharField('Typ', max_length=1, choices=
> (('A', _('Alias')), ('M', _('Mailbox')), ('S', _('Systemalias'
> aliastargetaddresses = NULLCharFieldM(_('Alias
> Targetaddress'),null=True, blank=True, max_length=60)
> status = models.CharField(_('Status'), max_length=1, choices=
> (('N', _('New')), ('E', _('Enabled')), ('L', _('Locked')), ('D',
> _('Disabled')), ('C', _('Closed'))),
> default='N')
> created = models.DateField(_('Created'), auto_now_add=True)
> updated = models.DateField(_('Updated'), auto_now=True)
> remarks = models.TextField(_('Remarks'),null=True, blank=True)
> lifetime = TimedeltaDayFieldM(_('Lifetime of Data'), max_length=10)
> class Meta:
> db_table = u'mailbox'
> verbose_name = _('Mailbox')
> verbose_name_plural = _('Mailboxes')
> ordering = ['localpart']
> unique_together = ('localpart', 'localdomainfk')
> def __unicode__(self):
> return self.localpart+'@'+self.localdomainfk.name
> ---
> If the user selects 'Alias' or 'Systemalias' in the type choice, I would
> like to see the 'Alias' fieldset expanded.
> If he selects 'Mailbox', the fieldset 'Mailbox'.
>
> How can I do this in admin site?


Through JS, you need to implement a script that binds to the change event
and then changes the collapse css call for the specific div. You may want
to look
at jQuery, although this is out of scope of the list.

Once you have your script ready you need to tell your admin form to use it,
read this
it explains how you do that.

https://docs.djangoproject.com/en/dev/topics/forms/media/



> Axel
>
> Am 27.08.2012 um 01:11 schrieb Nicolas Emiliani:
>
> > On Sun, Aug 26, 2012 at 5:03 PM, Axel Rau  wrote:
> >
> >> In my admin site, I have a fieldset which depends on a choice.
> >> I would like to control expansion of the related fieldset by the choice
> >> instead of the standard widgets.
> >> How can I do this?
> >>
> >
> > I don't understand clearly what you want, but, correct me if I'm wrong,
> you
> > have some field and by doing something on it, maybe selecting it ? you
> want
> > to something else on some other fields, maybe show/hide them ?
> >
> > If this is what you are looking for, you could use javascript to do the
> > magic, you can tell the admin form to use a specific js script and u can
> > even generate that js dynamically.
> >
> > If this is not helpful please be more specific.
> >
> >
> >
> >> Axel
> >> ---
> >> PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Django users" group.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/django-users?hl=en.
> >>
> >>
> >
> >
> > --
> > Nicolas Emiliani
> >
> > Lo unico instantaneo en la vida es el cafe, y es bien feo.
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
>

Dynamic choices on inlines

2012-08-27 Thread Mariano DAngelo
Hi, I'm new in django and I'm searching how to the following...

I've the following models

class Fighter(Person):
pass

class Fight_Event(models.Model):
pass

# INLINE MODEL

class Fight(models.Model):
event = models.ForeignKey(Fight_Event)
fighter1 = models.ForeignKey(Fighter,related_name='fighter1')
fighter2 = models.ForeignKey(Fighter,related_name='fighter2') 
winner = # choices fighter1 or fighter2


class Fight_Event_Fight_Inline(admin.TabularInline):
model = Fight
fk_name = 'event'

class Fight_Event_ADMIN (ForeignKeyAutocompleteAdmin):
inlines = [Fight_Event_Fight_Inline,]

admin.site.register(Fight_Event,Fight_Event_ADMIN)



I need to add the 2 figther selected on the admin the a third widget to 
select the winner 
I need to load with javascript, or there another way?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/X-fIV1Wa_6EJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: SyntaxError Creating New Project

2012-08-27 Thread Bestrafung
Thank you all for the tips. I was pretty sure I tried using the full path 
to the 2.5 install with the same error but I'll check again. I'll let you 
know what I find.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/90kVMNbxfawJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: expand fieldset by choice

2012-08-27 Thread Axel Rau

Am 27.08.2012 um 15:04 schrieb Nicolas Emiliani:

> 
> Through JS, you need to implement a script that binds to the change event
> and then changes the collapse css call for the specific div. You may want
> to look
> at jQuery, although this is out of scope of the list.
> 
> Once you have your script ready you need to tell your admin form to use it,
> read this
> it explains how you do that.
> 
> https://docs.djangoproject.com/en/dev/topics/forms/media/

Thanks for the explanation, but JS is not an option here.
Any other solution available?

Axel
---
PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: SyntaxError Creating New Project

2012-08-27 Thread Bestrafung
I ran python and checked the version number. This is what I get:

[-bash-3.2 root@server1: ~] # python
Python 2.5 (r25:51908, Aug 20 2012, 11:55:47)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

When I run "import django" I get:

>>> import django
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named django


I assumed this was normal since the guide I'm following has all of the 
django setup in the user's home directory. Is this the problem? I will keep 
looking into it, the guide had me enter export 
PYTHONPATH='$PYTHONPATH:/home/username/sites/domain.com' in the user's 
.bash_profile, since I am logged in as root should I add that to the 
/root/.bash_profile?

On Monday, August 27, 2012 9:51:22 AM UTC-4, Bestrafung wrote:
>
> Thank you all for the tips. I was pretty sure I tried using the full path 
> to the 2.5 install with the same error but I'll check again. I'll let you 
> know what I find.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/DVeH65k8aUcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: expand fieldset by choice

2012-08-27 Thread Nicolas Emiliani
On Mon, Aug 27, 2012 at 10:51 AM, Axel Rau  wrote:

>
> Am 27.08.2012 um 15:04 schrieb Nicolas Emiliani:
>
> >
> > Through JS, you need to implement a script that binds to the change event
> > and then changes the collapse css call for the specific div. You may want
> > to look
> > at jQuery, although this is out of scope of the list.
> >
> > Once you have your script ready you need to tell your admin form to use
> it,
> > read this
> > it explains how you do that.
> >
> > https://docs.djangoproject.com/en/dev/topics/forms/media/
>
> Thanks for the explanation, but JS is not an option here.
> Any other solution available?
>
>
Not that I know of, scripting on the client side is implemented with JS.


> Axel
> ---
> PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: SyntaxError Creating New Project

2012-08-27 Thread Bestrafung
Ok, I think it's worked out now. I added the export line to the root 
.bash_profile and then changed the shebang in django-admin.py to 
"/opt/python2.5/bin python" and now everything seems to be working. If 
anyone is working on an older Red Hat/CentOS system and has to follow the 
guide I'm following I hope this helps them.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/xgqKgMFwFD4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: expand fieldset by choice

2012-08-27 Thread Axel Rau

Am 27.08.2012 um 17:22 schrieb Dennis Lee Bieber:

>   If Javascript (and by extension, AJAX) is not a viable option, it
> would seem that you will be stuck with having the first choice made
> trigger a form submittal so that the server can then populate the second
> part and send it back to the user. Hope the pages load fast...
Oh, yes, I'm learning... Seems, we have to adjust policies...

Another question:
How can I expand the right fieldset dependent of current content of my choices 
field (as loaded from db) while rendering the change page initially?

Axel
---
PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Ecommerce Solution

2012-08-27 Thread Mario Menezes
LFS is another option. Lightning Fast Shop is the promise in the name :-)

www.getlfs.com

Disclaimer: I'm not affiliate with LFS; we've used it for a project 
(www.qmaterial.com.br) that is not a ecommerce, but has a significant 
number of similar features (except ecommerce) that using a ecommerce 
solution was the obvious solution.

Best regards,

Mário Menezes


Em domingo, 26 de agosto de 2012 17h03min25s UTC-3, Swaroop Shankar 
escreveu:
>
> Hi All,
> Previously I had asked similar question on this group and decided to go 
> with Satchmo. After the implementation it turned out to be bit difficult to 
> maintain since the system do not provide much plugin or customization 
> support. So am thinking of implementing another ecommerce solution. The 
> system am looking for is an app which I can use with my existing site. Also 
> It would be better if the system would support a mechanism to migrate the 
> existing data from satchmo. I checked few but almost every project lacks 
> proper documentation. So is there any django ecommerce project that have 
> good documentation and easy to integrate?
>
> Thanks and Regards,
>
> Swaroop Shankar V
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/_GQrKjmFzTYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Dependent Ajax Form Fields

2012-08-27 Thread Joseph Mutumi
Thank you for the help!

On 8/27/12, Jani Tiainen  wrote:
> 26.8.2012 21:54, Joseph Mutumi kirjoitti:
>> Hello,
>>
>> If A is a model with ForeignKey relationships to B. What would be the
>> best way of rendering two
>> selectboxes, A and B. The values of B are the values filtered through
>> using the relationship with
>> the selected value of A via an AJAX call.
>>
>> I need to get these values from the DB as well as have Django validation
>> work out? All ideas are
>> welcome!
>
> Well it works exactly as you described. You hookup with your JS
> framework to change event of selectbox A to run query and update
> contents (by calling django view with correct params) of selectbox B.
>
> I suggest that you keep validation to happen on form submit rather than
> when updating two field values.
>
> Just find out what is the best way to do that with your JS framework.
>
> Try googling "dependent selectboxes  should get you going. By adding keyword Django might give even more help.
>
> --
> Jani Tiainen
>
> - Well planned is half done and a half done has been sufficient before...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: SyntaxError Creating New Project

2012-08-27 Thread Melvyn Sopacua
On 27-8-2012 17:05, Bestrafung wrote:
> Ok, I think it's worked out now. I added the export line to the root 
> .bash_profile and then changed the shebang in django-admin.py to 
> "/opt/python2.5/bin python" and now everything seems to be working.

I imagine there's a typo there and no space, but a forward slash.
> If 
> anyone is working on an older Red Hat/CentOS system and has to follow the 
> guide I'm following I hope this helps them.
> 
It's kind of weird that this fix works without problems. You should try
the following in your project directory:
/opt/python2.5/bin/python manage.py shell
On the shell you get then:
>>> from django.db import models
>>> print models.__file__

I'm quite interested what that shows since your installation seems to be
all over the place.

-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: expand fieldset by choice

2012-08-27 Thread Melvyn Sopacua
On 27-8-2012 18:31, Axel Rau wrote:

> Another question: How can I expand the right fieldset dependent of
> current content of my choices field (as loaded from db) while
> rendering the change page initially?

Look in django/contrib/admin/options.py for get_fieldsets(). Also look
at this bugreport for it's limitations:


Short version: the method as it is implemented requires that you have at
least some declared fieldsets.

In case you're also new to python, you should convert your declared
fieldsets from a tuple to a list, so it's easier to modify it.
-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Problem serving files from media directory

2012-08-27 Thread neridaj
Hello,

I've deployed a new website to my staging and production servers but for 
some reason the images in the media directory are displaying 404 errors. 
The path to the image is correct and the image is located at that path:



ls -la ~/.virtualenvs/website/project/media/projects/hair/2012/test-1
total 144
drwxr-x--- 2 leahbc leahbc   4096 Aug 27 16:43 .
drwxr-x--- 3 leahbc leahbc   4096 Aug 27 16:43 ..
-rwxrwxr-x 1 leahbc leahbc 131719 Aug 27 16:43 13221803.jpg

settings.py:

MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
MEDIA_URL = '/media/'

Am I having problems because the image file is nested within other 
directories? Files are being served from the static directory just fine, 
any ideas?

Thanks,

Jason

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/bPRXOIJRoPAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Problem serving files from media directory

2012-08-27 Thread neridaj
Hello,

I've deployed a new website to my staging and production servers but for 
some reason the images in the media directory are displaying 404 errors. 
The path to the image is correct and the image is located at that path:



ls -la ~/.virtualenvs/website/project/media/projects/hair/2012/test-1
total 144
drwxr-x--- 2 username username   4096 Aug 27 16:43 .
drwxr-x--- 3 username username   4096 Aug 27 16:43 ..
-rwxrwxr-x 1 username username 131719 Aug 27 16:43 13221803.jpg

settings.py:

MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
MEDIA_URL = '/media/'

Am I having problems because the image file is nested within other 
directories? Files are being served from the static directory just fine, 
any ideas?

Thanks,

Jason

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Kk3KOw-L4RQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: CACHE_MIDDLEWARE_ANONYMOUS_ONLY does not work if user is not printed by view or template

2012-08-27 Thread Alexis Bellido
I just created a ticket reporting this issue as a bug:

https://code.djangoproject.com/ticket/18863

Thanks for all the suggestions.

On Tuesday, August 21, 2012 2:27:04 PM UTC-3, Alexis Bellido wrote:
>
> Hello,
>
> I am working on a Django 1.4 project and writing one simple application 
> using per-site cache as described here:
>
> https://docs.djangoproject.com/en/dev/topics/cache/#the-per-site-cache
>
> I have correctly setup a local Memcached server and confirmed the pages 
> are being cached.
>
> Then I set CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True because I don't want to 
> cache pages for authenticated users.
>
> I'm testing with a simple view that returns a template with 
> render_to_response and RequestContext to be able to access user information 
> from the template and the caching works well so far, meaning it caches 
> pages just for anonymous users.
>
> And here's my problem. I created another view using a different template 
> that doesn't access user information and noticed that the page was being 
> cached even if the user was authenticated. After testing many things I 
> found that authenticated users were getting a cached page if the template 
> didn't print something from the user context variable. It's very simple to 
> test: print the user on the template and the page won't be cached for an 
> authenticated user, remove the user on the template, refresh the page while 
> authenticated and check the HTTP headers and you will notice you're getting 
> a cached page. You should clear the cache between changes to see the 
> problem more clearly.
>
> I tested a little more and found that I could get rid of the user in the 
> template and print request.user right on the view (which prints to the 
> development server console) and that also fixed the problem of showing a 
> cached page to an authenticated user but that's an ugly hack.
>
> A similar problem was reported here but never got an answer:
>
> https://groups.google.com/d/topic/django-users/FyWmz9csy5g/discussion
>
> I can probably write a conditional decorator to check if 
> user.is_authenticated() and based on that use @never_cache on my view but 
> it seems like that defeats the purpose of using per-site cache, doesn't it?
>
> Any suggestions will be appreciated.
>
> Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/GCmx3b8WEZoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Problems with first tutorial

2012-08-27 Thread Snorre Edwin
Im on the Playing with the API part and seem to catch some troubles.
Everything has gone smoothly until this part.

I write this and get the next error. This is with my enviromen_variable: 
DJANGO_SETTINGS_MODULE 
set to where I can find the settings.py in my project.

C:\Prosjekter\Djangotest\testproject>python manage.py shell
ImportError: Could not import settings 
'C:\Prosjekter\Djangotest\testproject\testproject' (Is it on sys.path?): 
Import by filename is not supported.

With out the env variable I get this error:
C:\Prosjekter\Djangotest\testproject>python manage.py shell
ImportError: No module named user

I have done the sync part and I can see that the postgreSQL have the tables 
in its database.
I have also done everything right until this part.

As i understood, I did not have to set env variable when I used python 
manage.py shell.

Can someone help me please:)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/K6AnN76HChoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Problems with first tutorial

2012-08-27 Thread trebor63
 

I hope this helps, when working under windows (XP/7) this just works for me.

Replace  with whatever you have named it.

>From the directory above where the project was created create a batch file 
(ie .bat) containing the following

set _HOME=%CD%

set DJANGO_SETTINGS_MODULE=.settings

set PYTHONPATH=%_HOME%

You can add any other additional pythonpath requirements with the delimiter 
of a semicolon ‘;’

 

You could also hardcode the “_HOME” variable, but this is up to you

 

Once done the following should work for you via the command prompt.

 

Run the batch file above from the directory it was created in



cd 

manage.py shell

On Tuesday, 28 August 2012 09:01:25 UTC+10, Snorre Edwin wrote:
>
> Im on the Playing with the API part and seem to catch some troubles.
> Everything has gone smoothly until this part.
>
> I write this and get the next error. This is with my enviromen_variable: 
> DJANGO_SETTINGS_MODULE 
> set to where I can find the settings.py in my project.
>
> C:\Prosjekter\Djangotest\testproject>python manage.py shell
> ImportError: Could not import settings 
> 'C:\Prosjekter\Djangotest\testproject\testproject' (Is it on sys.path?): 
> Import by filename is not supported.
>
> With out the env variable I get this error:
> C:\Prosjekter\Djangotest\testproject>python manage.py shell
> ImportError: No module named user
>
> I have done the sync part and I can see that the postgreSQL have the 
> tables in its database.
> I have also done everything right until this part.
>
> As i understood, I did not have to set env variable when I used python 
> manage.py shell.
>
> Can someone help me please:)
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/wcdjAC91blgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django development running on 127.0.0.1:8000 not accessible from same machine

2012-08-27 Thread nav
Hi Anton,

Thank you for your email.

I have tried all of the methods you had suggested but to no avail.

In all my years of Django development the localhost address has worked
flawlessly. I have also tried with multiple Django projects and other
Linux installations and the problem persists. This makes me think this
is a DNS issue that may be due to a network related problem. In which
case I will have to investigate. I will post once I find a work around
or solution.

Cheers,
nav

On Aug 27, 5:36 pm, Anton Baklanov  wrote:
> oh, i misunderstood your question.
>
> try to type url with schema into browser's address bar. i mean, use 
> 'http://localhost:8000/'instead of 'localhost:8000'.
> also it's possible that some browser extension does this, try disabling
> them all.
>
>
>
>
>
>
>
>
>
> On Mon, Aug 27, 2012 at 10:53 AM, nav  wrote:
> > Dear Folks,
>
> > I am running my django development server on 127.0.0.1:8000 and accessing
> > this address from my web browser on the same machine. In the past few days
> > I have found thet the web browsers keep prepending the address with "www."
> > when using the above address. 127.0.0.1 without the prot number works fine
> > but the django development server requires a port number.
>
> > I have not encountered this problem before and am puzzled by what is
> > happening. I am working on a Kubuntu 12.04 linux box and my /etc/hosts/
> > file is below if that helps:
>
> > 
> > 127.0.0.1       localhost
> > 127.0.1.1       
>
> > # The following lines are desirable for IPv6 capable hosts
> > ::1     ip6-localhost ip6-loopback
> > fe00::0 ip6-localnet
> > ff00::0 ip6-mcastprefix
> > ff02::1 ip6-allnodes
> > ff02::2 ip6-allrouters
> > 
>
> > TIA
> > Cheers,
> > nav
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To view this discussion on the web visit
> >https://groups.google.com/d/msg/django-users/-/EZzlz6iQOGoJ.> To post to 
> >this group, send email todjango-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.
>
> --
> Regards,
> Anton Baklanov

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



My "Contributors" page Conundrum

2012-08-27 Thread JJ Zolper
Hello,

I'm trying to develop a simple hyperlink between two pages. It sounds 
simple but it's a little bit more complex then that.

Here is the template code that proceeds through the database of 
contributors:

Contributors


{% for Contributor in Contributors_List %}
http://www.madtrak.com/about/contributors/";>{{ 
Contributor.name }}

Title: {{ Contributor.title }}

{% endfor %}


and spits out the contributors name in a link form and the title of that 
person.

My problem is that I want each contributor to have their own separate page. 
So if the first guys name for some example is Mike Smith then if you were 
to click his name for example you would be sent to 
/about/contributor/mikesmith and so on. I supposed I could define a url for 
each contributor so I could set this up:

Contributors


{% for Contributor in Contributors_List %}
{{ Contributor.name }}

Title: {{ Contributor.title }}

{% endfor %}


but that doesn't seem like the correct way to do this. that 
Contributor.link is then hardcoded into the system. It's not generated by 
the system obviously.

I also have:

def mikesmith(request):
mikesmith = Contributor.objects.filter(name='Mike Smith')
return render_to_response('mikesmith.html', {'Contributor': mikesmith}, 
context_instance = RequestContext(request))

I have that repeated for each and every contributor. This goes againist 
Django's DRY mentality so I have a feeling there is a much better way.

Thanks,

JJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/xWx39cCFzvYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django development running on 127.0.0.1:8000 not accessible from same machine

2012-08-27 Thread nav
Found a workaround that works.

I assigned 127.0.0.1 in my /etc/hosts file to www.127.0.0.1 and everything 
works. From the research I have done I cannot prove conclusively if this is 
a problem on Ubuntu 12.04 machines or not because I could not find other 
people who were facing the same issue.

In addition I am not sure if assigning the above causes any security issues 
but since it is just a name I think it should be fine.

This issue may be related to not assigning a fully qualified domain name to 
the Linux host.

Thanks for your help Anton and hope this helps others.

Cheers,
nav

On Tuesday, August 28, 2012 9:30:39 AM UTC+5:30, nav wrote:
>
> Hi Anton, 
>
> Thank you for your email. 
>
> I have tried all of the methods you had suggested but to no avail. 
>
> In all my years of Django development the localhost address has worked 
> flawlessly. I have also tried with multiple Django projects and other 
> Linux installations and the problem persists. This makes me think this 
> is a DNS issue that may be due to a network related problem. In which 
> case I will have to investigate. I will post once I find a work around 
> or solution. 
>
> Cheers, 
> nav 
>
> On Aug 27, 5:36 pm, Anton Baklanov  wrote: 
> > oh, i misunderstood your question. 
> > 
> > try to type url with schema into browser's address bar. i mean, use '
> http://localhost:8000/'instead of 'localhost:8000'. 
> > also it's possible that some browser extension does this, try disabling 
> > them all. 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Mon, Aug 27, 2012 at 10:53 AM, nav  wrote: 
> > > Dear Folks, 
> > 
> > > I am running my django development server on 127.0.0.1:8000 and 
> accessing 
> > > this address from my web browser on the same machine. In the past few 
> days 
> > > I have found thet the web browsers keep prepending the address with 
> "www." 
> > > when using the above address. 127.0.0.1 without the prot number works 
> fine 
> > > but the django development server requires a port number. 
> > 
> > > I have not encountered this problem before and am puzzled by what is 
> > > happening. I am working on a Kubuntu 12.04 linux box and my 
> /etc/hosts/ 
> > > file is below if that helps: 
> > 
> > >  
> > > 127.0.0.1   localhost 
> > > 127.0.1.1
> > 
> > > # The following lines are desirable for IPv6 capable hosts 
> > > ::1 ip6-localhost ip6-loopback 
> > > fe00::0 ip6-localnet 
> > > ff00::0 ip6-mcastprefix 
> > > ff02::1 ip6-allnodes 
> > > ff02::2 ip6-allrouters 
> > >  
> > 
> > > TIA 
> > > Cheers, 
> > > nav 
> > 
> > > -- 
> > > You received this message because you are subscribed to the Google 
> Groups 
> > > "Django users" group. 
> > > To view this discussion on the web visit 
> > >https://groups.google.com/d/msg/django-users/-/EZzlz6iQOGoJ.> To post 
> to this group, send email todjango-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. 
> > 
> > -- 
> > Regards, 
> > Anton Baklanov 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/dJ1NiROz2WkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django development running on 127.0.0.1:8000 not accessible from same machine

2012-08-27 Thread jirka . vejrazka
Hi nav,

  A long shot - do you happen to have a proxy defined in your browser? It is 
possible to define a proxy for *all* request (including localhost) - this would 
have the same effect.

  HTH

Jirka
-Original Message-
From: nav 
Sender: django-users@googlegroups.com
Date: Mon, 27 Aug 2012 21:00:12 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: Re: Django development running on 127.0.0.1:8000 not accessible from
 same machine

Hi Anton,

Thank you for your email.

I have tried all of the methods you had suggested but to no avail.

In all my years of Django development the localhost address has worked
flawlessly. I have also tried with multiple Django projects and other
Linux installations and the problem persists. This makes me think this
is a DNS issue that may be due to a network related problem. In which
case I will have to investigate. I will post once I find a work around
or solution.

Cheers,
nav

On Aug 27, 5:36 pm, Anton Baklanov  wrote:
> oh, i misunderstood your question.
>
> try to type url with schema into browser's address bar. i mean, use 
> 'http://localhost:8000/'instead of 'localhost:8000'.
> also it's possible that some browser extension does this, try disabling
> them all.
>
>
>
>
>
>
>
>
>
> On Mon, Aug 27, 2012 at 10:53 AM, nav  wrote:
> > Dear Folks,
>
> > I am running my django development server on 127.0.0.1:8000 and accessing
> > this address from my web browser on the same machine. In the past few days
> > I have found thet the web browsers keep prepending the address with "www."
> > when using the above address. 127.0.0.1 without the prot number works fine
> > but the django development server requires a port number.
>
> > I have not encountered this problem before and am puzzled by what is
> > happening. I am working on a Kubuntu 12.04 linux box and my /etc/hosts/
> > file is below if that helps:
>
> > 
> > 127.0.0.1       localhost
> > 127.0.1.1       
>
> > # The following lines are desirable for IPv6 capable hosts
> > ::1     ip6-localhost ip6-loopback
> > fe00::0 ip6-localnet
> > ff00::0 ip6-mcastprefix
> > ff02::1 ip6-allnodes
> > ff02::2 ip6-allrouters
> > 
>
> > TIA
> > Cheers,
> > nav
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To view this discussion on the web visit
> >https://groups.google.com/d/msg/django-users/-/EZzlz6iQOGoJ.> To post to 
> >this group, send email todjango-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.
>
> --
> Regards,
> Anton Baklanov

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django development running on 127.0.0.1:8000 not accessible from same machine

2012-08-27 Thread Nandakumar Chandrasekhar

Hi Jirka,

That does not seem to be the case. I set rhe proxy server settings to no 
proxy and it still prepends a www in front of the IP address. I could 
investigate this further but I am little pressed for time at present.


Thanks,
nav

On Tuesday 28 August 2012 10:39 AM, jirka.vejra...@gmail.com wrote:

Hi nav,

   A long shot - do you happen to have a proxy defined in your browser? It is 
possible to define a proxy for *all* request (including localhost) - this would 
have the same effect.

   HTH

 Jirka
-Original Message-
From: nav 
Sender: django-users@googlegroups.com
Date: Mon, 27 Aug 2012 21:00:12
To: Django users
Reply-To: django-users@googlegroups.com
Subject: Re: Django development running on 127.0.0.1:8000 not accessible from
  same machine

Hi Anton,

Thank you for your email.

I have tried all of the methods you had suggested but to no avail.

In all my years of Django development the localhost address has worked
flawlessly. I have also tried with multiple Django projects and other
Linux installations and the problem persists. This makes me think this
is a DNS issue that may be due to a network related problem. In which
case I will have to investigate. I will post once I find a work around
or solution.

Cheers,
nav

On Aug 27, 5:36 pm, Anton Baklanov  wrote:

oh, i misunderstood your question.

try to type url with schema into browser's address bar. i mean, use 
'http://localhost:8000/'instead of 'localhost:8000'.
also it's possible that some browser extension does this, try disabling
them all.









On Mon, Aug 27, 2012 at 10:53 AM, nav  wrote:

Dear Folks,



I am running my django development server on 127.0.0.1:8000 and accessing
this address from my web browser on the same machine. In the past few days
I have found thet the web browsers keep prepending the address with "www."
when using the above address. 127.0.0.1 without the prot number works fine
but the django development server requires a port number.



I have not encountered this problem before and am puzzled by what is
happening. I am working on a Kubuntu 12.04 linux box and my /etc/hosts/
file is below if that helps:




127.0.0.1   localhost
127.0.1.1   



# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters




TIA
Cheers,
nav



--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/EZzlz6iQOGoJ.> To post to this 
group, send email todjango-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.


--
Regards,
Anton Baklanov




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: My "Contributors" page Conundrum

2012-08-27 Thread Nick Santos
Hi JJ,

You're absolutely right that there is a better way to do this that doesn't
involve repetition. To start with, check out the docs under example on the
page for the URL dispatcher:
https://docs.djangoproject.com/en/dev/topics/http/urls/ - I'll walk you
through part of it though.

First, let's take a look at how capture groups work. Capture groups allow
you to pass a variable portion of the url to a view, which is what you'll
need to do in order to have one definition that lets you have a generic
view that looks up the contributor. So, you can assign a view to a URL
where only part of it is known at the time of the definition, and pass the
unknown parts into the view. In your case, your url definition would look
like:

urlpatterns = patterns('',
 your other patterns...
(r'^about/contributor/(?P[a-zA-Z]+)/$', 'your.view.name'),
possibly more patterns 
)

So, what that (?P[a-zA-Z]+) says, in parts is that we want to
capture a value - designated by the parenthesis - to be passed to
your.view.name as a named parameter called contribname - this is defined by
the ?P. That value looks like text with at least one
character. The text definition is [a-zA-Z] (careful, this doesn't include
spaces right now)and the at least one is +, and comes between two slashes.
If you want to learn more about writing things like that, look into regular
expressions.

Then, in your view, you can take that parameter and look up the relevant
contributor and make the view generic to something like:

def contributor_page(request, contribname):
contrib_object = Contributor.objects.filter(name=contribname)
return render_to_response('contributor.html', {'Contributor':
contrib_object}, context_instance = RequestContext(request))

Then, in outputting your links, you can put the relevant name in the url,
etc.

I hope that helps. Let me know if anything is unclear. Good luck


On Mon, Aug 27, 2012 at 9:58 PM, JJ Zolper  wrote:

> Hello,
>
> I'm trying to develop a simple hyperlink between two pages. It sounds
> simple but it's a little bit more complex then that.
>
> Here is the template code that proceeds through the database of
> contributors:
>
> Contributors
>
> 
>  {% for Contributor in Contributors_List %}
> http://www.madtrak.com/about/contributors/";>{{
> Contributor.name }}
>  
> Title: {{ Contributor.title }}
> 
>  {% endfor %}
> 
>
> and spits out the contributors name in a link form and the title of that
> person.
>
> My problem is that I want each contributor to have their own separate
> page. So if the first guys name for some example is Mike Smith then if you
> were to click his name for example you would be sent to
> /about/contributor/mikesmith and so on. I supposed I could define a url for
> each contributor so I could set this up:
>
> Contributors
>
> 
> {% for Contributor in Contributors_List %}
>  {{ Contributor.name }}
> 
>  Title: {{ Contributor.title }}
> 
> {% endfor %}
>  
>
> but that doesn't seem like the correct way to do this. that
> Contributor.link is then hardcoded into the system. It's not generated by
> the system obviously.
>
> I also have:
>
> def mikesmith(request):
> mikesmith = Contributor.objects.filter(name='Mike Smith')
> return render_to_response('mikesmith.html',
> {'Contributor': mikesmith}, context_instance = RequestContext(request))
>
> I have that repeated for each and every contributor. This goes againist
> Django's DRY mentality so I have a feeling there is a much better way.
>
> Thanks,
>
>  JJ
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/xWx39cCFzvYJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: My "Contributors" page Conundrum

2012-08-27 Thread Melvyn Sopacua
On 28-8-2012 6:58, JJ Zolper wrote:

> My problem is that I want each contributor to have their own separate page. 
> So if the first guys name for some example is Mike Smith then if you were 
> to click his name for example you would be sent to 
> /about/contributor/mikesmith and so on.


and make sure you read the permalink bit.
-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Column widths in TabularInline

2012-08-27 Thread Vikas Rawal
> 
> The problem is that the #id is different for each row of the tabular
> inline object.
> 
> it takes the form
> 
> id="id_member_set-0-name" for the first row, id="id_member_set-1-name"
> for the second row, etc.
> 
> Therefore #whatever does not work. Is there a way of using regex or
> something like that to cover all the above formulations of "id".
> 
> 
> 
> Yes there is, but this is no django thing you are asking, using jquery you can
> accomplish that :
> 
> http://api.jquery.com/attribute-starts-with-selector/
> 
>  jQuery('[id^=id_member_set]').each(so_stuff)
> 
> Check the web, there is a __LOT__ of info on this.


The problem I am posting it to django list is because the problem is
obviously related to the way django works. Various solutions to the
problem, none of which have worked so far, have either been using
python/django or css (and now, jquery).

I am new to all of these and would prefer if the problem could be
solved without going to jquery. It is a simple django model and I have
picked up some sense of css. But java/jquery is totally alien to me.

Vikas

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.