Re: Problems with migrations cleaning up a date field

2017-06-10 Thread Melvyn Sopacua
On Friday 09 June 2017 20:56:46 James Schneider wrote: > Quite honestly this sounds like a bug in the migration system if > that's the case. I'm pretty sure it should ask what value to use as a > filler value during the migration, although I haven't had a change > like that in a while. When yo

Re: Problems with migrations cleaning up a date field

2017-06-10 Thread Melvyn Sopacua
On Friday 09 June 2017 18:08:39 Lee Hinde wrote: > I'm having problems with a migration after cleaning up an oddity with > a date field and I'm not sure how to fix it. Any advice appreciated. > > I made this change to a date field: > > -start_date = models.DateField(db_index=True, default=Fa

Re: Same form saving to related models

2017-06-10 Thread yingi keme
Well. What you are trying to do is a bit awkward, but i will try my best to answer. The variable for foreign key is supposed to be declared under Student model because parents can typically have more than one kid in a school isnt it? You should try and understand relational database. Now this i

Re: Same form saving to related models

2017-06-10 Thread Elorm Koku
Thanks yingi, u saved a life :) On Jun 10, 2017 12:20 PM, "yingi keme" wrote: > Well. What you are trying to do is a bit awkward, but i will try my best > to answer. > > The variable for foreign key is supposed to be declared under Student > model because parents can typically have more than one

Re: Same form saving to related models

2017-06-10 Thread Melvyn Sopacua
On Saturday 10 June 2017 13:20:11 yingi keme wrote: > The variable for foreign key is supposed to be declared under Student > model because parents can typically have more than one kid in a > school isnt it? And typically, students can have more then one parent. So either rename your Parent mod

Filter queryset based on another model's foreign key in a class based view.

2017-06-10 Thread Ajat Prabha
Hi there, I'm having trouble in filtering objects of a model based on another model's foreign key. The scenario is, I've got a forum homepage and when a topic is clicked, it opens its DetailView. Now if I try to get all answers in the database there's no issue, but I want to get only the answers

Re: Filter queryset based on another model's foreign key in a class based view.

2017-06-10 Thread Alceu Rodrigues de Freitas Junior
See "reverse lookup" or "_set" function in order to do that. Your Answer model has a FK for the Topic, but not the other way around. See https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Generic_views, "Creating the Detail View template" for details about it, there are some li

Re: Same form saving to related models

2017-06-10 Thread Elorm Koku
Melvin thanks, actually my models are simplified...the switch of fk was a way of trying to use it at d front end so that I could provide an id to link em up...unfortunately I can't go around it since an instance of the model is not easily accessible cos its a new object not saved yet...I thought of

Re: Same form saving to related models

2017-06-10 Thread yingi keme
Yea exactly. A many to many relationship is the best approach on this. Elorm you should try many to many relationship if you are not completely satisfied. Thanks Melvyn Yingi Kem > On 10 Jun 2017, at 3:38 PM, Melvyn Sopacua wrote: > > On Saturday 10 June 2017 13:20:11 yingi keme wrote: >

Re: Same form saving to related models

2017-06-10 Thread Melvyn Sopacua
On Saturday 10 June 2017 15:42:50 Elorm Koku wrote: > Melvin thanks, actually my models are simplified...the switch of fk > was a way of trying to use it at d front end so that I could provide > an id to link em up...unfortunately I can't go around it since an > instance of the model is not easily

Re: Filter queryset based on another model's foreign key in a class based view.

2017-06-10 Thread Melvyn Sopacua
On Saturday 10 June 2017 08:22:20 Ajat Prabha wrote: > class TopicDetailView(generic.DetailView): > > model = Topic > > context_object_name = 'topic' > > template_name = 'topicdetail.html' > > def get_context_data(self, **kwargs): > > context = super(TopicDetailView, > >

url and view for updating django userprofile

2017-06-10 Thread change i need
Here is my model.py # User profile model class UserProfile(models.Model): user = models.OneToOneField(User,unique=True,on_delete=models.CASCADE) bio = models.TextField(max_length=500,null=True,blank=True) picture = models.ImageField(upload_to="profile_image",null=True,blank=True,) company = mod

Re: What is the best approach

2017-06-10 Thread Melvyn Sopacua
On Friday 09 June 2017 23:26:57 Arshdeep Singh wrote: > down votefavorite > > django#> > > I was thinking about making a Hostel Allocation Web application. It > has models, Student, Room, Hostel. What I want is to create a >

Re: Filter queryset based on another model's foreign key in a class based view.

2017-06-10 Thread Ajat Prabha
Thanks, Melvyn Sopacua, Now it all makes sense. On Saturday, 10 June 2017 21:54:57 UTC+5:30, Melvyn Sopacua wrote: > > On Saturday 10 June 2017 08:22:20 Ajat Prabha wrote: > > > > > > > class TopicDetailView(generic.DetailView): > > > > model = Topic > > > > context_object_name = 'topic' > > >

How to Use gRPC with Protocol buffer with Django

2017-06-10 Thread kashif Nawaz
Hey, I am using Django to make an E-commerce website and i want to use gRPC with Protocol Buffer , so, i can serve different client platform to like IOS, Android etc. i want

Re: Error(after updating to django 1.9

2017-06-10 Thread inspiringword
Try to remove django manually sudo pip uninstall django On Wednesday, February 17, 2016 at 10:24:17 PM UTC+5:30, Deepak Gupta wrote: > > > I am trying to create a project > CommandError: /home/shaastr/bnms/manage.py already exists, overlaying a > project or app into an existing directory won't

Re: Error(after updating to django 1.9

2017-06-10 Thread inspiringword
Try to remove manually sudo pip uninstall django sudo rm /usr/local/lib/python2.7/dist-packages/django_* -rf Then install latest version sudo pip install django== this worked for me. On Wednesday, February 17, 2016 at 10:24:17 PM UTC+5:30, Deepak Gupta wrote: > > > I am trying

Django m2m_changed pk_set is empty

2017-06-10 Thread Jason Robinson
Hi everyone, Django version 1.10.7, I have a problem where sometimes my receiving `m2m_changed` signal on a ManyToMany field has `pk_set` empty. The model m2m part (note it's a `self` reference): class Profile(TimeStampedModel): following = models.ManyToManyField( "self"

Re: url and view for updating django userprofile

2017-06-10 Thread James Schneider
Here is the problem line in your view: return redirect('success:profile_accounts') You'll need to create an appropriate URL entry for your form submission redirect. -James On Jun 10, 2017 9:23 AM, "change i need" wrote: > Here is my model.py > > > # User profile model > class UserProfile(mod