Re: urls not maching

2014-07-13 Thread ngangsia akumbo

Those are actual urls , i am actually still developing this site, so i 
decided to start with a blog first

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0a60ab4f-1d47-418e-a263-ab6113bd62b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-admin set foreign key to Null for inlines selected item instead of delete

2014-07-13 Thread Mike Dewhirst

On 14/07/2014 9:23 AM, Aeh. ABID wrote:

i'm bit confused here, shouldn't ovverride delete() instead of save() ?
and how to retrieve selected items ?


Not really. You don't want to delete anything. You want to break a link. 
Making the foreign key field null will do that.


It sounds like you might want a many to many relationship between A and 
AB and another one between B and AB.


In that case, you actually delete the link record not the A nor the AB 
record.


That makes AB.A_id and AB.B_id redundant. The only fields you need in AB 
are field_1 and field_2.


So create a table A_AB and another one B_AB. A_AB needs a foreign key to 
A and also a foreign key to AB. In addition, A needs a ManyToManyField 
pointing to AB (or AB needs one to A) using the "through" table A_AB. Do 
likewise between B and AB.


https://docs.djangoproject.com/en/1.6/ref/models/fields/#manytomanyfield

Mike



On Sunday, July 13, 2014 7:48:05 PM UTC+1, Aeh. ABID wrote:



I Have a model AB that holds two foreign keys A_id and B_id.

|class  AB(models.Model):
 A_id=  models.ForeignKey('A')
 B_id=  models.ForeignKey('B')
 field_1=  models.CharField(max_length=200,  blank=True)
 field_2=  models.CharField(max_length=200,  blank=True)|


When editing A or B, AB items are edited inlines, what I want to
achieve is that when editing let's say B I want to keep the selected
AB items and set the foreign key B_id to null instead of deleting them.

thanks for any hint


http://stackoverflow.com/q/24726046/288387?sem=2


--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com
.
To post to this group, send email to django-users@googlegroups.com
.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/ec5cb8fa-a29d-4765-8e68-23a11cf6a877%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53C3210B.4020102%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Django-admin set foreign key to Null for inlines selected item instead of delete

2014-07-13 Thread Aeh. ABID
i'm bit confused here, shouldn't ovverride delete() instead of save() ? and 
how to retrieve selected items ?

On Sunday, July 13, 2014 7:48:05 PM UTC+1, Aeh. ABID wrote:
>
> 
>   
> I Have a model AB that holds two foreign keys A_id and B_id.
>
> class AB(models.Model):
> A_id = models.ForeignKey('A')
> B_id = models.ForeignKey('B')
> field_1 = models.CharField(max_length=200, blank=True)
> field_2 = models.CharField(max_length=200, blank=True)
>
>
> When editing A or B, AB items are edited inlines, what I want to achieve 
> is that when editing let's say B I want to keep the selected AB items and 
> set the foreign key B_id to null instead of deleting them.
>
> thanks for any hint
>
>
> http://stackoverflow.com/q/24726046/288387?sem=2 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ec5cb8fa-a29d-4765-8e68-23a11cf6a877%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-admin set foreign key to Null for inlines selected item instead of delete

2014-07-13 Thread Mike Dewhirst

On 14/07/2014 4:48 AM, Aeh. ABID wrote:



I Have a model AB that holds two foreign keys A_id and B_id.

|class  AB(models.Model):
 A_id=  models.ForeignKey('A')
 B_id=  models.ForeignKey('B')
 field_1=  models.CharField(max_length=200,  blank=True)
 field_2=  models.CharField(max_length=200,  blank=True)|


When editing A or B, AB items are edited inlines, what I want to achieve
is that when editing let's say B I want to keep the selected AB items
and set the foreign key B_id to null instead of deleting them.


Just do B_id = None in the save() method of AB ...



thanks for any hint


http://stackoverflow.com/q/24726046/288387?sem=2

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com
.
To post to this group, send email to django-users@googlegroups.com
.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/f336fd6a-896c-4ed0-b55e-8e2a37d35d60%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53C30781.8090603%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Django-admin set foreign key to Null for inlines selected item instead of delete

2014-07-13 Thread Aeh. ABID
 
  
I Have a model AB that holds two foreign keys A_id and B_id.

class AB(models.Model):
A_id = models.ForeignKey('A')
B_id = models.ForeignKey('B')
field_1 = models.CharField(max_length=200, blank=True)
field_2 = models.CharField(max_length=200, blank=True)


When editing A or B, AB items are edited inlines, what I want to achieve is 
that when editing let's say B I want to keep the selected AB items and set 
the foreign key B_id to null instead of deleting them.

thanks for any hint


http://stackoverflow.com/q/24726046/288387?sem=2 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f336fd6a-896c-4ed0-b55e-8e2a37d35d60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: urls not maching

2014-07-13 Thread Thomas Lockhart

On 7/13/14 7:19 AM, ngangsia akumbo wrote:
no am not using two slashes, i just want my block links to output the 
content details but i keep having the error above

