Re: cannot import path in urls

2019-10-03 Thread Taylor Hughes-Scott
Hi,

You will need to make the change in both urls.py files that you have
created.

Regards,

On Thu., 3 Oct. 2019, 3:36 pm MEGA NATHAN, 
wrote:

> Hi.
> In which  file i rewrite app/urls are main file url i write...
>
>
>
>
>
> *Regards*
> Meganathan G
>
>
>
> On Thu, Oct 3, 2019 at 10:21 AM Suraj Thapa FC 
> wrote:
>
>> In urls.py
>> Write
>> from django.urls import path
>>
>> On Thu, 3 Oct, 2019, 10:02 AM MEGA NATHAN, 
>> wrote:
>>
>>> Hi.
>>>
>>>
>>> i'm meganathan beginer for django 
>>>
>>> urls cannot import for path . how to reslove 
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/a0c82af4-da14-49e4-a0af-eff26f47afbd%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPjsHcEv9-av30MrCetr0FxAHHEpjHM_0jiava_PP6XdKQWLwg%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEvDBLdYvK%2BQBYCfX_g3mchvJ91NT5xEXA8ZDjFqjru-SLPU3A%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAOisOJncWU_21xnx%3DmZPA1Rd3KOdFUYeCxdfP8DsTx70OoDSA%40mail.gmail.com.


Re: cannot import path in urls

2019-10-02 Thread Taylor Hughes-Scott
Hi,

It looks like you aren't importing path from the right location in your
urls.py file, try the following import to see if that resolves your issue.

from django.urls import path

Regards,

On Thu., 3 Oct. 2019, 2:33 pm MEGA NATHAN, 
wrote:

> Hi.
>
>
> i'm meganathan beginer for django 
>
> urls cannot import for path . how to reslove 
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a0c82af4-da14-49e4-a0af-eff26f47afbd%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAOisOKHPMMh5Aq%2B-D5m3%2BYC6yf6XAfvoSq%2BzjJp%3DYbPyEDzpg%40mail.gmail.com.


Re: why-do-i-get-an-error-about-importing-django-settings-module

2019-06-25 Thread Taylor Hughes-Scott
Based on the screenshots, that is not an error. That is just the standard
django code that your seeing. It trying to import settings and if they
don't exist then it will show that error.

I recommend going through the django tutorial
https://docs.djangoproject.com/en/2.2/intro/tutorial01/

On Tue., 25 Jun. 2019, 12:48 pm MATTHEW GODSTIME, 
wrote:

> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CADxAG5G%3DbEt0ymxq%3DSB9dERPoZSr5rX_p00C2D2ZBxim57GUHQ%40mail.gmail.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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAOisO%2BRrv4oygaULLMOD82_UrYHppQgVke_GWdiL0VHb0c%2B6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can I send an outlook mail from angular using django

2019-06-12 Thread Taylor Hughes-Scott
I'm not so sure about sending outlook email through django. However i do
know django has a basic email sending built in have you had a look at that?
https://docs.djangoproject.com/en/2.2/topics/email/

On Thu., 13 Jun. 2019, 10:41 am Sai Aravind,  wrote:

> How can I send an outlook mail from angular using django can u please
> provide a y document for this
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/711f3310-0b89-400e-adff-4aaf61e51cff%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAOisOJQGg05hZw98PQTHnbWVSfQQ9NERFccSm8ERJOqn5YirQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: parse xml from url to database

2019-06-12 Thread Taylor Hughes-Scott
Are you able to provide an example url or xml file. That would help to
figure out why no listings are created.


On Thu., 13 Jun. 2019, 9:04 am Ewen Le Bihan, 
wrote:

