Using the Models from two Different Projects in a single script

2019-01-15 Thread Glen D souza
Hi, I have two different django projects which each project having different model Lets say projects to be p1 and p2 Now i have to populate the data from p1 model to a model in p2 ( note p1 and p2 models are different, i just have to use some data from p1 model to move to p2) Now in order to

Re: Saving data fails because of null constraint when data is not null

2018-12-22 Thread Glen D souza
if you check the error message DETAIL: Failing row contains (3, 1, Consultation OPD, 135, 135, null, 1). There are total of 7 values Check your model class CGHSRates(models.Model): rid = models.AutoField(primary_key=True) serial = models.IntegerField(default=0) name = models.CharField(max_lengt

Re: Help with data bound ModelChoiceField

2018-12-13 Thread Glen D souza
In the First Screenshot the code is def __str__(self): return "Customer" + "self.id" Remove the quotes from "self.id" def __str__(self): return "Customer" + self.id On Wed, 12 Dec 2018 at 10:47, wrote: > > TY madjardi for all your input! I continued to search and found what I > wanted. But

Re: Use tables from a database without creating models

2018-10-16 Thread Glen D souza
Hi, If the Data Base is already present then Django provides an handy command which will translate your Database schemas into Django models You have to run python manage.py inspectdb It will auto generate the models based on the Schema. Best way to access the data present in the db in the Djang

Re: Blog app Error: NoReverseMatch at /post/14/

2018-10-12 Thread Glen D souza
*def add_comment(request, slug):* *post = get_object_or_404(Post, slug=slug)* *if request.method == 'POST':* *form = CommentForm(request.POST)* *if form.is_valid():* *comment = form.save(commit=False)* *comment.post = post* *comment.save()

Re: Blog app Error: NoReverseMatch at /post/14/

2018-10-12 Thread Glen D souza
try renaming path('post//comment/', views.add_comment, name= 'add-comment'), to path('post//comment/', views.add_comment, name='add-comment'), On Fri, 12 Oct 2018 at 12:36, Robert CR wrote: > i fixed the error, thanks. But there is already a new one when i try to > add a comment. D: > > [image:

Re: Blog app Error: NoReverseMatch at /post/14/

2018-10-11 Thread Glen D souza
Hi, Try after name-spacing url patterns i.e app_name = 'blog' urlpatterns = [ path('', PostListView.as_view(), name='blog-home'), path('user//', UserProfileListView.as_view(), name= 'user-profile' ), path('user//posts/', UserPostListView.as_view(), name= 'user-posts'), path('user

Single Django App using Multiple Databases

2018-10-02 Thread Glen D souza
Hi, I am working on a project where i am using a single django app which is backed by different databases. Let me explain the use case clearly, I have a app say app1, and app1 data is located in two different databases say db1 and db2 data present in the db1 and db2 are different, lets say db1 h

Re: TypeError: view must be a callable or a list/tuple in the case of include().

2018-08-25 Thread Glen D souza
url(r'^$', 'blog.views.home', name='home') You are passing a string as view by quoting blog.views.home remove the quotes and try, i.e url(r'^$', blog.views.home, name='home') On Fri, 24 Aug 2018 at 03:17, herve kabore wrote: > this is the urls.py > > > from django.conf.urls import url > fro

Re: App Registeries not ready

2018-08-15 Thread Glen D souza
1.open your django project 2.open the terminal in pycharm, it is located at bottom left corner 3. in the terminal change the directory to the location where manage.py is located 4. type the following python3.7 manage.py shell On Thu, 16 Aug 2018 at 10:20, Vikrant Gupta wrote: > I did according

Re: Model formset not saving

2018-07-17 Thread Glen D souza
have you tried form.save(commit = True) ? On 18 July 2018 at 01:27, wrote: > Is there a paid support option to get help? I've been trying to ask for > help on IRC for a while but all I've gotten is insults. > > On Monday, July 16, 2018 at 6:06:00 PM UTC-4, cbpa...@gmail.com wrote: >> >> I'm u

Re: Django foreign-key cannot assign must be a instance

2018-07-17 Thread Glen D souza
I would suggest you to try this code sav_list = List(id=4, item_name ='name1', item_desc='desc1', location='location', reason='rfp', pid=Order.objects.get(poid = 3)) Instead of passing integer 3 to pid, try to the pass the order Object which has the poid = 3 On 17 July 2018 at 17:33, Sainath B

Re: Can't access my django runserver

2018-06-30 Thread Glen D souza
I think there is a ' , ' missing after 'DIRS' in Templates settings On Saturday, 30 June 2018, Umar Kambala wrote: > > this are my codes... > > # SECURITY WARNING: don't run with debug turned on in production! > DEBUG = True > > ALLOWED_HOSTS = ['127.0.0.1', '.pythonanywhere.com'] > ALLOWED_HOST