i need some help here
You are getting some help here. The details you have provided so far 
seem to indicate that you are providing a URL with two slashes. You will 
need to provide more details to clarify that this is not the case.


Try cut and pasting the actual URL from your client into your next email.

hth

   - Tom



On Sunday, July 13, 2014 12:52:20 PM UTC+1, Jonathan Querubina wrote:

It seems tha you are using blog// (two slashes) on the url. Try blog/


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/873f6340-0192-465b-b47b-931e2b9d%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53C2CB16.9010706%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin UI not commiting to DB

2014-07-13 Thread Derek
I am sure that any update will help others who might have this issue.

I have been using the Django admin (on and off) for many years now and have 
not had this particular problem (yet).

It would also be useful to post more (non-confidential) details in a blog, 
perhaps.

On Sunday, 13 July 2014 01:05:00 UTC+2, Timothy W. Cook wrote:
>
> Thanks for the reply Derek.  This post was just a stab to see if anyone 
> had seen this before and I just missed the post.  
>
> I guess it is time to roll up my sleeves and take a formal approach at 
> debugging.  This one of VERY few, non-open source apps I work on. 
>  Otherwise I would just point to the repository.  
>
> When (if) I find the issue I will post a solution here.
>
> Cheers,
> Tim
>
>
>
> On Sat, Jul 12, 2014 at 1:21 PM, Derek > 
> wrote:
>
>> Tim
>>
>> Hard to tell without code; but what happens when you test without the 
>> form override?  Also, unless you can reproduce the errors they get, then 
>> you will struggle to debug.  Have you tried adding in log statements at key 
>> points to try & see where things go haywire?
>>
>>
>> On Saturday, 12 July 2014 10:52:37 UTC+2, Timothy W. Cook wrote:
>>>
>>> Django 1.65, PostgreSQL. 
>>>
>>> Several users of the admin UI in my app have noted that clicking Save or 
>>> Save and Continue buttons does not always actually save changes to the 
>>> database. 
>>>
>>> Has anyone else seen this?  I do override get_form in admin.py so that I 
>>> can set some fields as readonly based on a boolean flag.  Otherwise my 
>>> admin.py is pretty generic. 
>>>
>>> Any hint as to where to look for this problem or the best approach to 
>>> troubleshoot it?
>>>
>>> --Tim
>>>
>>> -- 
>>>
>>> 
>>> Timothy Cook
>>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>>> MLHIM http://www.mlhim.org
>>>
>>>   -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/f22690f1-cd8d-48f0-928d-7fe879efa57f%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>
> 
> Timothy Cook
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
> MLHIM http://www.mlhim.org
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/02b539d1-b729-46fc-b810-346b2d1d06a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: urls not maching

2014-07-13 Thread ngangsia akumbo
can someone help me with a url that will work?


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c5779c26-a6e3-486e-853e-d3111986abd9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: validators not working in shell

2014-07-13 Thread alghafli

Thank you. That helped me solving the problem :)
على السبت 12 تـمـوز 2014 20:12, كتب tim:
Model validation is not invoked when calling model.save(). You can 
read more 
here: https://docs.djangoproject.com/en/1.6/ref/models/instances/#validating-objects


On Saturday, July 12, 2014 6:46:17 AM UTC-4, thebsom wrote:

Hello
I am creating a django library application. I have made a book
model and
it has some fields with validators. Most of them are standard
MinValueValidator and MaxValueValidator.
Using the webserver, the validators work completely fine. I see
errors
when I put invalid values. However, when I tested saving objects
using
the shell, the validators are not called. I am using the shell
because I
am planning to import the database from existing csv files.

Is there something wrong? Or am I responsible to call the validators
manually before save()?

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2464d4fe-cadc-45e5-a2bc-e0276d148f31%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53C29618.505%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: urls not maching

2014-07-13 Thread ngangsia akumbo
no am not using two slashes, i just want my block links to output the 
content details but i keep having the error above
i need some help here

On Sunday, July 13, 2014 12:52:20 PM UTC+1, Jonathan Querubina wrote:
>
> It seems tha you are using blog// (two slashes) on the url. Try blog/
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/873f6340-0192-465b-b47b-931e2b9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: urls not maching

2014-07-13 Thread Jonathan Querubina
It seems tha you are using blog// (two slashes) on the url. Try blog/

Sent from my iPhone