> Hi, where does prof.xml_ky comes from ?
>
> Le mercredi 12 juin 2019 18:22:01 UTC+2, Nuno Vieira a écrit :
>>
>> Hi there.
>>
>> I´m having some problems on parsing a real estate xml to database.
>> The user profile have url field to import properties automatically from
>> xml feed (url). The user can insert mannually or automatically, if the user
>> insert the url feed then it should be able to get the objects and save them
>> to mysql database automatically.
>> The function is not working and i do not know why, gives no error but
>> don´t populate the database.
>>
>> Models.py:
>> class Listing(models.Model):
>> '''Create table listing in db '''
>> realtor = models.ForeignKey(User, on_delete=models.CASCADE)
>> title = models.CharField(max_length=200)
>> address = models.CharField(max_length=200)
>> city = models.CharField(max_length=100)
>> state = models.CharField(max_length=100)
>> zipcode = models.CharField(max_length=20)
>> longitude = models.DecimalField(max_digits=9, decimal_places=6,default=0)
>> latitude = models.DecimalField(max_digits=9, decimal_places=6, default=0)
>> description = models.TextField(blank=True)
>> price = models.IntegerField()
>> bedrooms = models.IntegerField()
>> bathrooms = models.DecimalField(max_digits=2, decimal_places=1)
>> garage = models.IntegerField(default=0)
>> sqmt = models.IntegerField(blank=True)
>> lot_size = models.DecimalField(max_digits=5, decimal_places=1,blank=True)
>> On_Processing = 'On Processing'
>> AMais = 'A+'
>> A = 'A'
>> B = 'B'
>> BMenos = 'B-'
>> C = 'C'
>> D = 'D'
>> E = 'E'
>> F = 'F'
>> ENERGY_RATE_CHOICES = [
>> (On_Processing, 'On Processing'),
>> (AMais, 'A+'),
>> (A, 'A'),
>> (B, 'B'),
>> (BMenos, 'B-'),
>> (C, 'C'),
>> (D, 'D'),
>> (E, 'E'),
>> (F, 'F'),
>> ]
>> energy_rate = models.CharField(
>> max_length=12,
>> choices=ENERGY_RATE_CHOICES,
>> default=On_Processing,
>> )
>> photo_main = models.ImageField(upload_to='photos/%Y/%m/%d/', default=
>> 'default.jpg')
>> photo_main_url = models.URLField(blank = True)
>> is_published = models.BooleanField(default=True)
>> list_date = models.DateTimeField(default=datetime.now, blank=True)
>> video_url = models.CharField(max_length=100, blank=True)
>> virtual_tour = models.URLField(blank=True)
>> visit_num = models.PositiveIntegerField(default=0)
>>
>> def __str__(self):
>> return self.title
>>
>> def get_absolute_url(self):
>> return reverse('listing-detail', kwargs={'pk': self.pk})
>>
>> Function on xml_parse.py:
>> ...
>> import xml.etree.ElementTree as ET
>> import requests
>> from users.models import Profile
>>
>>
>> def xml_parse(self):
>> prof_list = Profile.objects.all()
>> for prof in prof_list:
>> if prof.xml_ky is not None:
>> url = xml_ky
>> response = request.get(url)
>> with open('xml/%s' % self.id + '/feed.xml', 'wb') as file:
>> file.write(response.content)
>>
>> tree = ET.parse('xml/%s' % self.id + '/feed.xml')
>> root = tree.getroot()
>> for props in root.iter('property'):
>> listing, created = Listing.object.create(
>> title = props.find('type').text + ' ' + props.find('town').text,
>> address = props.find('location_detail').text,
>> city = props.find('town').text,
>> state = props.find('province').text,
>> zipcode = props.find('zipcode').text,
>> loc = props.find('location'),
>> longitude = loc.find('longitude').text,
>> latitude = loc.find('latitude').text,
>> desc = props.find('desc'),
>> description = desc.find('en').text,
>> price = props.find('price').text,
>> bedrooms = props.find('beds').text,
>> bathrooms = props.find('baths').text,
>> garage = props.find('garage').text,
>> area = props.find('surface_area'),
>> sqmt = area.find('built').text,
>> energy_rate = props.find('energy_rate').text,
>> realtor = self.request.user,
>> img = props.find('images'),
>> image = img.get('id=1'),
>> image_url = image.find('url').text,
>> photo_main_url = image_url,
>> video_url = props.find('video_url').text,
>> virtual_tour = props.find('virtual_tour').text,
>> )
>> if created:
>> return listing.save()
>>
>>
>>
>> If you could help me and point me in the right direction it would be
>> great.
>>
>> Thanks and sorry for the black background!
>>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/20aa727c-d1e8-4d5f-a17d-ac17947ba5f3%40googlegroups.com
> 
> .
> For more options, visit 

Re: Django model form is not getting saved in Postgresql database

2019-06-03 Thread Taylor Hughes-Scott
No problem. Glad you got it sorted.

On Tue., 4 Jun. 2019, 8:16 am Ankhi Roy,  wrote:

> Hey,
>
> Nevermind I have solved the problem.
> I was in an impression that I need to create a seperate database
> equivalent to django model form. Then realised that Django automatically
> creates a database table like databasename_modelclassname and have all the
> columns as per Django model form.
>
> Anyway thanks for your time.
>
> Thanks
>
>
>
> On Mon, Jun 3, 2019, 4:38 PM Ankhi Roy  wrote:
>
>> Hi,
>>
>> I am using Django admin - 2.2.1 and Postgresql as my database. So my
>> problem is I have saved the user entered data in form.py on "POST" Request
>> but it isn't saving in the postgresql database.
>>
>> Model.py -
>>
>> class modelForm(models.Model):
>> CHOICES = [('Y', 'Yes'),
>>('N', 'No')]
>> allow = models.CharField( max_length = 4 , choices = CHOICES)
>>
>> description = models.CharField( max_length=1000)
>>
>> usingtheproduct = models.CharField( max_length = 4 , choices =
>> CHOICES)
>>
>>
>>  Forms.py file -
>>
>>
>>
>> class productForm(forms.ModelForm):
>> class Meta:
>> model = modelForm
>>
>> fields = ["allow", "description", "usingtheproduct"]
>>
>> labels = {
>> "allow": "Allow",
>> "description": "Description",
>> "usingtheproduct": "Using The Product"
>> }
>>
>>
>> first.html file -
>>
>>  {% csrf_token %}
>> {{form}}
>>  
>> 
>>
>>
>> Views.py -
>>
>>
>>
>> def first(request):
>> template = loader.get_template('xyz/first.html')
>> form = productForm(request.POST or None) #
>> https://stackoverflow.com/questions/35748734/django-local-variable-form-referenced-before-assignment
>>
>> if request.method == 'POST':
>>
>> form = productForm(data = request.POST)
>>
>> if form.is_valid():
>>
>> allow = request.POST.get('Allow', '')
>> decription = request.POST.get('Decription', '')
>>  usingtheproduct= request.POST.get('Using The Product', '')
>> form.save() # This did not work as did not store user
>> enetered data in postgresql database.
>> return HttpResponse("It is getting saved") # I can see
>> this message in browser after submitting the html form,
>> else:
>> print(form.errors)
>>
>> return HttpResponse(template.render({'form': form}, request))
>>
>>
>>
>>
>> setting.py file -
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
>> 'NAME': 'abc',
>> 'USER' : 'xyz',
>> 'PASSWORD' : '*',
>> 'HOST': 'localhost',
>> 'PORT':'',
>>
>> } # I have also created a database and a table with model name and
>> have the exact columns as that of form input variables that is I have 3
>> column as allow, description, usingtheproduct in the postgresql database.
>> }
>>
>>
>> So not sure why the data is not getting saved in the postgresdatabase, am
>> i missing something? Thanks for your time.
>>
>> Thanks
>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/9334a917-1539-4bfc-96f2-c2f617f2ff9d%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABUQWg9uqmNJTs3ckALfJoxuokH3Fe7_3XkY-J%2BccqKyDrQYrw%40mail.gmail.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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 

Re: Django model form is not getting saved in Postgresql database

2019-06-03 Thread Taylor Hughes-Scott
With your form.save() call try passing commit=True so it looks like
form.save(commit=True)

On Tue., 4 Jun. 2019, 1:39 am Ankhi Roy,  wrote:

> Hi,
>
> I am using Django admin - 2.2.1 and Postgresql as my database. So my
> problem is I have saved the user entered data in form.py on "POST" Request
> but it isn't saving in the postgresql database.
>
> Model.py -
>
> class modelForm(models.Model):
> CHOICES = [('Y', 'Yes'),
>('N', 'No')]
> allow = models.CharField( max_length = 4 , choices = CHOICES)
>
> description = models.CharField( max_length=1000)
>
> usingtheproduct = models.CharField( max_length = 4 , choices = CHOICES)
>
>
>  Forms.py file -
>
>
>
> class productForm(forms.ModelForm):
> class Meta:
> model = modelForm
>
> fields = ["allow", "description", "usingtheproduct"]
>
> labels = {
> "allow": "Allow",
> "description": "Description",
> "usingtheproduct": "Using The Product"
> }
>
>
> first.html file -
>
>  {% csrf_token %}
> {{form}}
>  
> 
>
>
> Views.py -
>
>
>
> def first(request):
> template = loader.get_template('xyz/first.html')
> form = productForm(request.POST or None) #
> https://stackoverflow.com/questions/35748734/django-local-variable-form-referenced-before-assignment
>
> if request.method == 'POST':
>
> form = productForm(data = request.POST)
>
> if form.is_valid():
>
> allow = request.POST.get('Allow', '')
> decription = request.POST.get('Decription', '')
>  usingtheproduct= request.POST.get('Using The Product', '')
> form.save() # This did not work as did not store user enetered
> data in postgresql database.
> return HttpResponse("It is getting saved") # I can see
> this message in browser after submitting the html form,
> else:
> print(form.errors)
>
> return HttpResponse(template.render({'form': form}, request))
>
>
>
>
> setting.py file -
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
> 'NAME': 'abc',
> 'USER' : 'xyz',
> 'PASSWORD' : '*',
> 'HOST': 'localhost',
> 'PORT':'',
>
> } # I have also created a database and a table with model name and
> have the exact columns as that of form input variables that is I have 3
> column as allow, description, usingtheproduct in the postgresql database.
> }
>
>
> So not sure why the data is not getting saved in the postgresdatabase, am
> i missing something? Thanks for your time.
>
> Thanks
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9334a917-1539-4bfc-96f2-c2f617f2ff9d%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAOisOJqMXB8B1h2P2xhDPnzD43AkVwT617dA_zybSpimZfL2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.