> On Jul 13, 2014, at 6:52, ngangsia akumbo  wrote:
> 
> 
> 
> Here is the similar probe
> 
> views File
> # Create your views here.
> from blog.models import Post
> from django.shortcuts import render_to_response
> from django.template import RequestContext
> 
> def news_index(request):
> posts = Post.objects.all().order_by('published_date')
> context = {'posts': posts}
> return render_to_response('index.html', context, 
> context_instance=RequestContext(request))
> 
> 
> def news_detail(request, blogslug):
> posts = Post.objects.get(slug=blogslug)
> context = {'posts': posts}
> return render_to_response('news_detail.html', context, 
> context_instance=RequestContext(request))
> 
> Model File
> 
> from django.db import models
> 
> # Create your models here.
> 
> class Reporter(models.Model):
> name = models.CharField(max_length=60, blank=True)
> tell = models.IntegerField(blank=True, null=True)
> location = models.CharField(max_length=50, blank=True, null=True)
> address = models.TextField(max_length=250)
> 
> 
> class Post(models.Model):
> title = models.CharField(max_length=100)
> slug = models.SlugField(unique=True)
> published_date = models.DateTimeField(auto_now_add=True)
> image = models.ImageField(upload_to='static/blog')
> content = models.TextField()
> repoter = models.ForeignKey(Reporter)
> 
> 
> def __unicode__(self):
> return self.title
> 
> PROJECT/URLS
> 
> from django.conf.urls import patterns, include, url
> 
> #enable the admin:
> from django.contrib import admin
> admin.autodiscover()
> 
> urlpatterns = patterns('',
>
> url(r'^blog/', include('blog.urls')),
> url(r'^admin/', include(admin.site.urls)),
> )
> 
> 
> APP/URL
> from django.conf.urls import patterns, url
> from blog import views
> 
> urlpatterns = patterns('',
> 
> url(r'^$', views.news_index, name='news_index'),
> 
> WHEN I TYPE 127.0.0.1:8000/blog it outputs the first url in this file as a 
> series of links.
> url(r'^(?P\d+)/$', views.news_detail, name='news_detail'),
> When i clik on the links this second url breaks down, giving me the error 
> below
> 
> )
> 
> 
> Page not found (404)
> 
> Request Method:   GET
> Request URL:  http://127.0.0.1:8000/blog//
> Using the URLconf defined in rango.urls, Django tried these URL patterns, in 
> this order:
> 
> ^blog/ ^$ [name='news_index']
> ^blog/ ^(?P\d+)/$ [name='news_detail']
> ^admin/
> The current URL, blog//, didn't match any of these.
> 
> You're seeing this error because you have DEBUG = True in your Django 
> settings file. Change that to False, and Django will display a standard 404 pa
> 
> 
> Please i really need help here
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/e7a715a2-252f-4db7-ad6d-ce1aa721916c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2C3BF0E3-21B7-48D4-B6A7-9BF83EB7A4DC%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: urls not maching

2014-07-13 Thread ngangsia akumbo


Here is the similar probe

*views File*
















*# Create your views here.from blog.models import Postfrom django.shortcuts 
import render_to_responsefrom django.template import RequestContextdef 
news_index(request):posts = 
Post.objects.all().order_by('published_date')context = {'posts': 
posts}return render_to_response('index.html', context, 
context_instance=RequestContext(request))def news_detail(request, 
blogslug):posts = Post.objects.get(slug=blogslug)context = 
{'posts': posts}return render_to_response('news_detail.html', context, 
context_instance=RequestContext(request))*Model File





















































*from django.db import models# Create your models here.class 
Reporter(models.Model):name = models.CharField(max_length=60, 
blank=True)tell = models.IntegerField(blank=True, null=True)
location = models.CharField(max_length=50, blank=True, null=True)
address = models.TextField(max_length=250)class Post(models.Model):
title = models.CharField(max_length=100)slug = 
models.SlugField(unique=True)published_date = 
models.DateTimeField(auto_now_add=True)image = 
models.ImageField(upload_to='static/blog')content = 
models.TextField()repoter = models.ForeignKey(Reporter)def 
__unicode__(self):return self.titlePROJECT/URLSfrom 
django.conf.urls import patterns, include, url#enable the admin:from 
django.contrib import adminadmin.autodiscover()urlpatterns = 
patterns('',   url(r'^blog/', 
include('blog.urls')),url(r'^admin/', 
include(admin.site.urls)),)APP/URLfrom django.conf.urls import patterns, 
urlfrom blog import viewsurlpatterns = patterns('',url(r'^$', 
views.news_index, name='news_index'),WHEN I TYPE 127.0.0.1:8000/blog it 
outputs the first url in this file as a series of links.
url(r'^(?P\d+)/$', views.news_detail, name='news_detail'),When i 
clik on the links this second url breaks down, giving me the error below)*
Page not found (404)  Request Method: GET  Request URL: 
http://127.0.0.1:8000/blog//  
 
Using the URLconf defined in rango.urls, Django tried these URL patterns, 
in this order: 

   1. ^blog/ ^$ [name='news_index'] 
   2. ^blog/ ^(?P\d+)/$ [name='news_detail'] 
   3. ^admin/ 

The current URL, blog//, didn't match any of these.
 You're seeing this error because you have DEBUG = True in your Django 
settings file. Change that to False, and Django will display a standard 404 
pa


Please i really need help here

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e7a715a2-252f-4db7-ad6d-ce1aa721916c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.